Page 1 of 1

BtnBmp from resource, how to resize at runtime ?

Posted: Tue May 05, 2009 6:07 pm
by ukoenig
Hello,

I have a small problem :
I need a User-Resize of BTNPMP from resources and a Preview with the new Size.
Is it possible ?
I tested oBtn:nHeight := NewHvalue and oBtn:nWidth := NewWvalue
but it doesn't work.
For the new ButtonTools, I want to make it possible, that the User can create his own Buttons
with a Preview from Source and Resources.

REDEFINE BTNBMP oBtn1 ID 100 OF oDlg3 ;
NOBORDER ;
FILENAME "./project/palm.bmp" ;
PROMPT "Button 1" ;
FONT oFont1 ;
RIGHT
oBtn1:lTransparent = .t.
oBtn1:cTooltip := "Button1"

That doesn't work !!!
---------------------------
obtn1:nHeight := nNewheight // User defined
oBtn1:nWidth := nNewWidth

Regards
Uwe :lol:

Re: BtnBmp from resource, how to resize at runtime ?

Posted: Tue May 05, 2009 7:36 pm
by Enrico Maria Giordano
Did you try oBtn:Move() method?

EMG

Re: BtnBmp from resource, how to resize at runtime ?

Posted: Wed May 06, 2009 8:27 pm
by ukoenig
Enrico,

thank You very much.
oBtn1:Move does the resizing I need ( same like with Dlg3 ).
The Move-method keeps the Top / Left position of the Resource with : oBtn1:nTop, oBtn1:nLeft
That is exactly, how I want to do it.

ACTIVATE DIALOG oDlg3 CENTERED NOWAIT ;
ON INIT ( oDlg3:Move( 80, 470, 440, 310, .f. ), oBtn1:Move( oBtn1:nTop, oBtn1:nLeft, 70, 40, .f. ) )

To show a Button with the same size from Source and Resource.
Is it possible, to calculate the different values maybe with a factor ( 2.16 ) ?

Resource :
STATIC nButtonW := 140
STATIC nButtonH := 86

Source :
@ 8, 5 BTNBMP oBtn1 OF oDlg1 ;
SIZE 65, 40

Best Regards
Uwe :lol:

Re: BtnBmp from resource, how to resize at runtime ?

Posted: Thu May 07, 2009 2:07 am
by Antonio Linares
Uwe,

You may also use:

oControl:SetSize( nWidth, nHeight [, lRepaint ] )