You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
DIALOG DOEVENTS must be called continuously for the life of the modeless dialog. This is because the message queue must be continually serviced so that events can be dispatched to the dialog callback (such as button clicks, repainting, etc).
For example:
Code:
DIALOG NEW... TO hDlg
...
DIALOG SHOW MODELESS hDlg
DO
DIALOG DOEVENTS
DIALOG GET SIZE hDlg TO x&, x&
LOOP WHILE x&
Alternatively, use the extended DIALOG DOEVENTS statement which returns the number of dialogs, and loop until the number drops to zero.
The best strategy will depend on the design of your application.
I'm having a problem with this code... The dialog box only
displays the button when I use DIALOG SHOW MODAL...
$COMPILE EXE
$INCLUDE "WIN32API.INC"
%SHOW_MODELESS = 0
CALLBACK FUNCTION Exitbutton
DIALOG END CBHNDL
END FUNCTION
FUNCTION PBMAIN AS LONG
LOCAL DlgHandle AS LONG
DIALOG NEW %HWND_DESKTOP, "Dialog Test",,, 200, 200 TO DlgHandle
CONTROL ADD BUTTON, DlgHandle, 1, "E&xit", 0, 0, 200, 200 CALL ExitButton
$IF %SHOW_MODELESS
DIALOG SHOW MODELESS DlgHandle
DIALOG DOEVENTS
SLEEP 5000
$ELSE
DIALOG SHOW MODAL DlgHandle
$ENDIF
DIALOG END DlgHandle
END FUNCTION
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: