Dynamically adjusting a get field width in a folder

Dynamically adjusting a get field width in a folder

Postby hua » Mon Jan 07, 2008 3:19 am

For gets on a regular dialog box, I use the following to change their width:

Code: Select all  Expand view  RUN
activate dialog oDlg on init ChgGetsWid(oDlg)


How to specify on init for a folder's page?

TIA
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Postby James Bott » Mon Jan 07, 2008 5:50 am

Have you tried oFolder:bInit?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby StefanHaupt » Mon Jan 07, 2008 8:50 am

Hua, James,

the bInit is not executed for the dialogs.

You have to change the method Default(), where the the dialogs are activated and add your own bInit to the standard init.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby James Bott » Mon Jan 07, 2008 9:03 am

Stefan,

>the bInit is not executed for the dialogs.

I'm not sure what you mean. Can't you just do something like:

activate dialog oDlg on init oFolder:bInit

Are you saying that oDlg:bInit never gets eval'd?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby StefanHaupt » Mon Jan 07, 2008 12:19 pm

James,

in the folder class for every page a dialog is created (see Method New() or Redefine() ). These dialogs are activated in the method Default().

Code: Select all  Expand view  RUN
for nLen = 1 to Len( ::aDialogs )
      oDlg = ::aDialogs[ nLen ]
.....
ACTIVATE DIALOG oDlg NOWAIT ;
                  ON INIT oDlg:Move( nHeight - 1, 1 ) ;
                  VALID .f.                // to avoid exiting pressing Esc !!!
......


As you see there is no self-defined bInit (e.g. oFld:bInit) executed.

A possible solution could be (not tested !)

Code: Select all  Expand view  RUN
ACTIVATE DIALOG oDlg NOWAIT ;
                  ON INIT (oDlg:Move( nHeight - 1, 1 ), IIF(::bInit!=nil,Eval(bInit),) ) ;
                  VALID .f.                // to avoid exiting pressing Esc !!!
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Antonio Linares » Mon Jan 07, 2008 12:43 pm

As Stefan explains, the ON INIT of the folder dialogs is being used, so it replaces a previous existing bInit:

oFolder:aDialogs[ n ]:bInit = { || ... code ... }

so the Stefan solution is right. I suggest it this way:
Code: Select all  Expand view  RUN
ACTIVATE DIALOG oDlg NOWAIT ;
        ON INIT ( oDlg:Move( nHeight - 1, 1 ),;
        If( oDlg:bInit != nil, Eval( oDlg:bInit, oDlg ),) ) ;
        VALID .F.
regards, saludos

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

Postby StefanHaupt » Tue Jan 08, 2008 8:47 am

Yes, you are right :D

So every page of the folder can have it´s own bInit.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby hua » Wed Jan 09, 2008 2:14 am

James, Stefan, Antonio,
Thanks for the input :) . Will give it a try later on
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

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