(Start of Dialog No.1 (Macro No.1))
Box1="CreateUnitTrust"
Title="Create Unit Trust data file"
TrustName=""
DIALOGDEFINE (Box1;50;50;400;280;1+2+16+512;Title)
DIALOGADDTEXT (Box1;0;8;10;70;8;1;"Trust Name:")
DIALOGADDEDITBOX (Box1;"Edit1";60;5;150;12;1;TrustName;50)
DialogAddPushButton (Box1;"AddUnitholder"; 8; 260; 100; 15; 0; "Add
Unitholders")
DIALOGDISPLAY (Box1;"Edit1")
vResult:=MacroDialogResult
If(vResult=0) //
Quit
Endif
If(vResult=1) // OK Button
WriteUnitTrustText()
Quit
Endif
If(vResult=2) // Close window/Esc key/Cancel Button
Quit
Endif
If(vResult= "AddUnitholder")
WriteUnitTrustText()
DIALOGDESTROY (Box1)
Nest("Macro2")
EndIf
LABEL (WriteUnitTrustText)
Type (+TrustName) MergeCode (Codes: EndField!)
RETURN
(Start of Macro2)
Box2="Dlg1"
Title="Add Unitholder"
UnitholderCompanyName=""
DIALOGDEFINE (Box2;50;50;400;280;1+2+16+512;Title)
DIALOGADDTEXT (Box2;0;8;10;70;8;1;"Company Name:")
DIALOGADDEDITBOX (Box2;"Edit1";80;10;150;12;1;UnitholderCompanyName;50)
DialogAddPushButton (Box2;"AddUnitholder"; 8; 260; 100; 15; 0; "Add Another
Unitholder")
DIALOGDISPLAY (Box2;"Edit1")
vResult:=MacroDialogResult
If(vResult=0) //
Quit
Endif
If(vResult=1) // OK Button
WriteUnitholderText()
Wait (10)
InsertEndRecord()
Endif
If(vResult=2) // Close window/Esc key/Cancel Button
Quit
Endif
If(vResult= "AddUnitholder")
WriteUnitholderText()
DIALOGDESTROY (Box2)
Nest("AddTrustUnitholder")
EndIf
LABEL (WriteUnitholderText)
Type (+UnitholderCompanyName) MergeCode (Codes: EndField!)
RETURN
Regards-
Paul Raymond
Paul Raymond <paulr...@atlascompanies.com.au> wrote in message
news:3a1b20d8@cnews...
I've modified your code:
//=========begin
Box1="CreateUnitTrust"
Title="Create Unit Trust data file"
TrustName=""
DIALOGDEFINE (Box1;50;50;400;280;1+2+16+512;Title)
DIALOGADDTEXT (Box1;0;8;10;70;8;1;"Trust Name:")
DIALOGADDEDITBOX (Box1;"Edit1";60;5;150;12;1;TrustName;50)
DialogAddPushButton (Box1;"AddUnitholder"; 8; 260; 100; 15; 0; "Add
Unitholders")
Label( RepeatingSection) //NEW
TrustName = "" //NEW: To erase what was in the edit control previously.
DIALOGDISPLAY (Box1;"Edit1")
vResult:=MacroDialogResult
If(vResult=0) //
Quit
Endif
If(vResult=1) // OK Button
WriteUnitTrustText()
Quit
Endif
If(vResult=2) // Close window/Esc key/Cancel Button
Quit
Endif
If(vResult= "AddUnitholder")
WriteUnitTrustText()
// DIALOGDESTROY (Box1) //REMOVED
// Nest("Macro2") //REMOVED
Go( RepeatingSection) //NEW
EndIf
LABEL (WriteUnitTrustText)
Type (+TrustName) MergeCode (Codes: EndField!)
RETURN
//=========end
If you are interested in knowing more, let me know.
Have a nice day!
James