FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Is there a way ?
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Is there a way ?
Posted: Tue Nov 25, 2008 05:23 PM

I need to change a tbutton in all aplication (many windows and dialogs) by a tbuttonbmp with one image.

I don't want to edit all resources and alter all code.

How can I do altering the code to change that specific button in a buttonbmp ?

Antonio

Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Is there a way ?
Posted: Tue Nov 25, 2008 08:18 PM

Antonio,

You could try this. If your resources aren't in RC format, then export them to an RC file (RC files are just text files). Then use your editor to do a search and replace.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Is there a way ?
Posted: Tue Nov 25, 2008 08:21 PM

Antonio,

You don't need to modify your resources.

Simply replace:

REDEFINE BUTTON ...

with

REDEFINE BUTTONBMP ...

Please review FWH\samples\TestBuBm.prg

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Is there a way ?
Posted: Wed Nov 26, 2008 08:38 AM

What I pretended is to alter it in the runtime.
With a couple of code lines I could test if that particular button exists on the window or dialog and then destroy it and define a new one buttonbmp with same position and size as the redefine button.

Is it possible ? Do you have any ideas ?

Antonio

Regards

Antonio H Ferreira
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Is there a way ?
Posted: Wed Nov 26, 2008 08:45 AM

Antonio,

what about defining all buttons as buttonbmp, but without a bitmap, so they look as normal buttons. Later if you need, you can add a bitmap at runtime or remove the bitmap to get the desired look.

Just an idea

kind regards

Stefan
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Is there a way ?
Posted: Wed Nov 26, 2008 10:02 AM

Class TButtonBmp does not need to use "TBUTTONBMP" in the resources.

Please review FWH\samples\TestBuBm.prg and TestBuBm.rc

so it is very easy to migrate from REDEFINE BUTTON ... to REDEFINE BUTTONBMP ... :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Is there a way ?
Posted: Wed Nov 26, 2008 10:46 AM

How is it possibel to left align bmp image inside the button ?

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Is there a way ?
Posted: Wed Nov 26, 2008 02:02 PM

If you use the TEXTRIGHT clause:

... BUTTONBMP ... TEXTRIGHT

then the bitmap will be painted at the left side of the button

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Is there a way ?
Posted: Wed Nov 26, 2008 03:13 PM

Atonio,

Thanks.

Probelm solved.

Antonio

Regards

Antonio H Ferreira

Continue the discussion