FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Cursor ON Ribbon
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Cursor ON Ribbon
Posted: Tue Dec 22, 2009 09:52 PM

Can I use a Hand cursor on RibbonBar ? to have a compatibilidad with oBar?

Best Regards, Saludos



Falconi Silvio
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Cursor ON Ribbon
Posted: Wed Mar 04, 2026 12:35 AM

Up

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Cursor ON Ribbon
Posted: Wed Mar 04, 2026 01:49 PM

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 difference

With 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 it

Since 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 (harbour): Select all Collapse
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
NEXT

This 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.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion