Activating an MDIChild Window (OpenInsight 32-bit Specific)
At 29 MAY 2002 06:02:48PM Jim Bayne wrote:
In the main window in my application, I have a dynamically built table containing a list of forms (windows) that need to be completed by the user. I am trying to build a program that will allow the user to double-click on the desired form in the table and have the associated form/window come up with the @ID of the current record displayed in the key value field. I've still got a lot of work to do with regards to saving the current record before going to the other window and saving it again before returning to the main window. That will come later. Right now I am just trying to figure out how to get the desired window/form to display.
Here's the code I've entered thus far in the script for the double-click event in the table entry containing the list of forms:
declare function Start_MDIChild
win=Get_Property(CtrlEntID,'TEXT')
Title=win
convert '-' to '_' in win
MDIChildID=Start_MDIChild(win,"AIDE_MAIN","@ID","",Title,1)
debug
RETURN 0
The Get_Property gets the selected form's name - e.g. G-28. The convert changes that to G_28, which is the name of the form/window I want to bring up. AIDE_MAIN is the application's MDIFrame. I've tried replacing the variables win and Title with actual values, but that doesn't work either.
The MDIChildID comes back blank and the window does not come up.
What am I doing wrong?
Peace,
Jim
At 29 MAY 2002 06:20PM Richard Hunt wrote:
Jim,
If I am following your notes correctly… I would use "DIALOG_BOX"
RESULT=DIALOG_BOX(WINDOW_NAME,PARENT_WINDOW,ARGS_TO_PASS)
You can then receive a result in RESULT.
At 29 MAY 2002 09:11PM [url=http://www.sprezzatura.com" onMouseOver=window.status= Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
Taking Occams's Razor to this problem can you ass a button to the MDI Frame that just starts the MDI Child and passes in nulls for everything other than the first two paramaters?
There is NOT a way of starting a window with a preloaded ID this needs to be done programmatically. If you pass the id in the create parameter like you seem to be trying to do you will have to add a create event that picks this up and populates the table.
When you get to this stage - we use a promoted lostfocus event that stores the current id in a labelled common and a promoted create event that takes this value and populates the Window. This way we can code once and use many times.
At 30 MAY 2002 08:09AM Oystein Reigem wrote:
Jim,
Your programming looks OK. But perhaps there's an old error status lurking, making the Start_MDIChild call fail. Insert a Get_Status(StatusCode) statement before your Start_MDIChild call and see what that reveals.
Here's what I learned to do - surround all Start_MDIChild, Dialog_Box and similar calls with heavy duty error deflecting/checking stuff:
…
Set_Status(0) /* clear old error status */
New_Child_Id=Start_MDIChild( … )
if (New_Child_Id=") or Get_Status(StatusCode) then
Set_Status(0) /* clear error status */
error handling…
…
Set_Status(0)
RetVal=Dialog_Box( … )
if Get_Status(StatusCode) then
Set_Status(0) /* clear error status */
…error handling…
Yes, I clear the error status both before and after, just to be certain.
(I assume "AIDE_MAIN" really is the id of your MDI frame. But in general it's better to use the @Window system variable than a literal. One reason is it will work even if you decide to change your frame's name. Another reason is it will work even if you have several instances of the frame running at the same time. You don't want the first instance of your frame to become the parent of a child started by the second instance.)
- Oystein -
At 30 MAY 2002 04:27PM Dave Harmacek wrote:
MDIChildID=Start_MDIChild(win,"AIDE_MAIN","@ID","",Title,1)
I would also point out that the CreateParam value passed to the MDI Child would be "@ID" and NOT the value of the variable @ID.