Page 1 of 1

change a get with on execution

PostPosted: Fri Apr 26, 2013 7:50 pm
by Silvio.Falconi
I wish size a get when the user press a button or a menu

I tried with move(), resize() methods with no success !!!

I have this get

@ 0.5, 0.5 GET oGet VAR cGet OF oDlg SIZE 120, 12 RIGHT FONT oFont2

and I wish change the with from 120 to 232

Re: change a get with on execution

PostPosted: Fri Apr 26, 2013 8:31 pm
by ukoenig
Silvio,

tested with a big font :

Image

lRepaint := .F.

REDEFINE GET oGet1 VAR nWColorF ID 120 OF oDlg4 PICTURE "999999999" FONT oBigFont

REDEFINE BTNBMP oBtn1 OF oDlg4 ;
ID 130 PIXEL 2007 ;
NOBORDER ;
PROMPT "&1. Color" ;
FILENAME c_path1 + "Select.Bmp" ;
ACTION ( lRepaint := .T., nWColorF := ChooseColor(), ;
oBmp1:Refresh(), oBmp3:Refresh(), oGet1:Refresh() ) ;
FONT oFont1 ;
LEFT
oBtn1:lTransparent := .t.
oBtn1:cToolTip = { "1. Dlg-Gradient" + CRLF + "Color","Color-Selection", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )

oGet1:bPainted := { |hDC| IIF( lRepaint = .T., oGet1:Move( , , 100, 50, .f. ), NIL ) }

Best Regards
Uwe :lol:

Re: change a get with on execution

PostPosted: Fri Apr 26, 2013 9:30 pm
by Silvio.Falconi
Sorry here not run ok

Function Calc_Scentifica(oDlg,oGet)
lRepaint:=.t.
oGet:bPainted := { |hDC| IIF( lRepaint , oGet:Move( , , 100, 50, .f. ), NIL ) }
oGet:refresh()
RETURN NIL

the error
Code: Select all  Expand view
pplication
===========
   Path and name: C:\Work\Prg\msgcalc\msgcalc.Exe (32 bits)
   Size: 2,138,624 bytes
   Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 6715)
   FiveWin  Version: FWHX 12.03
   Windows version: 6.1, Build 7600

   Time from start: 0 hours 0 mins 3 secs
   Error occurred at: 04/26/13, 23:28:19
   Error description: Error BASE/1005  Class: 'NIL' has no property: BPAINTED
   Args:
     [   1] = U  
     [   2] = B   {|| ... }

Stack Calls
===========
   Called from:  => _BPAINTED( 0 )
   Called from: msgcalc.prg => CALC_SCENTIFICA( 467 )
   Called from: msgcalc.prg => (b)BUILDMENU( 432 )
   Called from: .\source\classes\MENU.PRG => TMENU:COMMAND( 461 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 350 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 886 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
   Called from: msgcalc.prg => MSGCALC( 359 )

Re: change a get with on execution

PostPosted: Fri Apr 26, 2013 9:56 pm
by ukoenig
Silvio,

it is a wrong logic.
The oGet:Refresh() is needed inside the BUTTON-action !
Just add the line < oGet:bPainted > next to Your defined get.
You don't need a function for oGet:bPainted !

lRepaint := .F.
REDEFINE GET oGet1 VAR nWColorF ID 120 OF oDlg4 PICTURE "999999999" FONT oFont1

// only resized with lRepaint := .T. and oGet:Refresh() from button-action
oGet:bPainted := { |hDC| IIF( lRepaint , oGet:Move( , , 100, 50, .f. ), NIL ) }

Regards
Uwe :lol:

Re: change a get with on execution

PostPosted: Sat Apr 27, 2013 1:15 am
by nageswaragunupudi
I have this get

@ 0.5, 0.5 GET oGet VAR cGet OF oDlg SIZE 120, 12 RIGHT FONT oFont2

and I wish change the with from 120 to 232


Please try
Code: Select all  Expand view
function test()

   local oDlg, oGet
   local cGet  := PadR( "Change Get Width", 100 )

   DEFINE DIALOG oDlg SIZE 520,120 PIXEL
   @  10,10 BUTTON "GetWidth" SIZE 60,12 PIXEL OF oDlg ;
      ACTION ( oGet:nWidth := 232 * 2 )
   @  25,10 GET oGet VAR cGet SIZE 120,12 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED

return nil

 

Re: change a get with on execution

PostPosted: Sat Apr 27, 2013 6:42 am
by Silvio.Falconi
this run ok , I need it to change Msgcalc Standard to Scentific...