Announcement

Collapse
No announcement yet.

Showing two modeless DDT dialogs

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

  • Lance Edmonds
    replied
    A couple of points for you to consider:

    1. Only one DIALOG DOEVENTS loop is necessary for any number of modeless dialogs that are created within the same thread. It would seem your application is a single-threaded app. Running a second doevents loop just wastes time unless you move to multi-threaded logic (and all the additional problems that can introduce unless the app is *carefully* designed.

    2. Make the parent of the modeless dialogs zero (or %HWND_DESKTOP) rather than use the handle of your main dialog.

    From your description, your app appears perform in a similar manner to the ADDRESS.BAS example that I wrote... you'll find it in your PBDLL\SAMPLES\DDT folder. It clearly shows how to implement modeless dialogs in conjunction to a modal dialog.


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

    Leave a comment:


  • Guest's Avatar
    Guest started a topic Showing two modeless DDT dialogs

    Showing two modeless DDT dialogs

    I have a main window that I am creating via DDT - modal, and I have two modeless windows that I want to be able to show at the same time while the main window is still showing, of course.
    This is some excerpts from my code:

    In my main callback prcedure for the main app window I have...
    select case cbmsg
    etc.,etc.,...
    case %WM_COMMAND
    select case cbmsg
    case %IDM_NEWPROJ
    Newform 'creates and show a form
    Tools 'creates and shows toolwindow
    case %IDM_NEW
    Newform
    case %IDM_CONTROLS
    Tools
    etc.,etc.,...
    end select
    end select

    This is the ddt statement for the main app window:
    dialog new 0, $AppTitle, 0, 0, 400, 33, _
    %WS_CAPTION or %WS_MINIMIZEBOX or _
    %WS_SYSMENU, 0 to hDlg

    This is the ddt statement for the floating toolbar:
    dialog new ghMainDlg, "", 0, 25, 40, 205, _
    %WS_POPUPWINDOW or %WS_CAPTION or %WS_SYSMENU _
    or %WS_EX_TOOLWINDOW to hDlg

    This is the ddt statement for the form window:
    dialog new ghMainDlg, "Form" + str$(hDlglbl), 75, 25, 300, 200, _
    %WS_CLIPSIBLINGS or %WS_MAXIMIZEBOX or _
    %WS_MINIMIZEBOX or %WS_SYSMENU or %WS_THICKFRAME to hDlg

    The main app window is not a container for the other two windows,they all show up straight on the desktop. The main window app is designated as a parent for the two modeless windows and I am using a doevents loop for both the modeless windows. After the main window is shown I can click the separate menu items for the two windows and show them both at the same time, but not from a single menu item or from intercepting the
    %WM_INITDIALOG message for the main app window. What happens processing the %IDM_NEWPROJ control message is that when the main app window and the form show up, I have to close down the form windows and then the toolwindow shows up. I have a feeling that it may be a flag issue somewhere but I am not sure. I have been searching in the win32api.hlp file but haven't found anything yet. Any thoughts?

    Thanks,
    Adam


    [This message has been edited by Adam Ritchie (edited February 14, 2000).]
Working...
X