Página 1 de 1

Using ESC key

Publicado: Jue Jul 06, 2006 3:59 pm
por Giuseppe Bogetti
Hi,
I've a MdiChild form which I would like to be able to close using the ESC
key. So I added the following code
METHOD FormKeyUp( oSender, nKey, nFlags ) CLASS TSerDoc
IF ( nKey == VK_ESCAPE )
::Close()
ENDIF
RETURN Nil
From this MdiChild I open a Modal Dialog to perform data editing.
If I press the ESC key on that form the key is also sent to the MdiChild
form causing it to close.
What am I doing wrong ?
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

Using ESC key

Publicado: Jue Jul 06, 2006 4:20 pm
por ignacio
Giusepe,
The TFORM class uses the WM_KEYDOWN message to check for the press of
VK_ESCAPE on dialog forms. When this is the case, the the form is closed and
it RETURNS 0, so the message is not send to its parent form. But your code
controls WM_KEYUP message and then this is what it happens:
1) You push the ESC key, WM_KEYDOWN is triggered on Dialog form, the form
is closed and the message is not passed to its parent form
2) WM_KEYUP is triggered on Dialog form, since it is not processed, is
passed to its parent form.
3) The parent form processes the WM_KEYUP event and closes itself.
Solutions:
1) Use the event KEYDOWN instead of KEYUP
2) Catch the KEYUP event on the dialog form simply returning 0 when the key
is ESCAPE
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:1hkvfr3i43b6f.xjb6igyc19l$[email=.dlg@40tude.net...].dlg@40tude.net...[/email]
> Hi,
>
> I've a MdiChild form which I would like to be able to close using the ESC
> key. So I added the following code
>
> METHOD FormKeyUp( oSender, nKey, nFlags ) CLASS TSerDoc
> IF ( nKey == VK_ESCAPE )
> ::Close()
> ENDIF
> RETURN Nil
>
> From this MdiChild I open a Modal Dialog to perform data editing.
>
> If I press the ESC key on that form the key is also sent to the MdiChild
> form causing it to close.
>
> What am I doing wrong ?
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy

Using ESC key

Publicado: Jue Jul 06, 2006 4:20 pm
por NoName
Giusepe,
The TFORM class uses the WM_KEYDOWN message to check for the press of
VK_ESCAPE on dialog forms. When this is the case, the the form is closed and
it RETURNS 0, so the message is not send to its parent form. But your code
controls WM_KEYUP message and then this is what it happens:
1) You push the ESC key, WM_KEYDOWN is triggered on Dialog form, the form
is closed and the message is not passed to its parent form
2) WM_KEYUP is triggered on Dialog form, since it is not processed, is
passed to its parent form.
3) The parent form processes the WM_KEYUP event and closes itself.
Solutions:
1) Use the event KEYDOWN instead of KEYUP
2) Catch the KEYUP event on the dialog form simply returning 0 when the key
is ESCAPE
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:1hkvfr3i43b6f.xjb6igyc19l$[email=.dlg@40tude.net...].dlg@40tude.net...[/email]
> Hi,
>
> I've a MdiChild form which I would like to be able to close using the ESC
> key. So I added the following code
>
> METHOD FormKeyUp( oSender, nKey, nFlags ) CLASS TSerDoc
> IF ( nKey == VK_ESCAPE )
> ::Close()
> ENDIF
> RETURN Nil
>
> From this MdiChild I open a Modal Dialog to perform data editing.
>
> If I press the ESC key on that form the key is also sent to the MdiChild
> form causing it to close.
>
> What am I doing wrong ?
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy

Using ESC key

Publicado: Jue Jul 06, 2006 4:56 pm
por Giuseppe Bogetti
Il Thu, 6 Jul 2006 16:20:21 +0200, Ignacio Ortiz de Zúñiga ha scritto:
Ignacio,
thanks for the fast response.
I've stumbled into another problem.
I've a form as per the attached image. In this form I show the contents of
four different tables all sharing a common field "DESCRI". The column of
the browser is defined within the IDE.
Clicking on the TTabCtrl over the browser select the table you can work
with.
I first tried rebuilding the TDataset after every selection and:
- the first time I assign the dataset to the browser everything is OK
- the second time and so on, the browser column are updated to reflect all
the columns from the table.
So what can I do to change programmatically the dataset of a browser
retaining the current column configuration ?
Or do I have to rebuild the browser column every time I change the dataset
?
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy
--

Using ESC key

Publicado: Jue Jul 06, 2006 4:56 pm
por Giuseppe Bogetti
Il Thu, 6 Jul 2006 16:20:21 +0200, Ignacio Ortiz de Zúñiga ha scritto:
Ignacio,
thanks for the fast response.
I've stumbled into another problem.
I've a form as per the attached image. In this form I show the contents of
four different tables all sharing a common field "DESCRI". The column of
the browser is defined within the IDE.
Clicking on the TTabCtrl over the browser select the table you can work
with.
I first tried rebuilding the TDataset after every selection and:
- the first time I assign the dataset to the browser everything is OK
- the second time and so on, the browser column are updated to reflect all
the columns from the table.
So what can I do to change programmatically the dataset of a browser
retaining the current column configuration ?
Or do I have to rebuild the browser column every time I change the dataset
?
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy
--

Using ESC key

Publicado: Vie Jul 07, 2006 10:08 am
por ignacio
Giussepe,
On the OnChange event of the TTabCtrl, just reassign the Dataset:
oBrowse:oDataSet := oDataSet1
oBrowse:oDataSet := oDataSet2
oBrowse:oDataSet := oDataSet3
oBrowse:oDataSet := oDataSet4
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:[email=eep9uhtut4dm.9n0mlpjjiuyb.dlg@40tude.net...]eep9uhtut4dm.9n0mlpjjiuyb.dlg@40tude.net...[/email]
> Il Thu, 6 Jul 2006 16:20:21 +0200, Ignacio Ortiz de Zúñiga ha scritto:
>
> Ignacio,
> thanks for the fast response.
>
> I've stumbled into another problem.
>
> I've a form as per the attached image. In this form I show the contents of
> four different tables all sharing a common field "DESCRI". The column of
> the browser is defined within the IDE.
>
> Clicking on the TTabCtrl over the browser select the table you can work
> with.
>
> I first tried rebuilding the TDataset after every selection and:
> - the first time I assign the dataset to the browser everything is OK
> - the second time and so on, the browser column are updated to reflect all
> the columns from the table.
>
> So what can I do to change programmatically the dataset of a browser
> retaining the current column configuration ?
>
> Or do I have to rebuild the browser column every time I change the dataset
> ?
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy

Using ESC key

Publicado: Vie Jul 07, 2006 10:08 am
por NoName
Giussepe,
On the OnChange event of the TTabCtrl, just reassign the Dataset:
oBrowse:oDataSet := oDataSet1
oBrowse:oDataSet := oDataSet2
oBrowse:oDataSet := oDataSet3
oBrowse:oDataSet := oDataSet4
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:[email=eep9uhtut4dm.9n0mlpjjiuyb.dlg@40tude.net...]eep9uhtut4dm.9n0mlpjjiuyb.dlg@40tude.net...[/email]
> Il Thu, 6 Jul 2006 16:20:21 +0200, Ignacio Ortiz de Zúñiga ha scritto:
>
> Ignacio,
> thanks for the fast response.
>
> I've stumbled into another problem.
>
> I've a form as per the attached image. In this form I show the contents of
> four different tables all sharing a common field "DESCRI". The column of
> the browser is defined within the IDE.
>
> Clicking on the TTabCtrl over the browser select the table you can work
> with.
>
> I first tried rebuilding the TDataset after every selection and:
> - the first time I assign the dataset to the browser everything is OK
> - the second time and so on, the browser column are updated to reflect all
> the columns from the table.
>
> So what can I do to change programmatically the dataset of a browser
> retaining the current column configuration ?
>
> Or do I have to rebuild the browser column every time I change the dataset
> ?
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy

Using ESC key

Publicado: Vie Jul 07, 2006 11:30 am
por Giuseppe Bogetti
Il Fri, 7 Jul 2006 10:08:31 +0200, Ignacio Ortiz de Zúñiga ha scritto:
Ignacio,
> On the OnChange event of the TTabCtrl, just reassign the Dataset:
>
> oBrowse:oDataSet := oDataSet1
> oBrowse:oDataSet := oDataSet2
> oBrowse:oDataSet := oDataSet3
> oBrowse:oDataSet := oDataSet4
>
This was my first choice but assigning the dataset also caused the browser
to reconfigure the columns as you can see in the attached picture.
Am I missing something ?
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy
--

Using ESC key

Publicado: Vie Jul 07, 2006 11:30 am
por Giuseppe Bogetti
Il Fri, 7 Jul 2006 10:08:31 +0200, Ignacio Ortiz de Zúñiga ha scritto:
Ignacio,
> On the OnChange event of the TTabCtrl, just reassign the Dataset:
>
> oBrowse:oDataSet := oDataSet1
> oBrowse:oDataSet := oDataSet2
> oBrowse:oDataSet := oDataSet3
> oBrowse:oDataSet := oDataSet4
>
This was my first choice but assigning the dataset also caused the browser
to reconfigure the columns as you can see in the attached picture.
Am I missing something ?
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy
--

Using ESC key

Publicado: Vie Jul 07, 2006 6:19 pm
por ignacio
Giusseppe,
You are right, a few months ago a user told us to completely reset the
browse when a different DataSet was assigned because in most situations a
run-time error is produced.
Just do this:
oBrowse:Reset()
oBrowse:AddCol( oCol )
oBrowse:oDataSet := oDataSet1
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:1ptzyu1neknu9$[email=.1u845cq8xsrdf.dlg@40tude.net...].1u845cq8xsrdf.dlg@40tude.net...[/email]
> Il Fri, 7 Jul 2006 10:08:31 +0200, Ignacio Ortiz de Zúñiga ha scritto:
>
> Ignacio,
>
>> On the OnChange event of the TTabCtrl, just reassign the Dataset:
>>
>> oBrowse:oDataSet := oDataSet1
>> oBrowse:oDataSet := oDataSet2
>> oBrowse:oDataSet := oDataSet3
>> oBrowse:oDataSet := oDataSet4
>>
> This was my first choice but assigning the dataset also caused the browser
> to reconfigure the columns as you can see in the attached picture.
>
> Am I missing something ?
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy

Using ESC key

Publicado: Vie Jul 07, 2006 6:19 pm
por NoName
Giusseppe,
You are right, a few months ago a user told us to completely reset the
browse when a different DataSet was assigned because in most situations a
run-time error is produced.
Just do this:
oBrowse:Reset()
oBrowse:AddCol( oCol )
oBrowse:oDataSet := oDataSet1
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:1ptzyu1neknu9$[email=.1u845cq8xsrdf.dlg@40tude.net...].1u845cq8xsrdf.dlg@40tude.net...[/email]
> Il Fri, 7 Jul 2006 10:08:31 +0200, Ignacio Ortiz de Zúñiga ha scritto:
>
> Ignacio,
>
>> On the OnChange event of the TTabCtrl, just reassign the Dataset:
>>
>> oBrowse:oDataSet := oDataSet1
>> oBrowse:oDataSet := oDataSet2
>> oBrowse:oDataSet := oDataSet3
>> oBrowse:oDataSet := oDataSet4
>>
> This was my first choice but assigning the dataset also caused the browser
> to reconfigure the columns as you can see in the attached picture.
>
> Am I missing something ?
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy