Good evening.
Another simple question, I guess (sorry the spam): using multiple dialogs, is there a way to pass values from one to other without using global variables?
Example:
I need to put information in dialog 1. To be more user friendly, to receive that information, dialog 1 opens dialog 2. When a button "ok" his hit in dialog 2, this one closes and the info set there is written in dialog 1 fields.
Thank you
Extend the dialog UDT
TYPE INFODLG
DIALOG dlg
STRING return1
STRING return2
STRING return3
INT something
ENDTYPE
The magic rule is the first member of a UDT has the same address as the UDT itself.
def idlg as INFODLG
CREATEDIALOG idlg.dlg, .....
...
DoModal idlg.dlg
print idlg.return1
The when processing @IDOK use a typecast to fill in members for the return. Instead of #<WINDOW>@HITWINDOW use #<INFODLG>@HITWINDOW
case @idcontrol
if @controlid = @IDOK
#<INFODLG>@HITWINDOW.return1 = "hello there"
....
Now I mentioned the "magic rule". I usually use NEW/DELETE and save the pointer to the original UDT as a property. Which allows you to do things like:
pDlg = NEW(INFODLG, 1)
CREATEDIALOG #<DIALOG>pDlg
...
DoModal #<DIALOG>pDlg
...
DELETE pDlg
Paul
Wow. Wonderful and fast :) Thank you!
I wish I know this years ago! :D
Very useful.
Thanks, Paul.
Amazing. I am "translating" some big CB code to EB. This makes things so easy! :)
Do you writte converter from CB to EB with this?
If you do...
that would be wonderful!!!
Figured out the "magic rule", which makes me do less changes :) Amazing. Paul, you have all knowledge in your head, or you check your documents and help files to answer us?
Mostly from the top of my head. Sometimes have to look up an answer.
Quote from: aurelCB on May 09, 2008, 11:54:13 AM
Do you writte converter from CB to EB with this?
If you do...
that would be wonderful!!!
Hi aurelCB!
there is already a IbstandardToPro converter.
see this link :
http://www.ionicwind.com/forums/index.php/topic,1644.msg15229.html#msg15229
I forget answaer you...
I try this converter before , i try convert my interpreter
but im failed becose Ebasic say that dont suport local subroutine.
To me the real value of this technique is sending information into the dialog.
TYPE EXTENDEDDIALOG
Dialog dlg
String msg
ENDTYPE
...
Def dlgAgendaItem as EXTENDEDDIALOG
...
Select @MENUNUM
Case AGENDA_ITEM_EDIT
dlgAgendaItem.msg = "Edit"
DoModal dlgAgendaItem, dlgAgenda
Case AGENDA_ITEM_NEW
dlgAgendaItem.msg = "New"
DoModal dlgAgendaItem, dlgAgenda
EndSelect