FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Ribbonbar : how to mark the last used Button ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Ribbonbar : how to mark the last used Button ?
Posted: Sun Sep 30, 2012 11:46 AM
Hello,

using a Ribbonbar, I want to keep a mark of the last used button.
How to keep a button as marked until another one is pressed ?
The borderchange-logic workes only inside a group.
Trying, to paint the border of a Button inside another group, doesn't work.
I need : scrolling a Border on Button-action inside the Ribbonbar.
The border of the last used button must stay visible.



The Border stays visible, until another Button is pressed ( works only inside a Group ! ).





@ 5, 10 ADD BUTTON oBtn3[1] GROUP oGroup3A BITMAP c_path + "\Images\Clock.Bmp" ;
SIZE 115, 55 PROMPT " &1." + CRLF + " Action" MOSTLEFT ROUND ;
LINECOLORS 0, 255 ;
ACTION ( MsgAlert( "Button 1", "Action ") )
oBtn3[1]:cToolTip = { "Define" + CRLF + "1. Button","1. Button", 1, CLR_BLACK, 14089979 }
oBtn3[1]:SetFont( oFont1 )
oBtn3[1]:SetColor( 0, )
oBtn3[1]:bGotFocus := {|| oBtn3[2]:lBorder := .F., ;
oBtn3[1]:lBorder := .T. }


@ 5, 140 ADD BUTTON oBtn3[2] GROUP oGroup3A BITMAP c_path + "\Images\Home.Bmp" ;
SIZE 115, 55 PROMPT " &2." + CRLF + " Action" MOSTLEFT ROUND ;
LINECOLORS 0, 255 ;
ACTION ( MsgAlert( "Button 2", "Action ") )
oBtn3[2]:cToolTip = { "Define" + CRLF + "2. Button","2. Button", 1, CLR_BLACK, 14089979 }
oBtn3[2]:SetFont( oFont1 )
oBtn3[2]:SetColor( 0, )
oBtn3[2]:bGotFocus := {|| oBtn3[1]:lBorder := .F., ;
oBtn3[2]:lBorder := .T. }


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Ribbonbar : how to mark the last used Button ?
Posted: Sun Sep 30, 2012 05:33 PM

I was able to use showdots() but there needs to be a little work done on the class to get the design feature to work.
When you initialize the button you can use oBtn:checkdots() to initialize.
Then you can do oBtn:ShowDots() and oBtn:HideDots()
The problem happens if you take the handles and move them.
It would be nice to implement the design feature in the Ribbon Button Class.

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Ribbonbar : how to mark the last used Button ?
Posted: Mon Oct 01, 2012 09:52 AM
I got it working with the help of a little function :



The Logic :

ADD GROUP oGroup3A RIBBON oRBar TO OPTION 3 PROMPT "Option 3 / Group 1" WIDTH 260 ;
GRADIANT aGGrad[1]
oGroup3A:SetFont( oFont1 )
oGroup3A:Refresh()
oGroup3A:nHeight := 80

The 1. and 2. Button of 7, defined inside OPTION 3

@ 5, 10 ADD BUTTON oBtn3[1] GROUP oGroup3A BITMAP c_path + "\Images\Clock.Bmp" ;
SIZE 115, 55 PROMPT " &1." + CRLF + " Action" MOSTLEFT ROUND ;
LINECOLORS 0, 255 ;
ACTION ( MsgAlert( "Button 1", "Action ") )
oBtn3[1]:cToolTip = { "Define" + CRLF + "1. Button","1. Button", 1, CLR_BLACK, 14089979 }
oBtn3[1]:SetFont( oFont1 )
oBtn3[1]:SetColor( 0, )
oBtn3[1]:bGotFocus := {|| CLEAR_BTN( oBtn3, 7, 1 ) }

@ 5, 140 ADD BUTTON oBtn3[2] GROUP oGroup3A BITMAP c_path + "\Images\Home.Bmp" ;
SIZE 115, 55 PROMPT " &2." + CRLF + " Action" MOSTLEFT ROUND ;
LINECOLORS 0, 255 ;
ACTION ( MsgAlert( "Button 2", "Action ") )
oBtn3[2]:cToolTip = { "Define" + CRLF + "2. Button","2. Button", 1, CLR_BLACK, 14089979 }
oBtn3[2]:SetFont( oFont1 )
oBtn3[2]:SetColor( 0, )
oBtn3[2]:bGotFocus := {|| CLEAR_BTN( oBtn3, 7, 2 ) }

1. We don't use LOSTFOCUS, because we want the border stay visible
2. CLEAR_BTN( oBtn3, 7, 1 ) // total number of buttons, used inside OPTION 3
3. CLEAR_BTN( oBtn3, 7, 1 ) // button-position inside OPTION 3

Code (fw): Select all Collapse
FUNCTION CLEAR_BTN( oBtn, nBtns, nBtn )

I := 1
FOR I := 1 TO nBtns
     oBtn[I]:lBorder := .F.
     oBtn[I]:ResetBorder()
NEXT
oBtn[nBtn]:lBorder := .T.

RETURN NIL


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion