Página 1 de 1

Re: TFolder

Publicado: Mar Sep 13, 2005 11:06 am
por jfgimenez
Giuseppe,
> Is it possible to define a TFolderPage using the IDE like a TForm and than
> add it dynamically to a TFolder control ?
There is a trick I'm using:
- Make your main form the first form of your project, to make it available
as Application:oMainForm in the whole program.
- Design the forms as usual, but don't change any property of it, excepting
nleft, ntop, nwidth and nheight
- Modify the CLASS declaration from:
CLASS TForm1 FROM TForm
to:
CLASS TForm1 FROM TFolderForm
- Put the following code in any .prg of your project (you can create a new
..prg if you want):
//---------------------------------------------------------- --------------------
CLASS TFolderForm FROM TFolderPage
DATA nFormType
METHOD New( oParent )
METHOD CreateForm() VIRTUAL
METHOD Close() INLINE ::Delete()
ENDCLASS
//---------------------------------------------------------- --------------------
METHOD New( oParent ) CLASS TFolderForm
// Change oFolder1 to the apropiate name
Super:New( Application:oMainForm:oFolder1 )
::CreateForm()
::Select()
::SetFocus()
RETURN Self
//---------------------------------------------------------- --------------------
- To call the form, do it as usual, but without calling :Show() or
:ShowModal(). I.e.:
TForm1:New()
- Notice that now it's not a form, but a folder page, so be careful using
it. I.e., don't call ShowModal(), don't use default or cancel buttons on it,
etc.
That's all ;-)
--
Regards,
Jose F. Gimenez

Re: TFolder

Publicado: Mar Sep 13, 2005 11:17 am
por Giuseppe Bogetti
In data Tue, 13 Sep 2005 11:06:58 +0200, Jose F. Gimenez ha scritto:
> Giuseppe,
>
>> Is it possible to define a TFolderPage using the IDE like a TForm and than
>> add it dynamically to a TFolder control ?
>
> There is a trick I'm using:
>
> - Make your main form the first form of your project, to make it available
> as Application:oMainForm in the whole program.
>
> - Design the forms as usual, but don't change any property of it, excepting
> nleft, ntop, nwidth and nheight
>
> - Modify the CLASS declaration from:
> CLASS TForm1 FROM TForm
> to:
> CLASS TForm1 FROM TFolderForm
>
> - Put the following code in any .prg of your project (you can create a new
> .prg if you want):
>
> //---------------------------------------------------------- --------------------
>
> CLASS TFolderForm FROM TFolderPage
>
> DATA nFormType
>
> METHOD New( oParent )
> METHOD CreateForm() VIRTUAL
> METHOD Close() INLINE ::Delete()
>
> ENDCLASS
>
> //---------------------------------------------------------- --------------------
>
> METHOD New( oParent ) CLASS TFolderForm
>
> // Change oFolder1 to the apropiate name
> Super:New( Application:oMainForm:oFolder1 )
>
> ::CreateForm()
> ::Select()
> ::SetFocus()
>
> RETURN Self
>
> //---------------------------------------------------------- --------------------
>
> - To call the form, do it as usual, but without calling :Show() or
>:ShowModal(). I.e.:
> TForm1:New()
>
> - Notice that now it's not a form, but a folder page, so be careful using
> it. I.e., don't call ShowModal(), don't use default or cancel buttons on it,
> etc.
>
>
> That's all ;-)
Thanks.
PreRelease 5 really rocks !!!
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

Re: TFolder

Publicado: Mar Sep 13, 2005 11:17 am
por Giuseppe Bogetti
In data Tue, 13 Sep 2005 11:06:58 +0200, Jose F. Gimenez ha scritto:
> Giuseppe,
>
>> Is it possible to define a TFolderPage using the IDE like a TForm and than
>> add it dynamically to a TFolder control ?
>
> There is a trick I'm using:
>
> - Make your main form the first form of your project, to make it available
> as Application:oMainForm in the whole program.
>
> - Design the forms as usual, but don't change any property of it, excepting
> nleft, ntop, nwidth and nheight
>
> - Modify the CLASS declaration from:
> CLASS TForm1 FROM TForm
> to:
> CLASS TForm1 FROM TFolderForm
>
> - Put the following code in any .prg of your project (you can create a new
> .prg if you want):
>
> //---------------------------------------------------------- --------------------
>
> CLASS TFolderForm FROM TFolderPage
>
> DATA nFormType
>
> METHOD New( oParent )
> METHOD CreateForm() VIRTUAL
> METHOD Close() INLINE ::Delete()
>
> ENDCLASS
>
> //---------------------------------------------------------- --------------------
>
> METHOD New( oParent ) CLASS TFolderForm
>
> // Change oFolder1 to the apropiate name
> Super:New( Application:oMainForm:oFolder1 )
>
> ::CreateForm()
> ::Select()
> ::SetFocus()
>
> RETURN Self
>
> //---------------------------------------------------------- --------------------
>
> - To call the form, do it as usual, but without calling :Show() or
>:ShowModal(). I.e.:
> TForm1:New()
>
> - Notice that now it's not a form, but a folder page, so be careful using
> it. I.e., don't call ShowModal(), don't use default or cancel buttons on it,
> etc.
>
>
> That's all ;-)
Thanks.
PreRelease 5 really rocks !!!
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

Re: TFolder

Publicado: Mar Sep 13, 2005 2:56 pm
por Giuseppe Bogetti
In data Tue, 13 Sep 2005 11:06:58 +0200, Jose F. Gimenez ha scritto:
Jose,
> - Design the forms as usual, but don't change any property of it, excepting
> nleft, ntop, nwidth and nheight
Is it safe to set nBorderStyle to bsNONE ?
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

Re: TFolder

Publicado: Mar Sep 13, 2005 2:56 pm
por Giuseppe Bogetti
In data Tue, 13 Sep 2005 11:06:58 +0200, Jose F. Gimenez ha scritto:
Jose,
> - Design the forms as usual, but don't change any property of it, excepting
> nleft, ntop, nwidth and nheight
Is it safe to set nBorderStyle to bsNONE ?
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

Re: TFolder

Publicado: Mar Sep 13, 2005 3:04 pm
por jfgimenez
Giuseppe,
>> - Design the forms as usual, but don't change any property of it,
>> excepting
>> nleft, ntop, nwidth and nheight
>
> Is it safe to set nBorderStyle to bsNONE ?
I don't think so. Notice that you are designing a form that will be used as
a TFolderPage. So, you can only change any property that TFolderPage have,
and nBorderStyle is not one of them.
--
Regards,
Jose F. Gimenez

Re: TFolder

Publicado: Mar Sep 13, 2005 3:04 pm
por jfgimenez
Giuseppe,
>> - Design the forms as usual, but don't change any property of it,
>> excepting
>> nleft, ntop, nwidth and nheight
>
> Is it safe to set nBorderStyle to bsNONE ?
I don't think so. Notice that you are designing a form that will be used as
a TFolderPage. So, you can only change any property that TFolderPage have,
and nBorderStyle is not one of them.
--
Regards,
Jose F. Gimenez

Re: TFolder

Publicado: Jue Oct 06, 2005 3:46 pm
por Giuseppe Bogetti
In data Tue, 13 Sep 2005 11:06:58 +0200, Jose F. Gimenez ha scritto:
Jose
> Giuseppe,
>
>> Is it possible to define a TFolderPage using the IDE like a TForm and than
>> add it dynamically to a TFolder control ?
>
> There is a trick I'm using:
>
> - Make your main form the first form of your project, to make it available
> as Application:oMainForm in the whole program.
>
> - Design the forms as usual, but don't change any property of it, excepting
> nleft, ntop, nwidth and nheight
>
> - Modify the CLASS declaration from:
> CLASS TForm1 FROM TForm
> to:
> CLASS TForm1 FROM TFolderForm
>
> - Put the following code in any .prg of your project (you can create a new
> .prg if you want):
>
> //---------------------------------------------------------- --------------------
>
> CLASS TFolderForm FROM TFolderPage
>
> DATA nFormType
>
> METHOD New( oParent )
> METHOD CreateForm() VIRTUAL
> METHOD Close() INLINE ::Delete()
>
> ENDCLASS
>
> //---------------------------------------------------------- --------------------
>
> METHOD New( oParent ) CLASS TFolderForm
>
> // Change oFolder1 to the apropiate name
> Super:New( Application:oMainForm:oFolder1 )
>
> ::CreateForm()
> ::Select()
> ::SetFocus()
>
> RETURN Self
>
> //---------------------------------------------------------- --------------------
>
> - To call the form, do it as usual, but without calling :Show() or
>:ShowModal(). I.e.:
> TForm1:New()
>
> - Notice that now it's not a form, but a folder page, so be careful using
> it. I.e., don't call ShowModal(), don't use default or cancel buttons on it,
> etc.
>
>
> That's all ;-)
Is it possibile to add an event handler for the OnSize event ?
I think of adding:
EVENT OnSize( oSender, nSizeType, nClientWidth, nClientHeight )
But then I don't know how to define the OnSize method to handle the event.
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

Re: TFolder

Publicado: Jue Oct 06, 2005 3:46 pm
por Giuseppe Bogetti
In data Tue, 13 Sep 2005 11:06:58 +0200, Jose F. Gimenez ha scritto:
Jose
> Giuseppe,
>
>> Is it possible to define a TFolderPage using the IDE like a TForm and than
>> add it dynamically to a TFolder control ?
>
> There is a trick I'm using:
>
> - Make your main form the first form of your project, to make it available
> as Application:oMainForm in the whole program.
>
> - Design the forms as usual, but don't change any property of it, excepting
> nleft, ntop, nwidth and nheight
>
> - Modify the CLASS declaration from:
> CLASS TForm1 FROM TForm
> to:
> CLASS TForm1 FROM TFolderForm
>
> - Put the following code in any .prg of your project (you can create a new
> .prg if you want):
>
> //---------------------------------------------------------- --------------------
>
> CLASS TFolderForm FROM TFolderPage
>
> DATA nFormType
>
> METHOD New( oParent )
> METHOD CreateForm() VIRTUAL
> METHOD Close() INLINE ::Delete()
>
> ENDCLASS
>
> //---------------------------------------------------------- --------------------
>
> METHOD New( oParent ) CLASS TFolderForm
>
> // Change oFolder1 to the apropiate name
> Super:New( Application:oMainForm:oFolder1 )
>
> ::CreateForm()
> ::Select()
> ::SetFocus()
>
> RETURN Self
>
> //---------------------------------------------------------- --------------------
>
> - To call the form, do it as usual, but without calling :Show() or
>:ShowModal(). I.e.:
> TForm1:New()
>
> - Notice that now it's not a form, but a folder page, so be careful using
> it. I.e., don't call ShowModal(), don't use default or cancel buttons on it,
> etc.
>
>
> That's all ;-)
Is it possibile to add an event handler for the OnSize event ?
I think of adding:
EVENT OnSize( oSender, nSizeType, nClientWidth, nClientHeight )
But then I don't know how to define the OnSize method to handle the event.
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

Re: TFolder

Publicado: Jue Oct 06, 2005 5:19 pm
por jfgimenez
Guiseppe,
> Is it possibile to add an event handler for the OnSize event ?
>
> I think of adding:
> EVENT OnSize( oSender, nSizeType, nClientWidth, nClientHeight )
>
> But then I don't know how to define the OnSize method to handle the event.
The form, and in this case the folderpage, is a class. So, you can add any
method directly, including those that are called directly by the Xailer's
kernel when a windows message arrives to the control (WM_xxxxx). That is,
you can add the method WMSize() and process what ever you want:
METHOD WMSize( nWParam, nLParam ) CLASS TForm1
LOCAL nWidth := LoWord( nLParam )
LOCAL nHeight := HiWord( nLParam )
...
// It's important to call the previous method to allow the parent
// class to process the message
RETURN Super:WMSize( nWParam, nLParam )
However, I don't imagine what are you going to do here. If you want to
move/resize any control when the form is resized, you can play with nAlign
or nAnchors.
--
Un saludo,
José F. Giménez

Re: TFolder

Publicado: Jue Oct 06, 2005 5:19 pm
por jfgimenez
Guiseppe,
> Is it possibile to add an event handler for the OnSize event ?
>
> I think of adding:
> EVENT OnSize( oSender, nSizeType, nClientWidth, nClientHeight )
>
> But then I don't know how to define the OnSize method to handle the event.
The form, and in this case the folderpage, is a class. So, you can add any
method directly, including those that are called directly by the Xailer's
kernel when a windows message arrives to the control (WM_xxxxx). That is,
you can add the method WMSize() and process what ever you want:
METHOD WMSize( nWParam, nLParam ) CLASS TForm1
LOCAL nWidth := LoWord( nLParam )
LOCAL nHeight := HiWord( nLParam )
...
// It's important to call the previous method to allow the parent
// class to process the message
RETURN Super:WMSize( nWParam, nLParam )
However, I don't imagine what are you going to do here. If you want to
move/resize any control when the form is resized, you can play with nAlign
or nAnchors.
--
Un saludo,
José F. Giménez

Re: TFolder

Publicado: Jue Oct 06, 2005 5:56 pm
por Giuseppe Bogetti
In data Thu, 6 Oct 2005 17:19:13 +0200, Jose F. Gimenez ha scritto:
> Guiseppe,
>
>> Is it possibile to add an event handler for the OnSize event ?
>>
>> I think of adding:
>> EVENT OnSize( oSender, nSizeType, nClientWidth, nClientHeight )
>>
>> But then I don't know how to define the OnSize method to handle the event.
>
> The form, and in this case the folderpage, is a class. So, you can add any
> method directly, including those that are called directly by the Xailer's
> kernel when a windows message arrives to the control (WM_xxxxx). That is,
> you can add the method WMSize() and process what ever you want:
>
> METHOD WMSize( nWParam, nLParam ) CLASS TForm1
>
> LOCAL nWidth := LoWord( nLParam )
> LOCAL nHeight := HiWord( nLParam )
> ...
> // It's important to call the previous method to allow the parent
> // class to process the message
> RETURN Super:WMSize( nWParam, nLParam )
>
> However, I don't imagine what are you going to do here.
For example in one forms I have a two column array browser. What I would
like to achieve is:
- first column has always the same size.
- second column always fills the remaing part of browser area. That is
grows when the form is maximized and shrinks when the form is restored to
original size.
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

Re: TFolder

Publicado: Jue Oct 06, 2005 5:56 pm
por Giuseppe Bogetti
In data Thu, 6 Oct 2005 17:19:13 +0200, Jose F. Gimenez ha scritto:
> Guiseppe,
>
>> Is it possibile to add an event handler for the OnSize event ?
>>
>> I think of adding:
>> EVENT OnSize( oSender, nSizeType, nClientWidth, nClientHeight )
>>
>> But then I don't know how to define the OnSize method to handle the event.
>
> The form, and in this case the folderpage, is a class. So, you can add any
> method directly, including those that are called directly by the Xailer's
> kernel when a windows message arrives to the control (WM_xxxxx). That is,
> you can add the method WMSize() and process what ever you want:
>
> METHOD WMSize( nWParam, nLParam ) CLASS TForm1
>
> LOCAL nWidth := LoWord( nLParam )
> LOCAL nHeight := HiWord( nLParam )
> ...
> // It's important to call the previous method to allow the parent
> // class to process the message
> RETURN Super:WMSize( nWParam, nLParam )
>
> However, I don't imagine what are you going to do here.
For example in one forms I have a two column array browser. What I would
like to achieve is:
- first column has always the same size.
- second column always fills the remaing part of browser area. That is
grows when the form is maximized and shrinks when the form is restored to
original size.
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy