PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: jthompson on January 21, 2007, 05:42:01 PM

Title: Menus
Post by: jthompson on January 21, 2007, 05:42:01 PM
I've attached the shortcut F1 to my help menu (via the menu editor), but
when I hit F1 when the form is open nothings happens.  I tried changing it
to F2 in case F1 was set to help by Windows (conflict?) but this didn't work.

Are the shortcuts displayed only as a visual cue (the code needs to be
written by the programmer) or am I doing something wrong?

Thanks!

JT
Title: Menus
Post by: TechSupport on January 21, 2007, 06:38:44 PM
Where are you testing for the F1? You should use the WM_COMMAND message handler:

Function FORM1_WM_COMMAND ( _
                         hWndForm     As Dword, _  ' handle of Form
                         hWndControl  As Dword, _  ' handle of Control
                         wNotifyCode  As Long,  _  ' notification code
                         wID          As Long   _  ' item, control, or accelerator identifer
                         ) As Long

  Select Case wID
     Case IDC_FORM1_MNUSHOWHELP
        MsgBox "Help"
       
  End Select
 
End Function


Are you using a regular Form or an MDI Form?
Title: Menus
Post by: jthompson on January 21, 2007, 09:24:19 PM
Paul, you never cease to amaze with your Sunday evening appearances :)
Thanks!, but no rush needed.

I've got that (pretty much) already:


'------------------------------------------------------------------------------------------------------------------------
FUNCTION FRMMAIN_WM_COMMAND ( _
                           hWndForm     AS DWORD, _  ' handle of Form
                           hWndControl  AS DWORD, _  ' handle of Control
                           wNotifyCode  AS LONG,  _  ' notification code
                           wID          AS LONG   _  ' item, control, or accelerator identifer
                           ) AS LONG

   SELECT CASE wID
       CASE IDC_FRMMAIN_MNUABOUTBADGES : FRMABOUT_SHOW ( HWND_FRMMAIN, 1 )
       CASE IDC_FRMMAIN_MNUHELPTOPICS  : MSGBOX "Help/F1",,"Testing"
   END SELECT    

END FUNCTION


It is a normal (non-MDI) form, but I am using the parent with multiple
children approach that you showed me in an earlier post.  The code above
is placed in the main form (not the child) as it is the main form that has
the menu on it.

Thanks!

-John
Title: Menus
Post by: jthompson on February 02, 2007, 08:50:47 PM
Paul,

Do you have any ideas why it wouldn't be working in this scenario?

Thanks!

John
Title: Menus
Post by: TechSupport on February 03, 2007, 02:48:13 PM
Hi John,

Can you zip up the project and email it over to me? It would make it sooooo much easier to find the source of the problem.  :)
Title: Menus
Post by: jthompson on February 03, 2007, 03:07:38 PM
Hey Paul,

I previously added a SignIn form (user/pass) to the project, I made it the startup form and dependent upon a successful login the main window would be shown and frmSignIn would be hidden (can't be closed being the StartUp window, right?).

Well, with the startup window as frmSignIn, the F1 didn't work, but I removed it today and set the startup window back to frmMain the F1 button worked as expected.  I've tried it two more times to make sure and it appears to have been the culprit.

So, I guess I'm fine on this project, but would like to know if this is how it's supposed to work.  Can only one window have a F1 (or similar) key associated with it?  (I should note that frmSignIn had no keys associated with it.)  

Thanks!

P.S.  While I have your attention, in this thread I have one more quick question.  I have a label control with the following text (defined in the caption property): "Warning: This computer program is protected by copyright law and international treaties.  Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law."  When I run the program, "extent possible under the law." is not displayed (even though there is visible space available.  I can SETTEXT to make it, but by default it will be cut off.  Is there a way around this?
Title: Menus
Post by: TechSupport on February 03, 2007, 04:25:54 PM
I am assuming that the signon form is intercepting the F1 accelerator key through its message pump rather than your main form's pump (if it is modal).

The Label text is not fully displaying because FireFly uses the variable below to assign text to a control (you can see this in the code generation). So, if your text is over 255 characters (and your is) then you need to assign the caption via code - use the WM_CREATE message handler.


Local szControlText  As Asciiz * %MAX_PATH
Title: Menus
Post by: jthompson on February 03, 2007, 04:36:06 PM
OK I see.  I don't need it for this project, but is there a way to allow a main form (instead of a startup form) to receive the accelerator keys?

Thanks for your help!
Title: Menus
Post by: jthompson on March 02, 2007, 02:18:32 AM
Looks like it was already fixed over here http://www.planetsquires.com/forums/viewtopic.php?t=1609&highlight=menu

But, that FFEngine is from some time ago.  Can I use it with FireFly Current?  

Can you confirm when you have the time--no rush.

Thanks!!!

-John
Title: Menus
Post by: TechSupport on March 02, 2007, 08:48:05 AM
The link in that post is actually to the latest FFengine.exe file. I update that download link every so often with the latest file. I believe the link now points to the FFengine from early December 2006. It is compatible with the latest version of FireFly. Download it and give it a try.
Title: Menus
Post by: jthompson on March 02, 2007, 02:17:28 PM
Thanks Paul!

I just wanted to confirm in case it would've messed anything up (old version, etc.).

-John