combo and edit boxes

combo and edit boxes

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?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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:


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.


Leave a Comment

Please sign in to add a comment. Not a member? Join today