Hi,
We're trying to apply multiple dialogs in our program but we've found one problem.
We have a typical master-detail (multiple detail really) form with some pages. In the first one, we display a record, and in the others, we display one array in each page. So we have
page 1. Record1.
page 2. Array 2
page 3. Array 3.
The user can move through the rows of the master table and we have to refresh the details.
We use the instruction dialog with the sub-dialogs 'display array 2' and 'display array 3', but we can't use a sub-dialog 'display by name' for the record on page 1 because multiple dialogs instruction does not allow this kind of sub-dialog. So, when displaying data, the active page is page 2, and not page 1 as desired. In addition, if we select page 1 and then click anywhere in this page, the control returns to the page whose array is being displayed at the moment.
Regards,
Jeroni
There are different programming patterns for DIALOG.
I suggest that you look at the demos in FGLDIR/demo/MultipleDialogs
And please read carefully the manual page of the DIALOG instruction.
If you want that your master fields are active, you must use an INPUT BY NAME.
If the master fields must remain disabled (not used by DIALOG), just do a DISPLAY BY NAME in the BEFORE DIALOG block.
Seb
Hi Jeroni,
Steal some ideas from the following ...
Using an INPUT with UNBUFFERED and the master fields disabled enables you to use the UNBUFFERED functionality where if you change a value it is immediately refreshed on the screen.
The dummy field displays on Vista as a 1 pixel that flashes, you may have to alter the style on other platforms to get something that is as invisible as I've managed to get it. By having it the first folder tab now has something it can attach the focus to so hence the first folder tab is displayed when you enter the dialog.
Hope that helps,
Reuben
<StyleList>
<Style name=".dummy" >
<StyleAttribute name="fontSize" value="1pt"/>
<StyleAttribute name="border" value="no" />
</Style>
</StyleList>
LAYOUT
FOLDER f1
PAGE p1(TEXT="Master")
GRID
{
[m01 ]
[m02 ]
[m03 ]
[d]
}
END
END
PAGE p2(TEXT="Detail")
TABLE
{
[d01 ][d02 ][d03 ]
}
END
END
PAGE p3 (TEXT="SubDetail")
TABLE
{
[s01 ][s02 ][s03 ]
}
END
END
END
END
ATTRIBUTES
d = formonly.dummy, INVISIBLE, STYLE="dummy";
m01 = formonly.mfield1;
m02 = formonly.mfield2;
m03 = formonly.mfield3;
d01 = formonly.dfield1;
d02 = formonly.dfield2;
d03 = formonly.dfield3;
s01 = formonly.sfield1;
s02 = formonly.sfield2;
s03 = formonly.sfield3;
INSTRUCTIONS
SCREEN RECORD master(mfield1,mfield2,mfield3);
SCREEN RECORD detail(dfield1,dfield2,dfield3);
SCREEN RECORD subdetail(sfield1,sfield2,sfield3);
IMPORT util
DEFINE master RECORD
mfield1, mfield2, mfield3 STRING
END RECORD
DEFINE detail DYNAMIC ARRAY OF RECORD
dfield1, dfield2, dfield3 STRING
END RECORD
DEFINE subdetail DYNAMIC ARRAY OF RECORD
sfield1, sfield2, sfield3 STRING
END RECORD
MAIN
DEFINE dummy CHAR(1)
OPTIONS INPUT WRAP
CALL ui.Interface.LoadStyles("20081114a")
OPEN WINDOW w WITH FORM "20081114a"
CALL populate()
DIALOG ATTRIBUTES(UNBUFFERED)
INPUT dummy FROM dummy
END INPUT
INPUT master.* FROM master.* ATTRIBUTES(WITHOUT DEFAULTS=TRUE)
END INPUT
DISPLAY ARRAY detail TO detail.*
END DISPLAY
DISPLAY ARRAY subdetail TO subdetail.*
END DISPLAY
BEFORE DIALOG
CALL dialog.setFieldActive("master.mfield1",0)
CALL dialog.setFieldActive("master.mfield2",0)
CALL dialog.setFieldActive("master.mfield3",0)
ON ACTION next
CALL populate()
DISPLAY master.* TO master.*
ON ACTION previous
CALL populate()
DISPLAY master.* TO master.*
ON ACTION close
EXIT DIALOG
END DIALOG
END MAIN
FUNCTION populate()
DEFINE i,j INTEGER
LET master.mfield1 = util.Math.rand(100)
LET j = util.Math.rand(100)+1
CALL detail.clear()
FOR i = 1 TO j
LET detail[i].dfield1 = util.Math.rand(100)
END FOR
LET j = util.Math.rand(100)+1
CALL subdetail.clear()
FOR i = 1 TO j
LET subdetail[i].sfield1 = util.Math.rand(100)
END FOR
END FUNCTION
Hi Reuben,
Thanks for your idea, this solved our problem, the dummy field in XP also is a 1 pixel that flashes that is almost invisible.
Regards,
Jeroni