Change Caption on TBtnBmp object

Change Caption on TBtnBmp object

Postby reinaldocrespo » Tue Sep 17, 2013 1:03 am

Hi;

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

Code: Select all  Expand view

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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Change Caption on TBtnBmp object

Postby Marcelo Via Giglio » Tue Sep 17, 2013 1: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
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Change Caption on TBtnBmp object

Postby Antonio Linares » Tue Sep 17, 2013 9:41 am

Reinaldo,

You can use:

oBtn:SetText( "whatever" )

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

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

Re: Change Caption on TBtnBmp object

Postby reinaldocrespo » Tue Sep 17, 2013 7: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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Change Caption on TBtnBmp object

Postby Marcelo Via Giglio » Tue Sep 17, 2013 7: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
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 98 guests