Page 1 of 1
BtnBmp - how to get id number of focused button?
Posted: Fri Jan 05, 2007 9:39 pm
by Eugeniusz Owsiak
Code: Select all
FOR nM := 1 TO 12
cM := str0(nM,2)
dDay := ctod('01.'+cM+"."+cYear)
FOR nD := 1 TO 31
aKolor := aKol(nD,cKld&cM)
IF month(dDay)==nM
oBtn1:=tBtnBmp():Redefine((nM*1000)+nD,,,,,,{|| msgInfo(KardSay(focused_button_id))},oDlg,,,,KardSay(focused_button_id),str(nD,2)+":"+aTab[dow(dDay)],oFont)
oBtn1:SetColor(aKolor[1],aKolor[2])
ENDIF
dDay++
NEXT
NEXT
oDlg is dialog with button for each day
aKol return different array of color fo every day of a weak
I wish display info by using tooltip and msgInfo. How can i get id number of focused btnBmp?
regards Eugeniusz
Re: BtnBmp - how to get id number of focused button?
Posted: Fri Jan 05, 2007 11:20 pm
by Enrico Maria Giordano
Can you build a reduced and self-contained sample to experiment with?
EMG
Posted: Sat Jan 06, 2007 8:05 am
by Antonio Linares
Eugeniusz,
Change the variable focused_button_id into a function call:
Code: Select all
function focused_button_id( oDlg )
local nAt := AScan( oDlg:aControls, { | o | o:lFocused } )
return If( nAt != 0, oDlg:aControls[ nAt ]:nId, 0 )
Posted: Mon Jan 08, 2007 10:35 am
by Eugeniusz Owsiak
Antonio
as usualy Your help is great and every button reports now its id number.
But what i have to do to display this number as cTooltip (it display id=0)?
regards Eugeniusz.
Posted: Mon Jan 08, 2007 11:51 am
by Antonio Linares
Eugeniusz,
Do you mean this ? In your loop:
Code: Select all
oBtn1:=tBtnBmp():Redefine((nM*1000)+nD,,,,,,{|| msgInfo(KardSay(focused_button_id))},oDlg,,,,KardSay(focused_button_id),str(nD,2)+":"+aTab[dow(dDay)],oFont)
oBtn1:SetColor(aKolor[1],aKolor[2])
oBtn1:cToolTip := Str( oBtn1:nId )
Posted: Mon Jan 08, 2007 12:05 pm
by Eugeniusz Owsiak
Yes - second KardSay()
Eugeniusz
Posted: Mon Jan 08, 2007 12:16 pm
by Antonio Linares
Eugeniusz,
oBtn1:cToolTip := Str( oBtn1:nId )
Is it ok ?
Posted: Mon Jan 08, 2007 12:24 pm
by Eugeniusz Owsiak
Antonio,
Yes, it works - it's to simple .
Thank You.
Eugeniusz