Announcement

Collapse
No announcement yet.

Tab key problem

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

  • Tab key problem

    I have a program with one main opening dialog which contains a menu and a blank screen. It also has 2 DLL's which run utility applications. that are accessible through the opening dialog's menu. Each DLL runs as designed if run by itself. But if I run both DLLs at the same time and move between them with the ALT + Tab key I have a problem. The second DLL runs as designed, but the first one does not. It displays as designed, has the correct textbox in focus, and I can enter information from the keyboared, but the Tab Key only beeps when pressed. I can change text boxes with the mouse but not the tab key. If I close the second DLL then the first one works fine. If I reload the second DLL again the problem again occurs for the first DLL. My purpose is to be able to have several utility applications running at the same time and ALT + Tab between them. I've read some about MDI dialogs but am not advanced enough to know what I'm doing with MDI. Any suggestions would be appreciated.

    David Hoff

  • #2
    Alt+tab is a system key: you can't control what that does without hooking it.

    It also has 2 DLL's which run utility applications. that are accessible through the opening dialog's menu. Each DLL runs as designed if run by itself
    As in, "the function in that DLL which is called does a DIALOG NEW... etc" ?????

    As far as the tab key not moving the cursor when you are on a screen, it sounds like you may not have the WS_TABSTOP style set (code not shown); OR, you are trying to get a DDT message loop in one module to do things for other modules. There are some 'module' restrictions on using DDT commands across code modules; this may or may not be one of those.

    Or.... are you using DIALOG SHOW MODAL? That would explain a lot, since a MODAL dialog will not allow a process to continue until it ends. You can try using DIALOG SHOW MODELESS and add a DDT message loop somewhere; or you can run each modal dialog in its own thread of execution with its own message loop. (MODAL would be OK this way).

    Regardless, this is NOT "MDI." The PBNOTE sample supplied with the compiler is a nice demo of a true MDI application. With MDI you can cycle thru the various screens with ALt+F6 (I think it's Alt+F6).. but that's not quite as easy to write as a bunch of dialogs using DDT syntax.

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      I am useing Show Modal. Each DLL was originally written as a stand alone executable which I used to work out all the bugs then eliminated the PBMAIN FFUNCTION to be able to convert it into a DLL. Both Utilities worked flawlessly and if both were running at the same time using the ALT _ Tab keys moved between windows as desired without any affect to the tab key.

      I was aware of the limitation when using SHOW MODAL but thought useing two seperate DLL's which required no external information or other call back than it's own would do what I wanted to do. I found a post by Lance in POFFS that I thought said it would work but I cannot find it again to verify what I thought I read.

      Your reply says...
      "or you can run each modal dialog in its own
      thread of execution with its own message loop. (MODAL would be OK this way)."

      Where can I read how to do that.

      David Hoff Jr

      Comment


      • #4
        The SHOW MODAL is, I am now conviced, your problem. That call blocks the calling thread until the dialog is completed.

        So first try this:
        Code:
         
        ' REM MAINEXE.BAS
        #COMPILE EXE 
        FUNCTION PBMAIN() AS LONG
        
           DIALOG NEW   "main screen"  
              Control add  (add at least one control or you will have problems 
                                with accelerators) It can be hidden 
        
           DIALOG SHOW MODELESS .....
          ' DDT MEssage loop
           DO
             DIALOG DOVENTS 
           LOOP UNTIL something 
        
        CALLBACK FUNCTION   MainScreenCallback()  
        
              IF condition 
               CALL function in DLL to create correct screen 
             
        
        ' FILE: SCREEN_ONE.BAS
        #COMPILE DLL
        
         FUNCTION CallThisOne (params) 
            DIALOG NEW 
            CONTROL ADD 
            DIALOG SHOW MODELESS 
        
           NO MESSAGE LOOP HERE I THINK YOU CAN PIGGYBACK ON THE ONE IN MAIN..
           but maybe not, since I don't know that the DDT runtime will call IsDialogMessage() 
           for windows not created in the same code module. 
           *I just do not know if this will work
        
        ...
        END FUNCTION
        If this does not work, then you can look at multiple threads.... which introduce some additional "gotchas", which is why I am suggesting you try the MODELESS approach FIRST.

        Or, Instead of creating and destroying dialogs, just hide 'em and show 'em as needed. Add some kind of "window" menu to your main screen to let the user switch dialogs.

        As long as you use DIALOG SHOW MODAL, you are not going to be able to maintain multiple active dialogs unless you go to multiple threads of execution... PERIOD. (This is NOT a negotiation).

        MCM
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Thanks for your help. I will try your suggestion and see what works.

          David Hoff Jr

          Comment

          Working...
          X
          😀
          🥰
          🤢
          😎
          😡
          👍
          👎