RibbonBar ALT key

RibbonBar ALT key

Postby Otto » Tue Jan 12, 2010 9:18 am

Hello Antonio,
I changed the method in TRibbonBar and added a class TXPanel.
But I must do something wrong. If I press the ALT key I don’t see the panel. Would you be so kind to post a working sample.
Thanks in advance
Otto



Otto,

We are working on a Method KeybMode() that first of all may show those little buttons with the letters.

This is still a work in progress but here you can review it:

Code: Select all Expand view

METHOD KeybMode() CLASS TRibbonBar

local oPanel, oBtn

oPanel = TXPanel():New( 0, 0, ::nHeight(), ::nWidth(), ::oWnd )

SetWindowLong( oPanel:hWnd, GWL_EXSTYLE, nOr( GetWindowLong( ::hWnd, GWL_EXSTYLE ), WS_EX_TRANSPARENT ) )

BringWindowToTop( oPanel:hWnd )

@ 20, 20 BTNBMP oBtn SIZE 20, 20 OF oPanel 2007

return nil

CLASS TXPanel FROM TPanel

METHOD Paint() VIRTUAL

ENDCLASS

The idea is to place a transparent Panel on top of the Ribbon, so we can place some BtnBmps (or standard Buttons with accelerators) and the user may select the accelerator for each little button.
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6064
Joined: Fri Oct 07, 2005 7:07 pm

Re: RibbonBar ALT key

Postby Antonio Linares » Wed Jan 13, 2010 12:38 am

Otto,

On the current development stage you can not invoke Method KeybMode() pressing Alt. You can call it from a button action:
Code: Select all  Expand view

   oTBtn0 = TRBtn():New( 4, 0, 70, 20, "..\bitmaps\rbnmenu.bmp", { || oRBar:KeybMode() }, oRBar ,;
                         ,,,,,, .T., .T.,,,,,, "POPUP", oMenu,,,,,,,,,,,,, aClrMenu1, nRGB( 125, 172, 215 ),;
                         nRGB( 65, 106, 189 ) )
 

Anyhow, we haven't found yet a way to paint the little boxes on top of everything
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41394
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: RibbonBar ALT key

Postby Otto » Wed Jan 13, 2010 7:07 am

Hello Antonio,

thank you for your answer.
At the moment I use menu + ribbonbar to have keyboard navigation.
Would you be so kind to explain me how the ALT key event is passed to the menu.
ALT key is working here with the menu. Maybe it can be done the same way or
one could hide the menu and fire from there an event.
Best regards,
Otto
Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6064
Joined: Fri Oct 07, 2005 7:07 pm

Re: RibbonBar ALT key

Postby Antonio Linares » Wed Jan 13, 2010 7:43 am

Otto,

You just gave me the idea we were looking for :-)

The Class Menu uses an accelerators table that is automatically invoked when Alt is pressed. All we need is to define an accelerators table for the Ribbon :-)

We should add this DATA to the ribbon (same as we have it in Class TMenu):
Code: Select all  Expand view

   DATA   oAccTable       // Accelerators table object
   ...

   METHOD New() CLASS TRibbonBar
      ...
      ::oAccTable = TAccTable():New()
      ...
 

And then add as many accelerators as we need (same as we do from Class TMenuItem):
Code: Select all  Expand view

   oRibbon:oAccTable:Add( nVirtKey, nVKState, nId )
 

Please review FWH\source\classes\tacctbl.prg to understand how to use it. Each accelerator issues a WM_COMMAND msg that should be processed from the Ribbon.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41394
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: RibbonBar ALT key

Postby Otto » Wed Jan 13, 2010 8:50 am

Hello Antonio,
Would you please provide my some more help.
Do I have to add
::oAccTable = TAccTable():New()
to the tRibbon and then
use
oRibbon:oAccTable:Add( nVirtKey, nVKState, nId )
in my source.
What should I pass as: nVirtKey, nVKState, nId
and how do I get the ALT key event to execute KeybMode.

Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6064
Joined: Fri Oct 07, 2005 7:07 pm

Re: RibbonBar ALT key

Postby Antonio Linares » Wed Jan 13, 2010 10:02 am

Otto,

If you review FWH\include\menus.ch there you will see how nState and nVirtKey are managed:

Code: Select all  Expand view

#xcommand MENUITEM [ <oMenuItem> PROMPT ] [<cPrompt>] ;
...
             [ ACCELERATOR <nState>, <nVirtKey> ] ;
...
 

You can review FWH\samples\TestMenu.prg for an example of use:
Code: Select all  Expand view

         MENUITEM oFirst PROMPT "&First Alt-F2" MESSAGE "First option" ;
            ACTION If( oFirst:lActive, oFirst:Disable(), oFirst:Enable() ) ;
            ACCELERATOR ACC_ALT, VK_F2
 

And in FWH\source\classes\pdmenu.prg you find this code:
Code: Select all  Expand view

function MenuAddItem( ... )
   ...
  oAccTable:Add( oItem:nVirtKey, oItem:nVKState, oItem:nId )
 

nId is the WM_COMMAND value that will be sent to the main window.

The control that has focus in your app will receive the Alt notification, not the Ribbon. So your focused control will have to invoke oRibbon:KeybMode()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41394
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: RibbonBar ALT key

Postby Otto » Wed Jan 13, 2010 10:31 am

Hello Antonio,
thank you for your help.
I feel I have to wait for Fivewin 10.2 to find a working sample.
Best regards,
Otto
Last edited by Otto on Wed Jan 13, 2010 1:00 pm, edited 1 time in total.
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6064
Joined: Fri Oct 07, 2005 7:07 pm

Re: RibbonBar ALT key

Postby Antonio Linares » Wed Jan 13, 2010 12:59 pm

Otto,

The accelerators issue should not be a problem.

To paint on top of all the RibbonBar controls is getting more complicated, but we expect to find a solution for it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41394
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: RibbonBar ALT key

Postby Antonio Linares » Thu Jan 14, 2010 11:12 am

Otto,

Ok, we just found a way :-)

oRibbon:SaveToBmp( cFileName ) creates a BMP file on disk that could be used to place a bitmap on top of the ribbon, and there we can paint the little boxes :-)

We are going to implement the code...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41394
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: RibbonBar ALT key

Postby Antonio Linares » Thu Jan 14, 2010 11:35 am

This is a very early test for a proof of concept:
Code: Select all  Expand view

METHOD KeybMode() CLASS TRibbonBar

   local hBitmap := WndBitmap( ::hWnd ), oBmp, oBtn

   @ 0, 0 BITMAP oBmp OF Self:oWnd SIZE ::nWidth(), ::nHeight() NOBORDER PIXEL
   oBmp:hBitmap = hBitmap
   oBmp:Move( -1, -1 )

   ::Super:Hide()
   
   @ 20, 20 BTNBMP oBtn SIZE 20, 20 OF oBmp 2007 ACTION MsgInfo( "click" )
   
return nil
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41394
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: RibbonBar ALT key

Postby Antonio Linares » Thu Jan 14, 2010 2:33 pm

Some more testing:
Image
Code: Select all  Expand view

METHOD KeybMode() CLASS TRibbonBar

   local hBitmap := WndBitmap( ::hWnd ), oBmp, oBtn

   @ 0, 0 BITMAP oBmp OF Self:oWnd SIZE ::nWidth(), ::nHeight() NOBORDER PIXEL
   oBmp:hBitmap = hBitmap
   oBmp:Move( -1, -1 )

   ::Super:Hide()
   
   @ 22,  20 BTNBMP oBtn PROMPT "&1" SIZE 20, 20 OF oBmp 2007 ACTION MsgInfo( "click" )

   @ 22, 105 BTNBMP oBtn PROMPT "&2" SIZE 20, 20 OF oBmp 2007 ACTION MsgInfo( "click" )

   @ 22, 195 BTNBMP oBtn PROMPT "&3" SIZE 20, 20 OF oBmp 2007 ACTION MsgInfo( "click" )

   @ 22, 265 BTNBMP oBtn PROMPT "&4" SIZE 20, 20 OF oBmp 2007 ACTION MsgInfo( "click" )

   @ 22, 340 BTNBMP oBtn PROMPT "&5" SIZE 20, 20 OF oBmp 2007 ACTION MsgInfo( "click" )
   
return nil
 

We just need to take those button coordinates from the tabs positions and implement the accelerators
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41394
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 28 guests