Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

combo and edit boxes

rswy
Beginner
367 Views
Hi,
I had posted a message earlier regarding using a combo or an edit box depending on a set of radio buttons selected.Using 2 different boxes solved the problem but I am having problems during the initialization.I am unable to change the visibility options(having the edit box visible sometimes and the combo box visible at other times) when the dialog box first pops up.
The showwindow function works only from the call back routine so i tried explicitly calling the callback routine but it still doesn't work.
Any pointers on this?
--rswy
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
367 Views
Yes, you can't use APIs in initialization phase (between DlgInit and DlgModal) due to architecture of DFLOGM. Namely, all APIs expect an existing window , but the dialog (and its controls) is not created prior to DlgModal, and then it's too late since it's modal.

To overcome that, the common trick is to use a special callback, called at dialog's initialization:
EXTERNAL OnDlgInit
...
DlgInit(...
iSt=DlgSetSub(Dlg,IDD_DIALOG1,OnDlgInit)
...
DlgModal(...

Note use of dialog ID. OnDlgInit has normal arguments (Dlg, ID, iEvent) and it's called immediately after the dialog is created but before it's displayed (roughly, imagine that it's called by DlgModal immediately). You can put all additional API stuff initialization there (ShowWindow, change dialog title via SetWindowText, use SendMessage for features not supported via DFLOGM etc.).

XFLOGM has DLG_VISIBLE extension just for that purpose.

Jugoslav
0 Kudos
Reply