Adding a LostFocus Event To A Combobox Programmatically 
Author Message
 Adding a LostFocus Event To A Combobox Programmatically

Hello:

I'm adding a combobox to one of the columns of a grid using the
.column1.addobject method in code.  I would like to Add a LostFocus
event to that object.  How do I do this?  Usually, when I place a
combobox on a form, I use the design environment and plunk down code
in the LostFocus Event box.  How do I do this programmatically?

Thanks!

Steven

With ThisForm.pgfUseAnalysis.Page1.grdWaterSourceUsage
        .RowHeight=24
        .RecordSource="rwcurWaterSourceUsage"
        .AllowAddNew=.T.
        .Width=240
        .ColumnCount=2
        .Column1.Width=130
        .Column1.Header1.Caption="Source Name"
        .Column1.ControlSource="rwcurWaterSourceUsage.watersourcename"
        .Column1.Readonly=.F.
        .Column1.addobject("cboWaterSources","jswsc_combobox")
        .Column1.cboWaterSources.columncount=1
        .Column1.cboWaterSources.boundcolumn=1
        .Column1.cboWaterSources.columnlines=.T.
              .Column1.cboWaterSources.visible=.T.
        .Column1.cboWaterSources.rowsourcetype=2

.Column1.cboWaterSources.rowsource="curWaterSources.WaterSourceName"
        .Column1.cboWaterSources.fontsize=8
        .Column1.cboWaterSources.style=2
        .Column1.sparse=.T.
        .Column1.currentcontrol="cboWaterSources"
EndWith



Wed, 09 Feb 2005 05:32:34 GMT  
 Adding a LostFocus Event To A Combobox Programmatically
You can't add method code at runtime  Instead, add the code to
jswsc_combobox (or to a subclass of jswsc_combobox).

 - Rush


Quote:
> Hello:

> I'm adding a combobox to one of the columns of a grid using the
> .column1.addobject method in code.  I would like to Add a LostFocus
> event to that object.  How do I do this?  Usually, when I place a
> combobox on a form, I use the design environment and plunk down code
> in the LostFocus Event box.  How do I do this programmatically?

> Thanks!

> Steven

> With ThisForm.pgfUseAnalysis.Page1.grdWaterSourceUsage
> .RowHeight=24
> .RecordSource="rwcurWaterSourceUsage"
> .AllowAddNew=.T.
> .Width=240
> .ColumnCount=2
> .Column1.Width=130
> .Column1.Header1.Caption="Source Name"
> .Column1.ControlSource="rwcurWaterSourceUsage.watersourcename"
> .Column1.Readonly=.F.
> .Column1.addobject("cboWaterSources","jswsc_combobox")
> .Column1.cboWaterSources.columncount=1
> .Column1.cboWaterSources.boundcolumn=1
> .Column1.cboWaterSources.columnlines=.T.
>               .Column1.cboWaterSources.visible=.T.
> .Column1.cboWaterSources.rowsourcetype=2

> .Column1.cboWaterSources.rowsource="curWaterSources.WaterSourceName"
> .Column1.cboWaterSources.fontsize=8
> .Column1.cboWaterSources.style=2
> .Column1.sparse=.T.
> .Column1.currentcontrol="cboWaterSources"
> EndWith



Wed, 09 Feb 2005 05:58:30 GMT  
 Adding a LostFocus Event To A Combobox Programmatically
On Fri, 23 Aug 2002 21:58:30 GMT, "Rush Strong"

Quote:

>You can't add method code at runtime  Instead, add the code to
>jswsc_combobox (or to a subclass of jswsc_combobox).

Excellent!  Many thanks.  I thought that one might be able to add
method code as well, since one can add properties at runtime.  I'll
now derive a new class for this purpose.

Thanks Again!

Steven

Quote:
> - Rush



>> Hello:

>> I'm adding a combobox to one of the columns of a grid using the
>> .column1.addobject method in code.  I would like to Add a LostFocus
>> event to that object.  How do I do this?  Usually, when I place a
>> combobox on a form, I use the design environment and plunk down code
>> in the LostFocus Event box.  How do I do this programmatically?

>> Thanks!

>> Steven

>> With ThisForm.pgfUseAnalysis.Page1.grdWaterSourceUsage
>> .RowHeight=24
>> .RecordSource="rwcurWaterSourceUsage"
>> .AllowAddNew=.T.
>> .Width=240
>> .ColumnCount=2
>> .Column1.Width=130
>> .Column1.Header1.Caption="Source Name"
>> .Column1.ControlSource="rwcurWaterSourceUsage.watersourcename"
>> .Column1.Readonly=.F.
>> .Column1.addobject("cboWaterSources","jswsc_combobox")
>> .Column1.cboWaterSources.columncount=1
>> .Column1.cboWaterSources.boundcolumn=1
>> .Column1.cboWaterSources.columnlines=.T.
>>               .Column1.cboWaterSources.visible=.T.
>> .Column1.cboWaterSources.rowsourcetype=2

>> .Column1.cboWaterSources.rowsource="curWaterSources.WaterSourceName"
>> .Column1.cboWaterSources.fontsize=8
>> .Column1.cboWaterSources.style=2
>> .Column1.sparse=.T.
>> .Column1.currentcontrol="cboWaterSources"
>> EndWith



Wed, 09 Feb 2005 13:31:15 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. adding event code programmatically

2. Lostfocus event

3. How can I create a Grid.LostFocus() Event ?

4. Bypass Lostfocus event

5. setfocus from within the lostfocus event

6. how 2 disable combobox programmatically?

7. How to programmatically change object event method ?

8. How to define Header.RightClick Event programmatically?

9. Programmatically defining events

10. Programmatically add code to forms?

11. Adding network connections programmatically in FoxPro 2.6

12. Adding objects to a form programmatically

 

 
Powered by phpBB® Forum Software