FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Change Caption on TBtnBmp object
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Change Caption on TBtnBmp object
Posted: Tue Sep 17, 2013 01:03 AM
Hi;

I'm trying to change the caption on a TbtnBmp, but so far -no luck.

Code (fw): Select all Collapse
LOCAL oBtn
LOCAL oSelf := SELF 
...
::cText := "Some Initial Text"
REDEFINE BUTTONBMP ::oBtm /*BITMAP "dotgreen"*/ ID 501 OF ::oDlg TEXTLEFT PROMPT ::cText UPDATE
ACTIVATE DIALOG ::oDlg ON INIT oSelf:oBtn:Disable()

...

::cText := "Some Other Text"
oBtn:cCaption := ::cText 
oBtn:Refresh()


I must add that the TbtnBmp object is disabled, still I wish to change the caption at some point. I even tried oBtn:Paint(), but nothing happens.

Can someone help?

Reinaldo.
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Change Caption on TBtnBmp object
Posted: Tue Sep 17, 2013 01:51 AM

Hola Reinaldo,

I think your problem is with ButtonBMP not with BtnBmp, because ::cCaption work with BtnBmp, with ButtonBMP try sending message like

SendMessage( buttonBmp:hwnd, WM_SETTEXT, 0, "New Caption" )

using

define WM_SETTEXT 0x000C

saludos

Marcelo

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Change Caption on TBtnBmp object
Posted: Tue Sep 17, 2013 09:41 AM

Reinaldo,

You can use:

oBtn:SetText( "whatever" )

this works with most windows, dialogs and controls :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Change Caption on TBtnBmp object
Posted: Tue Sep 17, 2013 07:25 PM

Marcelo - It is always good to see you around. Hope you are doing well. I'm sure your solution would have worked but Antonio's just seems simpler. BTW - :SetText( ::cText ) worked as expected. Thank you very much Antonio.

Reinaldo.

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Change Caption on TBtnBmp object
Posted: Tue Sep 17, 2013 07:32 PM

Hello Reinaldo,

yes of course, Antonio´s solution is the way, my proposal work too but we can take it for sample only :-)

un abrazo

Marcelo

Continue the discussion