Announcement

Collapse
No announcement yet.

Modeless Dialog Problem...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Modeless Dialog Problem...

    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



    ------------------

  • #2
    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 hope this helps!


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    Working...
    X