RE: Custom Dialogs

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi Greg,

Wow, this is exactly what I started to do a few days ago and abandoned 
because I didn't think I could trap the close event.  Would you believe 
I completely forgot about setHandler()?  Duh!  I don't have time right 
now to test this out, but it looks like this should work fine for what I 
need.

Thanks,

Virtual B

Greg Haberek wrote:
> 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",
<snip>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu