Dialog_Box and Create_Dialog (OpenInsight Specific)
At 05 JUN 1998 08:21:58PM DSig (SigSolutons) wrote:
Scenerio ..
Main Screen is a MDI frame.
1) Start_MDIChild "Front" screen which launches all other screens
2) Start_MdiChild Screen1
3) From button1 Dialog_Box screen2. I use DialogBox because I want to force user to stay in called window until 'saved/exit'. Once that happens I then have additional code which processes that data.
The problem is that None of the events work in this dialogbox. If I call the window as a mdichild .. it works. I have tried using the mdi frame as the parent id. I have tried using @window.
Any ideas why a window's events (CREATE works!) like click & quick event will not work?
Sure it is something simple .. something I am missing
dsig
David Tod Sigafoos ~ SigSOlutions
dsig@teleport.com cis:70302,77 voice:503-639-8080
At 06 JUN 1998 08:25AM Jeff Word wrote:
I am not sure why the dialog box events will not fire. I know a dialog box ties up the engine so other processing is halted. We have run into limitations with dialog boxes so about the only time we use them is for basic Yes/No response. Here is an approach we use to simulate a dialog box yet still call it as a regular child.
* Pre-processing
* start the window, occupy the engine and yield, wait for return
Call Start_MDIChild ( Child, MDIFrame, CreateParam )
Loop
Call Yield()WindowHandle=Get_Property( Child, 'HANDLE' )Until WindowHandle=' Repeat
* Post-processing
This approach lets the child function and as soon as the child is closed then processing continues. We use this to add records to other tables on-the-fly so we have the write event issue a send_event(close).
Hope this helps!
At 06 JUN 1998 12:07PM DSig (SigSolutions) wrote:
Jeff,
Great Hack .. I did change one thing though .. and you might want to as a generic change .. (See code below)
Instead of a call to Start_MdiChild I capture the window name THEN use that name for the getprop. This is important if your windows may have multiple instances ..
Thanks again for the hack. I still hope that RTI has some ideas on why DialogBox CreateBox doesn't work correctly.
dsig
David Tod Sigafoos ~ SigSOlutions
dsig@teleport.com cis:70302,77 voice:503-639-8080
* Pre-processing
* start the window, occupy the engine and yield, wait for return
WinName =Start_MDIChild ( Child, MDIFrame, CreateParam )
Loop
Call Yield()WindowHandle=Get_Property( WinName, 'HANDLE' )Until WindowHandle=' Repeat
* Post-processing
At 08 JUN 1998 08:03AM Jeff Word wrote:
I'm glad that worked for you! Our code does include logic for the multiple instances. However, we have a routine to handle this that would not have made much sense to you so I actually cut that out of the example I posted for you.
At 08 JUN 1998 09:26AM Cameron Revelation wrote:
dsig,
The problem is that None of the events work in this dialogbox. If I call the window as a mdichild .. it works. I have tried using the mdi frame as the parent id. I have tried using @window.
I didn't follow the entire question. It sounds like you have the window name hard-coded somewhere, that is all I can figure. Does the DIALOG launch correctly? (I assume so based on your comment about the CREATE event.) If you have a button, put the following on the CLICK event as a test:
@@window-]text=CtrlEntID
That should change the window title to the ID of the button.
Cameron Purdy
info@revelation.com
At 08 JUN 1998 03:26PM Gene Gleyzer wrote:
David,
I don't understand exactly what is not working. We use Dialog_Box called out of MDI frame and MDI children extensively in all our tools (i.e. UI Workspace, CS Workspace). The loop that Jeff showed is essentially what the Dialog_Box does anyway…
gene
At 08 JUN 1998 08:27PM DSig (SigSolutions) wrote:
Gene,
Well I feel much better .. at least I am in good company in not understanding why it doesn't work.
A window that works perfectly when called singular or through mdichild does not work when called as a dialog_box from a mdichild.
I don't have time to go back and work it out right now as we are attempting to get the beta out so the hack forces the modal and all events work.
thanks
dsig
David Tod Sigafoos ~ SigSOlutions
dsig@teleport.com cis:70302,77 voice:503-639-8080
At 09 JUN 1998 12:51PM Cameron Revelation wrote:
dsig,
You very briefly described behavior which we have never seen. Gene said "I don't understand exactly what is not working." In other words, we cannot determine from your posts which part is not working. You replied "Well I feel much better .. at least I am in good company in not understanding why it doesn't work." I am fairly sure that the "why" is related to something that you are doing but you should not be doing (or vice versa). If you help us understand exactly "what", we can better help you understand the "why".
We know that dialog boxes work fine when created by MDI children, (although previous to version 3.5, the passed parent could not be an MDI child). It is possible that you are passing invalid parameters or parameters in the wrong order; it is possible that you have queued events (run when DIALOG_BOX calls YIELD) that mess up something; it is possible that you have an IDLEPROC that messes up something. In order to help you track this down, I have posted the source for DIALOG_BOX below; we did plan to put it in the next Works! release.
<code> compile function DIALOG_BOX (CHARSTR DialogID, CHARSTR PassedParentID, CHARSTR InitParam) /*------------------------------------------------------------------------- This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written permission from Revelation Technologies, Inc. VERSION : Open Engine PURPOSE : Create a modal dialog box AUTHOR : Gene Gleyzer CREATED : September 21, 92 PROCEDURES : THEORY OF OPERATION : This function is used to create a modal dialog box, process event loop until dialog box exists and return result to a calling procedure If IdleProcess is defined in a system then DIALOG_BOX yields all available event-handlers and after that calls it; otherwise DILAOG_BOX waits for any event and runs it. REVISION HISTORY (Most CURRENT first) : DATE IMPLEMENTOR FUNCTION -------- ----------- -------- MM-DD-YY initials Modification 10-15-97 CP Allow MDI Child parent (but actually use the MDI Frame) 01-21-94 GG Use GET_DIALOG_INFO instead of GET_DIALOG_PARAMS 02-04-94 GG Increased number of parameters for GET_EVENT ---------------------------------------------------------------------------*/ EQU IDLEPROC_EXTERNAL_PREFIX$ TO '!' DECLARE FUNCTION CREATE_DIALOG, GET_EVENT, PS_GET_PROPERTY DECLARE SUBROUTINE PS_SET_PROPERTY, RUN_EVENT, YIELD, GET_DIALOG_INFO *============================================================================ * check for no parent ParentID=PassedParentID IF LEN(ParentID) ELSE ParentID=@WINDOW END * check for MDI child trying to be parent Frame=PS_GET_PROPERTY(ParentID, "MDIFRAME") IF LEN(Frame) THEN ParentID=Frame END DialogWindow=CREATE_DIALOG (DialogID, ParentID, 0, InitParam) IF LEN( DialogWindow ) ELSE RETURN '' LOOP ValList=PS_GET_PROPERTY ('SYSTEM':@RM:DialogWindow, 'IDLEPROC':@RM:'HANDLE') IdleProcess =ValList 1, @RM IsDialogWindow=ValList COL2()+1, @RM WHILE IsDialogWindow IF LEN( IdleProcess ) AND IdleProcess 1, 1 IDLEPROC_EXTERNAL_PREFIX$ THEN YIELD () Proc =IdleProcess Param=IdleProcess startTime =IdleProcess startDate =IdleProcess notYet=0 IF LEN( startTime ) THEN IF LEN( startDate ) THEN startDate=ICONV( startDate, "D/" ) notYet=startDate ] DATE() END IF notYet ELSE startTime=ICONV( startTime, "MTS" ) notYet=startTime ] TIME() END END IF notYet ELSE PS_SET_PROPERTY ('SYSTEM', 'IDLEPROC', '') ;* being processed - remove CALL @Proc (Param) END END ELSE ObjectID=DialogWindow IF GET_EVENT (AppID, ObjectID, ObjectClass, Event, p1, p2, p3, p4, p5, p6, p7, p8, p9) THEN RUN_EVENT (AppID, ObjectID, ObjectClass, Event, p1, p2, p3, p4, p5, p6, p7, p8, p9) END END REPEAT PS_SET_PROPERTY (ParentID:@RM:'SYSTEM', 'ENABLED':@RM:'FOCUS', 1:@RM:ParentID) GET_DIALOG_INFO (DialogWindow, ParentID, '', '', OutParam) RETURN OutParam</code>
Cameron Purdy
info@revelation.com
At 09 JUN 1998 01:28PM Dsig (SigSolutions) wrote:
Cameron,
Thanks for the response ..
The hack works well for me so I will use it in order to get the beta out. I am also sure that IT IS something that I am doing wrong.
thanks again ..
dsig
David Tod Sigafoos ~ SigSOlutions
dsig@teleport.com cis:70302,77 voice:503-639-8080