Select one btnbmp into a scrollpanel

Select one btnbmp into a scrollpanel

Postby Silvio.Falconi » Mon Jun 12, 2023 5:27 pm

I have some buttons on a scrollpanel

Image

I created the buttons with the Btnbmp class
I want that when I press one it stays selected

I made
lActive:= .f.

For n=1 to Len(aElements)

cDesc := aElements[n][2]
cImage := aElements[n][5]
nProduct:= aElements[n][1]


@ nRow,ncol BTNBMP aBtnEle[n] ;
FILENAME cImage;
SIZE 220, 55 PIXEL;
FLAT RIGHT;
FONT oFontSmall ;
PROMPT cDesc ;
OF oElements action Msginfo()

aBtnEle[n]:ocursor:= oHand
aBtnEle[n]:nClrBorder := { |obtn| (IIF(obtn:lMOver,CLR_BLUE,CLR_HGRAY)) }
aBtnEle[n]:bClrGrad = { | lInvert | If( ! lInvert,;
{ { 1, CLR_WHITE, CLR_WHITE } },;
{ { 1, RGB( 229,241,251 ), RGB( 229,241,251 ) } } ) }

aBtnEle[n]:cargo:= lActive

aBtnEle[n]:bAction :={ || lActive := !lActive, aBtnEle[n]:lpressed:=If( lActive, .t.,.f. ) }


nRow+=55
nCol:=10

NEXT

How I can resolve ?

I tried also with
aBtnEle[n]:cargo:= lActive
aBtnEle[n]:bAction :={ |o| lActive := !lActive, ;
o:cargo:= lActive,;
o:refresh(),;
nElemento:= val(nProduct) }
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: Select one btnbmp into a scrollpanel

Postby Silvio.Falconi » Mon Jun 12, 2023 5:51 pm

Perhaps i resolved with

aBtnEle[n]:cargo:= lActive
aBtnEle[n]:bAction :={ |o| lActive := !lActive, ;
o:cargo:= lActive,;
o:refresh(),;
Set_items_Active(oElements,o:cargo,o),;
nElemento:= val(nProduct) }

Function Set_items_Active(oItem,lActive,oBTn)
local oCtrl
for each oCtrl in oItem:aControls
oCtrl:bClrGrad = { | lInvert | If( ! lInvert,;
{ { 1, CLR_WHITE, CLR_WHITE } },;
{ { 1, RGB( 229,241,251 ), RGB( 229,241,251 ) } } ) }
oCtrl:refresh()
next
SetGradientBtnbmp(,oBtn)
return nil

look this video

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 102 guests