BtnBmp - how to get id number of focused button?

Post Reply
User avatar
Eugeniusz Owsiak
Posts: 60
Joined: Fri Oct 07, 2005 5:38 am
Location: Poland

BtnBmp - how to get id number of focused button?

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Eugeniusz Owsiak
Posts: 60
Joined: Fri Oct 07, 2005 5:38 am
Location: Poland

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Eugeniusz Owsiak
Posts: 60
Joined: Fri Oct 07, 2005 5:38 am
Location: Poland

Post by Eugeniusz Owsiak »

Yes - second KardSay()
Eugeniusz
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Eugeniusz,

oBtn1:cToolTip := Str( oBtn1:nId )

Is it ok ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Eugeniusz Owsiak
Posts: 60
Joined: Fri Oct 07, 2005 5:38 am
Location: Poland

Post by Eugeniusz Owsiak »

Antonio,

Yes, it works - it's to simple .
Thank You.
Eugeniusz
Post Reply