1. Win32Lib: Creating Custom Dialog Box
- Posted by cklester <cklester at yahoo.com> Apr 19, 2004
- 392 views
How do I create a dialog box that will return a value? For instance, so I can do something like this: myVal = myDialog() and myDialog() is a function which calls up a window and processes the results. This is probably elementary, but I just can't see it without resorting to globals, etc. Thanks!
2. Re: Win32Lib: Creating Custom Dialog Box
- Posted by Jonas Temple <jtemple at yhti.net> Apr 19, 2004
- 406 views
cklester wrote: > > > How do I create a dialog box that will return a value? For instance, so I can > do > something like this: > > myVal = myDialog() > > and myDialog() is a function which calls up a window and processes the > results. > > This is probably elementary, but I just can't see it without resorting to > globals, > etc. > > Thanks! > CK, Here's how I created one, cliffnotes version: 1. Create your dialog window definition. 2. Write a routine that will display the dialog and return the value: global function ecaut_getSaveObjectName(sequence system_name, sequence library_name, sequence object_name, sequence object_type, sequence extended_types, sequence name_label, atom options) openDialog(ObjectBrowseWin) -- If the user cancel the dialog return a 0 if open_dlg_cancel then return 0 -- Else return the selected object information else if isVisible(OpenMemberET) and equal(getText(OpenMemberET),"*ALL") then setText(OpenMemberET,"*FIRST") end if return {getText(OpenLibraryET), getText(OpenNameET), getItem(OpenTypeDDL, getIndex(OpenTypeDDL)), open_obj_attr, getText(OpenMemberET)} end if end function 3. Now in your program where you want to display the dialog, call the function created in step 2: rtn_obj = ecaut_getOpenObjectName(tv_select[1], browse_lib, "", "*LIB", {"*ALL"}, "Library", 0) The trick here is that openDialog (Win32Lib function) will not return to your routine until the window is closed (in my case, ObjectBrowseWin). BTW, these code snippets are pulled from an actual program where this method is in use. HTH, Jonas
3. Re: Win32Lib: Creating Custom Dialog Box
- Posted by cklester <cklester at yahoo.com> Apr 19, 2004
- 380 views
Jonas Temple wrote: > > cklester wrote: > > > > How do I create a dialog box that will return a value?> > > Here's how I created one, cliffnotes version: > > 1. Create your dialog window definition. > 2. Write a routine that will display the dialog and return the value: > > global function ecaut_getSaveObjectName(sequence system_name, sequence > library_name, > sequence object_name, sequence > object_type, > sequence extended_types, sequence > name_label, > atom options) > openDialog(ObjectBrowseWin) > -- If the user cancel the dialog return a 0 > if open_dlg_cancel then Where is open_dlg_cancel defined? Is that a Win32Lib constant? Is that a global var? Thanks Jonas! -ck
4. Re: Win32Lib: Creating Custom Dialog Box
- Posted by Jonas Temple <jtemple at yhti.net> Apr 19, 2004
- 377 views
cklester wrote: > > > Jonas Temple wrote: > > > > cklester wrote: > > > > > > How do I create a dialog box that will return a value?> > > > > Here's how I created one, cliffnotes version: > > > > 1. Create your dialog window definition. > > 2. Write a routine that will display the dialog and return the value: > > > > global function ecaut_getSaveObjectName(sequence system_name, sequence > > library_name, > > sequence object_name, sequence > > object_type, > > sequence extended_types, sequence > > name_label, > > atom options) > > openDialog(ObjectBrowseWin) > > -- If the user cancel the dialog return a 0 > > if open_dlg_cancel then > > Where is open_dlg_cancel defined? Is that a Win32Lib constant? Is that a > global var? Should've mentioned that the code and UI definition for ObjectBrowseWin is contained in an include file. open_dlg_cancel is set when the user clicks the "Cancel" button on the dialog. If I didn't have this then I wouldn't know after openDialog() if the user canceled the dialog or clicked "Okay". > > Thanks Jonas! You're welcome! How's the kiddos? > > -ck >
5. Re: Win32Lib: Creating Custom Dialog Box
- Posted by cklester <cklester at yahoo.com> Apr 19, 2004
- 383 views
Jonas Temple wrote: > cklester wrote: > > Jonas Temple wrote: > > > cklester wrote: > > > > How do I create a dialog box that will return a value?> > > > Here's how I created one, cliffnotes version: > > > > > > 1. Create your dialog window definition. > > > 2. Write a routine that will display the dialog and return the value: > > > > > > global function ecaut_getSaveObjectName(sequence system_name, sequence > > > library_name, > > > sequence object_name, sequence > > > object_type, > > > sequence extended_types, sequence > > > name_label, > > > atom options) > > > openDialog(ObjectBrowseWin) > > > -- If the user cancel the dialog return a 0 > > > if open_dlg_cancel then > > > > Where is open_dlg_cancel defined? Is that a Win32Lib constant? > > Is that a global var? > > Should've mentioned that the code and UI definition for ObjectBrowseWin is > contained > in an include file. open_dlg_cancel is set when the user clicks the "Cancel" > button > on the dialog. If I didn't have this then I wouldn't know after openDialog() > if > the user canceled the dialog or clicked "Okay". Gotcha. I know why you were using open_dlg_cancel. I just didn't know if it was supplied by Win32Lib or not. Derek, could you make openDialog() a function, or make a new function that opens a dialog and returns a value? > > Thanks Jonas! > > You're welcome! How's the kiddos? They're doing great! They're out of town this week at "outdoor school," a big ranch our church owns down near Austin, Texas. So, what's a single dad to do when his kids aren't home for an entire week?! heheh.