Announcement

Collapse
No announcement yet.

Menus & Error Message

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

  • Walt Decker
    replied
    Thanks, Michael.

    Looking over the equates I was about to answer "No, there are no duplicate control IDs"; however, I saw one that had a value of 1000. I then remembered that this particular ID is used as a base to create a variable number of other controls (1 to 60) based on user input. By changing that value to 10,000 everything works.

    Leave a comment:


  • Michael Mattias
    replied
    First, the "trace" statement doesn't work unless you put in a bunch of label statements
    ???
    Code:
    FUNCTION PbMain
     ....
        TRACE ON
    
    ..
    
    CALLBACK FUNCTION whatever
    
        SELECT CASE AS LONG CBMSG
             CASE %WM_COMMAND
                  TRACE PRINT _ 
                         USING$ ("WM_COMMAND for hWnd #  CtrlID #  CBCTLMSG #",_
                               CBHNDL, CBCTL, CBCTLMSG)
    ...
    seems that values less than 1009 does not seem to work in the first code posted, and values less than 1008 does not work in the second code posted. Doesn't make sense.
    Duplicate IDs somewhere? (insufficient code shown)
    Last edited by Michael Mattias; 13 Dec 2007, 08:24 AM.

    Leave a comment:


  • Walt Decker
    replied
    Further investigation seems to show that, for some reason, the value of the equates plays a role. It seems that values less than 1009 does not seem to work in the first code posted, and values less than 1008 does not work in the second code posted. Doesn't make sense.

    Leave a comment:


  • Walt Decker
    replied
    Menus & Error Message

    First, the "trace" statement doesn't work unless you put in a bunch of label statements. Then, in this case I doubt that trace would work since I have no idea what windows is doing.

    However, I did find the problem but it doesn't make sense.

    Here's the code setting up the menu for the MODAL dialog and it doesn't work:

    Code:
    SUB Sprite_Menu(Hdlg)
    
    LOCAL hPopUp1 AS DWORD
    LOCAL hPopUp2 AS DWORD
    
    MENU NEW BAR TO Sprite_Menu_Hndl
    MENU NEW POPUP TO hPopUp1
    MENU ADD POPUP, Sprite_Menu_Hndl, "&Files", hPopUp1, %MF_ENABLED
      MENU ADD STRING, hPopUp1, "&New Image", %IMAGE_NEW_MNU, %MF_ENABLED ', CALL SizeCB
      MENU ADD STRING, hPopUp1, "-", 0, 0
    
     'Calls that don't work:
    
      MENU ADD STRING, hPopUp1, "Load Palette", %LOAD_PALETTE_FILES, %MF_ENABLED, CALL Pal_File_CB   
      MENU ADD STRING, hPopUp1, "Save Palette", %SAVE_PALETTE_FILES, %MF_ENABLED, CALL Pal_File_CB
    
      MENU ADD STRING, hPopUp1, "-", 0, 0
      MENU ADD STRING, hPopUp1, "Load &PSave", %LOAD_BSV_MNU, %MF_ENABLED, CALL Img_Files_CB
      MENU ADD STRING, hPopUp1, "&Import BMP file", %IMPORT_BMP_MNU, %MF_ENABLED, CALL Img_Files_CB
      MENU ADD STRING, hPopUp1, "-", 0, 0
      MENU ADD STRING, hPopUp1, "&Save as PSave", %SAVE_BSV_MNU, _
          %MF_ENABLED
      MENU ADD STRING, hPopUp1, "&Save as BMP", %SAVE_BMP_MNU, _
          %MF_ENABLED                                                     ', CALL FilesCB
    'etc
    END SUB
    Here's the code in the MODELESS dialog setup and it works:

    Code:
    SUB Mixer_Menu(hDlg)
      LOCAL hPopUp1 AS DWORD
    
      MENU NEW BAR TO Mxr_Menu_Hndl
      MENU NEW POPUP TO hPopUp1
      MENU ADD POPUP, Mxr_Menu_Hndl, "Files", hPopUp1, %MF_ENABLED
        MENU ADD STRING, hPopUp1, "&Load Palette", %LOAD_PALETTE_FILES, %MF_ENABLED, CALL Pal_File_CB
        MENU ADD STRING, hPopUp1, "&Save Palette", %SAVE_PALETTE_FILES, %MF_ENABLED, CALL Pal_File_CB
      MENU ADD STRING, Mxr_Menu_Hndl, "&Hide Palette", %SHOW_PALETTE, %MF_ENABLED, CALL Show_Hide_CB
      MENU ADD STRING, Mxr_Menu_Hndl, "Sh&ade", %SHADE, %MF_ENABLED, CALL Shade_Incr_CB
    'etc
    END SUB
    If I change the equates in the code that doesn't work to %LOAD_PAL_MNU and %SAVE_PAL_MNU the callback is honored. It's almost as if the compiler is binding the "MNU" at the end of the equates to the modal dialog.

    For the second question: there is no resource file. However, it may have been because I was tying up computer memory with an inifiate dialog create loop and was not aware of it.

    The third question: windowsime.exe has nothing to do with PB. That should have been obvious when I stated that I received the error message when I accessed the net.
    Last edited by Walt Decker; 12 Dec 2007, 05:07 PM.

    Leave a comment:


  • Michael Mattias
    replied
    For tracing, you might try the deviously-named "TRACE" statement.

    Leave a comment:


  • Adam J. Drake
    replied
    The two that contain menus have some similar items and use the same constants for their IDs and the same call back function.
    I never use the same callback for the same dialog. Seems like that would create more headaches than it might help.

    Is there some way to trace what is happening?
    I would say you would have a substantially easier time figuring out whatever issues are occurring if there was a unique callback function for each dialog.

    Without seeing a failing posted example of code, one can only speculate what might be causing any problems and the compiler error...

    Leave a comment:


  • Cliff Nichols
    replied
    I do not want to bust on you so the below is not to sound mean or anything because you may be new to PB and not used to the "Web-icate" of what you are asking vs what you think you are asking?

    So I will break it down to my best guesses
    1.

    I'm working on a program that has 4 dialog boxes, three are modeless and two contain menus. The two that contain menus have some similar items and use the same constants for their IDs and the same call back function. However, the first dialog created does not honor the "CALL Some_Callback" statement, but the second does. Is there some way to trace what is happening?
    I have to say "Code not shown" but....without knowing...no clue. But best guess
    4 dialog boxes, three are modeless
    so one modal?
    two contain menus.
    first dialog created does not honor the "CALL Some_Callback" statement, but the second does. Is there some way to trace
    #TRACE or Debug Compiler? '<--- 2 keywords to search on if you do not know these already :shhh:


    2.

    Error when compiling: "Cannot access resource compiler results." What does that mean?
    Most likely the code you are using uses a resource file you do not have or in the wrong place.....Do you have a line that starts with #RESOURCE ????

    3.

    Does anyone know what windowsime.exe does? Every time I access the net that message comes up and sometimes is persistant.
    To my knowledge absolutely NOTHING to do with PB but on the off-chance you think it does because it happens to happen while working on your code then a quick Google search will reveal Imput Method Editor (IME) which I guarantee 99% that has nothing to do with PB but for some reason you think is related?

    If you can show some code? or elaborate more I think we can help. But at the moment...too many unrelated questions (maybe related, but no way to tell at the moment)

    Leave a comment:


  • Walt Decker
    started a topic Menus & Error Message

    Menus & Error Message

    1.

    I'm working on a program that has 4 dialog boxes, three are modeless and two contain menus. The two that contain menus have some similar items and use the same constants for their IDs and the same call back function. However, the first dialog created does not honor the "CALL Some_Callback" statement, but the second does. Is there some way to trace what is happening?

    2.

    Error when compiling: "Cannot access resource compiler results." What does that mean?

    3.

    Does anyone know what windowsime.exe does? Every time I access the net that message comes up and sometimes is persistant.
Working...
X