Re: Custom Dialogs
What you need to do is make a function that creates a new window:
function createDialog()
integer win_id,
combo1_id,
combo2_id,
btn1_id,
btn2_id
win_id = create( Window, "Dialog", 0, {0.5,-160}, {0.5, -120}, 320, 240, 0 )
combo1_id = create( Combo, "", win_id, 10, 10, 100, 20, 0 )
combo2_id = create( Combo, "", win_id, 10, 40, 100, 20, 0 )
btn1_id = create( PushButton, "OK", win_id, 10, 70, 90, 30, 0 )
btn2_id = create( PushButton, "Cancel", win_id, 10, 110, 90, 30, 0 )
-- link some events:
setHandler( win_id, w32HClose, routine_id("Dialog_Close_Handler") )
setHandler( combo1_id, w32HChange, routine_id("Combo1_Change_Handler") )
-- etc, etc, etc...
return {win_id, combo1_id, combo2_id, btn1_id, btn2_id}
end function
When you are done with the dialog, call destroy(win_id) to delete the Window and
its children,
and free up the resources.
Then simply create a wrapper:
procedure startDialog()
sequence ids
ids = createDialog() -- make a new dialog
openWindow( ids[1], Normal ) -- Modaless, since we need multiple
windows open
-- from here your event handlers take over
-- keep in mind you should call destroy() from the w32HClose event for the
main window
-- to free up the resources
end procedure
----- Original Message -----
From: Virtual B <behaviorself at netzero.net>
To: EUforum <EUforum at topica.com>
Sent: Monday, March 31, 2003 9:26 AM
Subject: RE: Custom Dialogs
Hi Jonas,
Nothing to be sorry about. I don't consider it an interruption. I'd
like to get any help I can from anyone who can help, so I very much
appreciate your input.
I've seen openDialog(), but unless I'm missing something it won't work
for what I want to do. I need to have several dialogs open at the same
time. From what I understand, openDialog() is modal, and won't open
another dialog until the first one is closed. If I'm just not
understanding how it works, please (anyone) feel free to let me know.
Thanks,
Virtual B
Jonas Temple wrote:
> Virutal B,
>
> Sorry to interrupt the conversation, but I've done this sort of thing
> with Win32Lib. Here's roughly how I did it:
>
> 1. Create the dialog box as desired (I used Judith's IDE)
> 2. Create a global function that invokes the dialog (i.e. -
> getSomething())
> 3. In getSomething call openDialog() passing the top-most win32lib
> window ID. openDialog() does not return until the window you passed to
> the routine closes. Then just return whatever values you need to in
> getSomething().
>
> Here's an excerpt:
>
>
> --------------------------------------------------------------------------------
>
>
> -- Window CMMain
> constant CMMain = createEx( Window, "iSeries System Environment
> Connection", 0, Default, Default, 330, 405, {WS_DLGFRAME, WS_SYSMENU},
> {WS_EX_DLGMODALFRAME} )
> constant ConnGC = createEx( Group, "", CMMain, 12, 8, 304, 168, 0, 0 )
> constant CMMainLT = createEx( LText, "Select a system name and click
> Connect.", ConnGC, 20, 12, 268, 36, 0, 0 )
> constant CMMainCB = create( DropDownList, "", ConnGC, 64, 56, 152, 104,
> 0 )
> constant ConnectPB = createEx( DefPushButton, "Connect to System",
> ConnGC, 12, 96, 124, 28, 0, 0 )
> setEnable( ConnectPB, False )
> constant CancelPB = createEx( PushButton, "Cancel System", ConnGC, 148,
> 96, 124, 28, 0, 0 )
> setEnable( CancelPB, False )
> constant EnvGC = createEx( Group, "", CMMain, 12, 188, 304, 180, 0, 0 )
> constant CMMainELT = createEx( LText, "Select an environment name and
> click Connect.", EnvGC, 8, 16, 288, 36, 0, 0 )
> constant CMMainECB = createEx( DropDownList, "", EnvGC, 64, 56, 152,
> 104, 0, 0 )
> setEnable( CMMainECB, False )
> constant EnvConPB = createEx( DefPushButton, "Connect to Env", EnvGC,
> 12, 104, 124, 28, 0, 0 )
> setEnable( EnvConPB, False )
> constant EnvCanPB = createEx( PushButton, "Cancel Environment", EnvGC,
> 148, 104, 124, 28, 0, 0 )
> setEnable( EnvCanPB, False )
>
> Then I have a global open function:
>
> global function ecacm_open(atom sys_connect, atom env_connect, atom
> sec_check)
> atom rtn_code
> sequence parms, option
> object results
>
> rtn_code = 1
>
> that eventually calls:
>
> .
> .
> .
> openDialog(CMMain)
> .
> .
> .
>
> and then I return some value:
>
> return rtn_code
> end function.
>
> HTH,
>
> Jonas
TOPICA - Start your own email discussion group. FREE!
|
Not Categorized, Please Help
|
|