Is there a way ?

Is there a way ?

Postby AHF » Tue Nov 25, 2008 5: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby James Bott » Tue Nov 25, 2008 8: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Tue Nov 25, 2008 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » Wed Nov 26, 2008 8: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby StefanHaupt » Wed Nov 26, 2008 8: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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

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

Postby AHF » Wed Nov 26, 2008 10:46 am

How is it possibel to left align bmp image inside the button ?
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Antonio Linares » Wed Nov 26, 2008 2: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » Wed Nov 26, 2008 3:13 pm

Atonio,

Thanks.

Probelm solved.

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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