BtnBmp - how to get id number of focused button?

BtnBmp - how to get id number of focused button?

Postby Eugeniusz Owsiak » Fri Jan 05, 2007 9:39 pm

Code: Select all  Expand view
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
Eugeniusz Owsiak
 
Posts: 60
Joined: Fri Oct 07, 2005 5:38 am
Location: Poland

Re: BtnBmp - how to get id number of focused button?

Postby Enrico Maria Giordano » Fri Jan 05, 2007 11:20 pm

Can you build a reduced and self-contained sample to experiment with?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sat Jan 06, 2007 8:05 am

Eugeniusz,

Change the variable focused_button_id into a function call:
Code: Select all  Expand view
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
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Eugeniusz Owsiak » Mon Jan 08, 2007 10:35 am

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
Eugeniusz Owsiak
 
Posts: 60
Joined: Fri Oct 07, 2005 5:38 am
Location: Poland

Postby Antonio Linares » Mon Jan 08, 2007 11:51 am

Eugeniusz,

Do you mean this ? In your loop:
Code: Select all  Expand view
       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
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Eugeniusz Owsiak » Mon Jan 08, 2007 12:05 pm

Yes - second KardSay()
Eugeniusz
User avatar
Eugeniusz Owsiak
 
Posts: 60
Joined: Fri Oct 07, 2005 5:38 am
Location: Poland

Postby Antonio Linares » Mon Jan 08, 2007 12:16 pm

Eugeniusz,

oBtn1:cToolTip := Str( oBtn1:nId )

Is it ok ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Eugeniusz Owsiak » Mon Jan 08, 2007 12:24 pm

Antonio,

Yes, it works - it's to simple .
Thank You.
Eugeniusz
User avatar
Eugeniusz Owsiak
 
Posts: 60
Joined: Fri Oct 07, 2005 5:38 am
Location: Poland


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 93 guests

cron