FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Dynamically adjusting a get field width in a folder
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Dynamically adjusting a get field width in a folder
Posted: Mon Jan 07, 2008 03:19 AM
For gets on a regular dialog box, I use the following to change their width:

activate dialog oDlg on init ChgGetsWid(oDlg)


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

TIA
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Dynamically adjusting a get field width in a folder
Posted: Mon Jan 07, 2008 05:50 AM

Have you tried oFolder:bInit?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Dynamically adjusting a get field width in a folder
Posted: Mon Jan 07, 2008 08: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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Dynamically adjusting a get field width in a folder
Posted: Mon Jan 07, 2008 09: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Dynamically adjusting a get field width in a folder
Posted: 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().

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 !)

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Dynamically adjusting a get field width in a folder
Posted: 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:
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
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Dynamically adjusting a get field width in a folder
Posted: Tue Jan 08, 2008 08:47 AM

Yes, you are right :D

So every page of the folder can have it´s own bInit.

kind regards

Stefan
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Dynamically adjusting a get field width in a folder
Posted: Wed Jan 09, 2008 02:14 AM

James, Stefan, Antonio,
Thanks for the input :) . Will give it a try later on

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion