Re: Win32Lib: Creating Custom Dialog Box
- Posted by Jonas Temple <jtemple at yhti.net> Apr 19, 2004
- 386 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