combo and edit boxes

combo and edit boxes

Portrait de rswy

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

2 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de Jugoslav Dujic

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

Jugoslav www.xeffort.com

Connectez-vous pour laisser un commentaire.