Cursor ON Ribbon
Cursor ON Ribbon
Falconi Silvio
Re: Cursor ON Ribbon
Up
[email protected]
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- Antonio Linares
- Site Admin
- Posts: 44515
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Cursor ON Ribbon
Yes, you can use a Hand cursor on TRibbonBar, but it requires manual assignment since the DEFINE RIBBONBAR command does not have a built-in CURSOR clause like DEFINE BUTTONBAR does.
The differenceWith TBar (ButtonBar): The CURSOR clause is part of the command syntax, and the cursor is automatically propagated to each button via TBtnBmp::NewBar(): 0-cite-0 0-cite-1
With TRibbonBar: The command in ribbon.ch has no CURSOR clause: 0-cite-2
How to do itSince TRibbonBar and TRBtn both inherit from TControl -> TWindow, they all have the oCursor property. The TWindow::MouseMove method checks ::oCursor and calls SetCursor() automatically: 0-cite-3
And TRBtn::MouseMove delegates to Super:MouseMove which triggers the same cursor logic: 0-cite-4
So you can set it manually after creating the RibbonBar:
Code: Select all | Expand
LOCAL oCursor
DEFINE CURSOR oCursor HAND
DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "Tab 01", "Tab 02" ;
HEIGHT 130 TOPMARGIN 25
// Set cursor on the ribbon bar itself
oRBar:oCursor := oCursor
// Set cursor on all ribbon buttons inside each group/tab
LOCAL n, m, p, oGroup, oButton
FOR n = 1 TO Len( oRBar:aDialogs )
IF oRBar:aDialogs[ n ]:aControls != NIL
FOR m = 1 TO Len( oRBar:aDialogs[ n ]:aControls )
oGroup := oRBar:aDialogs[ n ]:aControls[ m ]
oGroup:oCursor := oCursor
IF oGroup:aControls != NIL
FOR p = 1 TO Len( oGroup:aControls )
oGroup:aControls[ p ]:oCursor := oCursor
NEXT
ENDIF
NEXT
ENDIF
NEXTThis is the same pattern used in ButtonBar samples where cursors are applied via AEval: 0-cite-5 0-cite-6
The approach is functionally equivalent - it just requires iterating through the RibbonBar's dialog panels, groups, and buttons to set the cursor on each control individually, since TRibbonBar doesn't automatically propagate oCursor to child controls the way TBar does.