Is there a way to trap a mouse click on a grid so as to make that
field True or False??
I have a grid on a form that allows the user to change a columns field
value to either True or False by typing either a T or F on that field.
The user wants to just be able to click his mouse on the field to flip
it from T to F and Back.
TonySper

Re: Trapping Mouse Click on a grid by Dan

Dan
Sat Jan 06 16:13:23 CST 2007

Use a logical field and replace the default textbox with a checkbox. Foxpro
will do the rest for you.

Dan

TonySper wrote:
> Is there a way to trap a mouse click on a grid so as to make that
> field True or False??
> I have a grid on a form that allows the user to change a columns field
> value to either True or False by typing either a T or F on that field.
> The user wants to just be able to click his mouse on the field to flip
> it from T to F and Back.
> TonySper



Re: Trapping Mouse Click on a grid by Bernhard

Bernhard
Sun Jan 07 09:18:52 CST 2007

Hi Tony

> Is there a way to trap a mouse click on a grid so as to make that
> field True or False??
> I have a grid on a form that allows the user to change a columns field
> value to either True or False by typing either a T or F on that field.
> The user wants to just be able to click his mouse on the field to flip
> it from T to F and Back.
Besides of what Dan suggested, instead of the default textbox use an own
textbox. Put appropriate code in owntextbox.click or owntextbox.Mouse* events

Regards
Bernhard Sander

Re: Trapping Mouse Click on a grid by TonySper

TonySper
Sun Jan 07 13:43:05 CST 2007

Dan,
That would work if the field was in the form. I have a browse screen
in the grid in the form. The field I am talking about is in the
database that I bring into the grid in the form. It is logic and is a
field in the browse screen in the form. I have to enter a T or F in
the field to change it. The user just wants to click the mouse on the
field and toggle it. I can't figure out a way to make it act like a
checkbox. Is there a way?
Tony

"Dan Freeman" <spam@microsoft.com> wrote in message
news:ejVWk$dMHHA.3312@TK2MSFTNGP03.phx.gbl...
Use a logical field and replace the default textbox with a checkbox.
Foxpro
will do the rest for you.

Dan

TonySper wrote:
> Is there a way to trap a mouse click on a grid so as to make that
> field True or False??
> I have a grid on a form that allows the user to change a columns
> field
> value to either True or False by typing either a T or F on that
> field.
> The user wants to just be able to click his mouse on the field to
> flip
> it from T to F and Back.
> TonySper




Re: Trapping Mouse Click on a grid by Olaf

Olaf
Sun Jan 07 15:28:35 CST 2007

Hi Tony,

then this is about a click in a browse, not a click on a grid?
you can Browse Name oBrowse

And then have an object reference on the browse window.
With that you can do many things, eg.

oBrowse.ColumnX.Addobject("check1","checkbox")
oBrowse.ColumnX.Activecontrol="check1"

And then would have a checkbox instead of a textbox
in the browse window.

Bye, Olaf.

Re: Trapping Mouse Click on a grid by Jack

Jack
Sun Jan 07 17:42:04 CST 2007

On Sun, 7 Jan 2007 14:48:01 -0500, "TonySper"
<tsperduti@nospambellsouth.net> wrote:

>Dan,
>That would work if the field was in the form. I have a browse screen
>in the grid in the form. The field I am talking about is in the
>database that I bring into the grid in the form.

I don't understand what you are doing.

'Browse' in VFP usually means a window created by the BROWSE command.
A grid is a VFP control that displays records in a manner similar to a
browse window.

Which are you using?

If you are really using a grid, you can put code in the methods of the
textbox in the columns, and you can replace the default textbox
control with something else, like a checkbox.

> It is logic and is a
>field in the browse screen in the form. I have to enter a T or F in
>the field to change it. The user just wants to click the mouse on the
>field and toggle it. I can't figure out a way to make it act like a
>checkbox. Is there a way?
>Tony
>
>"Dan Freeman" <spam@microsoft.com> wrote in message
>news:ejVWk$dMHHA.3312@TK2MSFTNGP03.phx.gbl...
>Use a logical field and replace the default textbox with a checkbox.
>Foxpro
>will do the rest for you.
>
>Dan
>
>TonySper wrote:
>> Is there a way to trap a mouse click on a grid so as to make that
>> field True or False??
>> I have a grid on a form that allows the user to change a columns
>> field
>> value to either True or False by typing either a T or F on that
>> field.
>> The user wants to just be able to click his mouse on the field to
>> flip
>> it from T to F and Back.
>> TonySper
>
>

Re: Trapping Mouse Click on a grid by Dan

Dan
Sun Jan 07 18:54:26 CST 2007

Slow down, fella. <s>

I can't make heads or tails of what you're doing but as Olaf says, in its
innards a browse is nothing but a grid with a wrapper (the window).

If you're really using a browse window, you might want to rethink it. You
can make your own browse window from a form and a grid with about 6 lines of
code, and then it's yours to make it behave any way you like.

Dan

TonySper wrote:
> Dan,
> That would work if the field was in the form. I have a browse screen
> in the grid in the form. The field I am talking about is in the
> database that I bring into the grid in the form. It is logic and is a
> field in the browse screen in the form. I have to enter a T or F in
> the field to change it. The user just wants to click the mouse on the
> field and toggle it. I can't figure out a way to make it act like a
> checkbox. Is there a way?
> Tony
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:ejVWk$dMHHA.3312@TK2MSFTNGP03.phx.gbl...
> Use a logical field and replace the default textbox with a checkbox.
> Foxpro
> will do the rest for you.
>
> Dan
>
> TonySper wrote:
>> Is there a way to trap a mouse click on a grid so as to make that
>> field True or False??
>> I have a grid on a form that allows the user to change a columns
>> field
>> value to either True or False by typing either a T or F on that
>> field.
>> The user wants to just be able to click his mouse on the field to
>> flip
>> it from T to F and Back.
>> TonySper



Re: Trapping Mouse Click on a grid by TonySper

TonySper
Sun Jan 07 21:42:06 CST 2007

I maybe have not explained it correctly. Let me try again. I have a
form I have made up. In this form I have a grid. The grids
RecordSource is the name of a table, The Grids RecordSourceType is
0-Table. Now I open the table and call the form which opens up with
the table in the grid that looks like a browse screen. The table has a
logic field True / False in one of the fields Column(9). The user now
enters a T or F into Column 9 that the rest of my program looks at to
print out different records. All works fine except the user would like
to be able to just use the mouse click instead of typing the True or
False. I have tried
This.Column(9).Addobject("check1","checkbox")
This.Column(9).Activecontrol="check1"

In the init for the grid but there is no ActiveControl in the
properties for the grid and it errors out saying it cannot find
ActiveControl. I have tried putting this in the Form Init using
Thisform.GridName.Column(9) etc but it still errors out.
Tony


"Dan Freeman" <spam@microsoft.com> wrote in message
news:eqZdQ%23rMHHA.1008@TK2MSFTNGP06.phx.gbl...
Slow down, fella. <s>

I can't make heads or tails of what you're doing but as Olaf says, in
its
innards a browse is nothing but a grid with a wrapper (the window).

If you're really using a browse window, you might want to rethink it.
You
can make your own browse window from a form and a grid with about 6
lines of
code, and then it's yours to make it behave any way you like.

Dan

TonySper wrote:
> Dan,
> That would work if the field was in the form. I have a browse screen
> in the grid in the form. The field I am talking about is in the
> database that I bring into the grid in the form. It is logic and is
> a
> field in the browse screen in the form. I have to enter a T or F in
> the field to change it. The user just wants to click the mouse on
> the
> field and toggle it. I can't figure out a way to make it act like a
> checkbox. Is there a way?
> Tony
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:ejVWk$dMHHA.3312@TK2MSFTNGP03.phx.gbl...
> Use a logical field and replace the default textbox with a checkbox.
> Foxpro
> will do the rest for you.
>
> Dan
>
> TonySper wrote:
>> Is there a way to trap a mouse click on a grid so as to make that
>> field True or False??
>> I have a grid on a form that allows the user to change a columns
>> field
>> value to either True or False by typing either a T or F on that
>> field.
>> The user wants to just be able to click his mouse on the field to
>> flip
>> it from T to F and Back.
>> TonySper




Re: Trapping Mouse Click on a grid by Jack

Jack
Sun Jan 07 22:34:54 CST 2007

The name of the column property is "currentcontrol", not
"activecontrol". The VFP help is useful for stuff like this.

You probably also want to set the column's Sparse property to .F.

On Sun, 7 Jan 2007 22:42:12 -0500, "TonySper"
<tsperduti@nospambellsouth.net> wrote:

>I maybe have not explained it correctly. Let me try again. I have a
>form I have made up. In this form I have a grid. The grids
>RecordSource is the name of a table, The Grids RecordSourceType is
>0-Table. Now I open the table and call the form which opens up with
>the table in the grid that looks like a browse screen. The table has a
>logic field True / False in one of the fields Column(9). The user now
>enters a T or F into Column 9 that the rest of my program looks at to
>print out different records. All works fine except the user would like
>to be able to just use the mouse click instead of typing the True or
>False. I have tried
>This.Column(9).Addobject("check1","checkbox")
>This.Column(9).Activecontrol="check1"
>
>In the init for the grid but there is no ActiveControl in the
>properties for the grid and it errors out saying it cannot find
>ActiveControl. I have tried putting this in the Form Init using
>Thisform.GridName.Column(9) etc but it still errors out.
>Tony
>
>
>"Dan Freeman" <spam@microsoft.com> wrote in message
>news:eqZdQ%23rMHHA.1008@TK2MSFTNGP06.phx.gbl...
>Slow down, fella. <s>
>
>I can't make heads or tails of what you're doing but as Olaf says, in
>its
>innards a browse is nothing but a grid with a wrapper (the window).
>
>If you're really using a browse window, you might want to rethink it.
>You
>can make your own browse window from a form and a grid with about 6
>lines of
>code, and then it's yours to make it behave any way you like.
>
>Dan
>
>TonySper wrote:
>> Dan,
>> That would work if the field was in the form. I have a browse screen
>> in the grid in the form. The field I am talking about is in the
>> database that I bring into the grid in the form. It is logic and is
>> a
>> field in the browse screen in the form. I have to enter a T or F in
>> the field to change it. The user just wants to click the mouse on
>> the
>> field and toggle it. I can't figure out a way to make it act like a
>> checkbox. Is there a way?
>> Tony
>>
>> "Dan Freeman" <spam@microsoft.com> wrote in message
>> news:ejVWk$dMHHA.3312@TK2MSFTNGP03.phx.gbl...
>> Use a logical field and replace the default textbox with a checkbox.
>> Foxpro
>> will do the rest for you.
>>
>> Dan
>>
>> TonySper wrote:
>>> Is there a way to trap a mouse click on a grid so as to make that
>>> field True or False??
>>> I have a grid on a form that allows the user to change a columns
>>> field
>>> value to either True or False by typing either a T or F on that
>>> field.
>>> The user wants to just be able to click his mouse on the field to
>>> flip
>>> it from T to F and Back.
>>> TonySper
>
>

Re: Trapping Mouse Click on a grid by Olaf

Olaf
Mon Jan 08 06:09:22 CST 2007

> False. I have tried
> This.Column(9).Addobject("check1","checkbox")
> This.Column(9).Activecontrol="check1"
Sorry, should have been CurrentControl

Another thing you might want to set is
Column(9).Sparse = .F.

Then you'll get a checkbox in every row, not only
the active row.

Bye, Olaf.




Re: Trapping Mouse Click on a grid by Man-wai

Man-wai
Mon Jan 08 06:28:18 CST 2007

TonySper wrote:
> Is there a way to trap a mouse click on a grid so as to make that
> field True or False??
> I have a grid on a form that allows the user to change a columns field
> value to either True or False by typing either a T or F on that field.
> The user wants to just be able to click his mouse on the field to flip
> it from T to F and Back.

Are you trying to click on the grid or grid.columns[x].textbox? They are
different. To click on the grid, you need to have an used area in the
leftmost area of the grid.


--
.~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10) Linux 2.6.19.1
^ ^ 20:26:01 up 27 days 2:38 0 users load average: 1.00 1.01 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

Re: Trapping Mouse Click on a grid by TonySper

TonySper
Mon Jan 08 11:06:58 CST 2007

Olaf,
I am getting closer. I did
This.Columns(9).Sparse = .F.
THIS.Columns(9).ADDOBJECT("Check1","checkbox")
THIS.Columns(9).CurrentControl="check1"
Now the grid comes up with the entire column with the field check
marked but clicking the mouse on them does not change them. They all
stay checked.
How do I get the mouse click to toggle the check marks??
Thanks for all your help.
Tony

"Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de> wrote
in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
> False. I have tried
> This.Column(9).Addobject("check1","checkbox")
> This.Column(9).Activecontrol="check1"
Sorry, should have been CurrentControl

Another thing you might want to set is
Column(9).Sparse = .F.

Then you'll get a checkbox in every row, not only
the active row.

Bye, Olaf.





Re: Trapping Mouse Click on a grid by Anders

Anders
Mon Jan 08 11:34:10 CST 2007

Have you added a ControlSource for the Checkbox
-Anders

"TonySper" <tsperduti@nospambellsouth.net> wrote in message
news:SSuoh.29036$%e7.27296@bignews2.bellsouth.net...
> Olaf,
> I am getting closer. I did
> This.Columns(9).Sparse = .F.
> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
> THIS.Columns(9).CurrentControl="check1"
> Now the grid comes up with the entire column with the field check
> marked but clicking the mouse on them does not change them. They all
> stay checked.
> How do I get the mouse click to toggle the check marks??
> Thanks for all your help.
> Tony
>
> "Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de> wrote
> in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
> > False. I have tried
> > This.Column(9).Addobject("check1","checkbox")
> > This.Column(9).Activecontrol="check1"
> Sorry, should have been CurrentControl
>
> Another thing you might want to set is
> Column(9).Sparse = .F.
>
> Then you'll get a checkbox in every row, not only
> the active row.
>
> Bye, Olaf.
>
>
>
>



Re: Trapping Mouse Click on a grid by TonySper

TonySper
Mon Jan 08 14:54:42 CST 2007

Anders,
I am still in the dark ages. How do I add a ControlSource to the
Checkbox??
Tony

"Anders" <anders altberg> wrote in message
news:uTKI9k0MHHA.4376@TK2MSFTNGP03.phx.gbl...
Have you added a ControlSource for the Checkbox
-Anders

"TonySper" <tsperduti@nospambellsouth.net> wrote in message
news:SSuoh.29036$%e7.27296@bignews2.bellsouth.net...
> Olaf,
> I am getting closer. I did
> This.Columns(9).Sparse = .F.
> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
> THIS.Columns(9).CurrentControl="check1"
> Now the grid comes up with the entire column with the field check
> marked but clicking the mouse on them does not change them. They all
> stay checked.
> How do I get the mouse click to toggle the check marks??
> Thanks for all your help.
> Tony
>
> "Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de> wrote
> in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
> > False. I have tried
> > This.Column(9).Addobject("check1","checkbox")
> > This.Column(9).Activecontrol="check1"
> Sorry, should have been CurrentControl
>
> Another thing you might want to set is
> Column(9).Sparse = .F.
>
> Then you'll get a checkbox in every row, not only
> the active row.
>
> Bye, Olaf.
>
>
>
>




Re: Trapping Mouse Click on a grid by TonySper

TonySper
Mon Jan 08 15:04:18 CST 2007

Anders,
If you mean RecordSource, yes, I have this set to the name of the
table that I open before I call the form.
Tony

"Anders" <anders altberg> wrote in message
news:uTKI9k0MHHA.4376@TK2MSFTNGP03.phx.gbl...
Have you added a ControlSource for the Checkbox
-Anders

"TonySper" <tsperduti@nospambellsouth.net> wrote in message
news:SSuoh.29036$%e7.27296@bignews2.bellsouth.net...
> Olaf,
> I am getting closer. I did
> This.Columns(9).Sparse = .F.
> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
> THIS.Columns(9).CurrentControl="check1"
> Now the grid comes up with the entire column with the field check
> marked but clicking the mouse on them does not change them. They all
> stay checked.
> How do I get the mouse click to toggle the check marks??
> Thanks for all your help.
> Tony
>
> "Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de> wrote
> in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
> > False. I have tried
> > This.Column(9).Addobject("check1","checkbox")
> > This.Column(9).Activecontrol="check1"
> Sorry, should have been CurrentControl
>
> Another thing you might want to set is
> Column(9).Sparse = .F.
>
> Then you'll get a checkbox in every row, not only
> the active row.
>
> Bye, Olaf.
>
>
>
>




Re: Trapping Mouse Click on a grid by Dan

Dan
Mon Jan 08 15:08:15 CST 2007

>> This.Columns(9).Sparse = .F.
>> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
>> THIS.Columns(9).CurrentControl="check1"
This.Columns(9).check1.Controlsource="table.fieldname"

The "auto" controls you have in the grid populate themselves when
instantiated. Any control you add later (such as you're doing here) is "born
dumb". You have to tell it *everything*. <s>

Dan

TonySper wrote:
> Anders,
> I am still in the dark ages. How do I add a ControlSource to the
> Checkbox??
> Tony
>
> "Anders" <anders altberg> wrote in message
> news:uTKI9k0MHHA.4376@TK2MSFTNGP03.phx.gbl...
> Have you added a ControlSource for the Checkbox
> -Anders
>
> "TonySper" <tsperduti@nospambellsouth.net> wrote in message
> news:SSuoh.29036$%e7.27296@bignews2.bellsouth.net...
>> Olaf,
>> I am getting closer. I did
>> This.Columns(9).Sparse = .F.
>> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
>> THIS.Columns(9).CurrentControl="check1"
>> Now the grid comes up with the entire column with the field check
>> marked but clicking the mouse on them does not change them. They all
>> stay checked.
>> How do I get the mouse click to toggle the check marks??
>> Thanks for all your help.
>> Tony
>>
>> "Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de> wrote
>> in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
>>> False. I have tried
>>> This.Column(9).Addobject("check1","checkbox")
>>> This.Column(9).Activecontrol="check1"
>> Sorry, should have been CurrentControl
>>
>> Another thing you might want to set is
>> Column(9).Sparse = .F.
>>
>> Then you'll get a checkbox in every row, not only
>> the active row.
>>
>> Bye, Olaf.



Re: Trapping Mouse Click on a grid by TonySper

TonySper
Mon Jan 08 16:02:48 CST 2007

Dan,
"Born Dumb" sounds like me. I tried this

This.Columns(9).Sparse = .F.
THIS.Columns(9).ADDOBJECT("check1","checkbox")
THIS.Columns(9).CurrentControl="check1"
This.Columns(9).check1.Controlsource="invoice.prt_inv"

And I get this error.
"Parent object will not allow this property setting for
invoice_grid.header1.column9.check1.ControlSource".
Invoice_grid is the name of my form
Header1 is the name of the grid on the form
Invoice is the table name
Prt_inv is the field name and it is a logic filed.
I made the form both Model and Modeless, no luck.
Tony


"Dan Freeman" <spam@microsoft.com> wrote in message
news:OOl6dk2MHHA.4928@TK2MSFTNGP06.phx.gbl...
>> This.Columns(9).Sparse = .F.
>> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
>> THIS.Columns(9).CurrentControl="check1"
This.Columns(9).check1.Controlsource="table.fieldname"

The "auto" controls you have in the grid populate themselves when
instantiated. Any control you add later (such as you're doing here) is
"born
dumb". You have to tell it *everything*. <s>

Dan

TonySper wrote:
> Anders,
> I am still in the dark ages. How do I add a ControlSource to the
> Checkbox??
> Tony
>
> "Anders" <anders altberg> wrote in message
> news:uTKI9k0MHHA.4376@TK2MSFTNGP03.phx.gbl...
> Have you added a ControlSource for the Checkbox
> -Anders
>
> "TonySper" <tsperduti@nospambellsouth.net> wrote in message
> news:SSuoh.29036$%e7.27296@bignews2.bellsouth.net...
>> Olaf,
>> I am getting closer. I did
>> This.Columns(9).Sparse = .F.
>> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
>> THIS.Columns(9).CurrentControl="check1"
>> Now the grid comes up with the entire column with the field check
>> marked but clicking the mouse on them does not change them. They
>> all
>> stay checked.
>> How do I get the mouse click to toggle the check marks??
>> Thanks for all your help.
>> Tony
>>
>> "Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de>
>> wrote
>> in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
>>> False. I have tried
>>> This.Column(9).Addobject("check1","checkbox")
>>> This.Column(9).Activecontrol="check1"
>> Sorry, should have been CurrentControl
>>
>> Another thing you might want to set is
>> Column(9).Sparse = .F.
>>
>> Then you'll get a checkbox in every row, not only
>> the active row.
>>
>> Bye, Olaf.




Re: Trapping Mouse Click on a grid by Dan

Dan
Mon Jan 08 16:58:11 CST 2007

TonySper wrote:
> Dan,
> "Born Dumb" sounds like me. I tried this
>
> This.Columns(9).Sparse = .F.
> THIS.Columns(9).ADDOBJECT("check1","checkbox")
> THIS.Columns(9).CurrentControl="check1"
> This.Columns(9).check1.Controlsource="invoice.prt_inv"
>
> And I get this error.
> "Parent object will not allow this property setting for
> invoice_grid.header1.column9.check1.ControlSource".
> Invoice_grid is the name of my form
> Header1 is the name of the grid on the form

Odd name for a grid. They default to GridN (where N is a number). Each
Column does indeed contain a header and its name is by default Header1. So
if Header1 is *really* the name for your grid, it's a supremely bad choice.
<s>

Are you sure you've got the code in the *right* init? (You do know you can
drop the checkbox in the column in the designer, right? You could set this
up in the property sheet instead of in code that way.)

Modality won't have any effect here.

Dan

> Invoice is the table name
> Prt_inv is the field name and it is a logic filed.
> I made the form both Model and Modeless, no luck.
> Tony
>
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:OOl6dk2MHHA.4928@TK2MSFTNGP06.phx.gbl...
>>> This.Columns(9).Sparse = .F.
>>> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
>>> THIS.Columns(9).CurrentControl="check1"
> This.Columns(9).check1.Controlsource="table.fieldname"
>
> The "auto" controls you have in the grid populate themselves when
> instantiated. Any control you add later (such as you're doing here) is
> "born
> dumb". You have to tell it *everything*. <s>
>
> Dan
>
> TonySper wrote:
>> Anders,
>> I am still in the dark ages. How do I add a ControlSource to the
>> Checkbox??
>> Tony
>>
>> "Anders" <anders altberg> wrote in message
>> news:uTKI9k0MHHA.4376@TK2MSFTNGP03.phx.gbl...
>> Have you added a ControlSource for the Checkbox
>> -Anders
>>
>> "TonySper" <tsperduti@nospambellsouth.net> wrote in message
>> news:SSuoh.29036$%e7.27296@bignews2.bellsouth.net...
>>> Olaf,
>>> I am getting closer. I did
>>> This.Columns(9).Sparse = .F.
>>> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
>>> THIS.Columns(9).CurrentControl="check1"
>>> Now the grid comes up with the entire column with the field check
>>> marked but clicking the mouse on them does not change them. They
>>> all
>>> stay checked.
>>> How do I get the mouse click to toggle the check marks??
>>> Thanks for all your help.
>>> Tony
>>>
>>> "Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de>
>>> wrote
>>> in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
>>>> False. I have tried
>>>> This.Column(9).Addobject("check1","checkbox")
>>>> This.Column(9).Activecontrol="check1"
>>> Sorry, should have been CurrentControl
>>>
>>> Another thing you might want to set is
>>> Column(9).Sparse = .F.
>>>
>>> Then you'll get a checkbox in every row, not only
>>> the active row.
>>>
>>> Bye, Olaf.



Re: Trapping Mouse Click on a grid by TonySper

TonySper
Mon Jan 08 17:59:30 CST 2007

Dan,
I changed the name of the grid to HARVEY but still get the error. I
can bring up the form with the grid by ignoring the error and the
checkboxes are marked when the field is T and unmarked when the field
is F. but still can not toggle them with the mouse. Have put the code
in the form init and the grid init, same problem. Thanks for all you
help. Think I will just say type in the T or F and live with it.
Thanks to all of you for the suggestions and the help. Dan has a good
name for me, "Born Dumb".
Tony

"Dan Freeman" <spam@microsoft.com> wrote in message
news:OnZS5h3MHHA.2456@TK2MSFTNGP06.phx.gbl...
TonySper wrote:
> Dan,
> "Born Dumb" sounds like me. I tried this
>
> This.Columns(9).Sparse = .F.
> THIS.Columns(9).ADDOBJECT("check1","checkbox")
> THIS.Columns(9).CurrentControl="check1"
> This.Columns(9).check1.Controlsource="invoice.prt_inv"
>
> And I get this error.
> "Parent object will not allow this property setting for
> invoice_grid.header1.column9.check1.ControlSource".
> Invoice_grid is the name of my form
> Header1 is the name of the grid on the form

Odd name for a grid. They default to GridN (where N is a number). Each
Column does indeed contain a header and its name is by default
Header1. So
if Header1 is *really* the name for your grid, it's a supremely bad
choice.
<s>

Are you sure you've got the code in the *right* init? (You do know you
can
drop the checkbox in the column in the designer, right? You could set
this
up in the property sheet instead of in code that way.)

Modality won't have any effect here.

Dan

> Invoice is the table name
> Prt_inv is the field name and it is a logic filed.
> I made the form both Model and Modeless, no luck.
> Tony
>
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:OOl6dk2MHHA.4928@TK2MSFTNGP06.phx.gbl...
>>> This.Columns(9).Sparse = .F.
>>> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
>>> THIS.Columns(9).CurrentControl="check1"
> This.Columns(9).check1.Controlsource="table.fieldname"
>
> The "auto" controls you have in the grid populate themselves when
> instantiated. Any control you add later (such as you're doing here)
> is
> "born
> dumb". You have to tell it *everything*. <s>
>
> Dan
>
> TonySper wrote:
>> Anders,
>> I am still in the dark ages. How do I add a ControlSource to the
>> Checkbox??
>> Tony
>>
>> "Anders" <anders altberg> wrote in message
>> news:uTKI9k0MHHA.4376@TK2MSFTNGP03.phx.gbl...
>> Have you added a ControlSource for the Checkbox
>> -Anders
>>
>> "TonySper" <tsperduti@nospambellsouth.net> wrote in message
>> news:SSuoh.29036$%e7.27296@bignews2.bellsouth.net...
>>> Olaf,
>>> I am getting closer. I did
>>> This.Columns(9).Sparse = .F.
>>> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
>>> THIS.Columns(9).CurrentControl="check1"
>>> Now the grid comes up with the entire column with the field check
>>> marked but clicking the mouse on them does not change them. They
>>> all
>>> stay checked.
>>> How do I get the mouse click to toggle the check marks??
>>> Thanks for all your help.
>>> Tony
>>>
>>> "Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de>
>>> wrote
>>> in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
>>>> False. I have tried
>>>> This.Column(9).Addobject("check1","checkbox")
>>>> This.Column(9).Activecontrol="check1"
>>> Sorry, should have been CurrentControl
>>>
>>> Another thing you might want to set is
>>> Column(9).Sparse = .F.
>>>
>>> Then you'll get a checkbox in every row, not only
>>> the active row.
>>>
>>> Bye, Olaf.




Re: Trapping Mouse Click on a grid by TonySper

TonySper
Mon Jan 08 18:29:01 CST 2007

On the grid.columns.field.
Tony

"Man-wai Chang" <toylet.toylet@gmail.com> wrote in message
news:O4MskByMHHA.2232@TK2MSFTNGP02.phx.gbl...
TonySper wrote:
> Is there a way to trap a mouse click on a grid so as to make that
> field True or False??
> I have a grid on a form that allows the user to change a columns
> field
> value to either True or False by typing either a T or F on that
> field.
> The user wants to just be able to click his mouse on the field to
> flip
> it from T to F and Back.

Are you trying to click on the grid or grid.columns[x].textbox? They
are
different. To click on the grid, you need to have an used area in the
leftmost area of the grid.


--
.~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10) Linux 2.6.19.1
^ ^ 20:26:01 up 27 days 2:38 0 users load average: 1.00 1.01 1.00
news://news.3home.net news://news.hkpcug.org
news://news.newsgroup.com.hk



Re: Trapping Mouse Click on a grid by Anders

Anders
Mon Jan 08 19:53:09 CST 2007

No that's not what I mean. The Grid has a RecordSource, which is the name of
a table, a view, or a cursor. Each grid column has a ControlSource property
which contains the name of the field in the recordsource that populates the
column. Each control, normally a textbox, also has a ControlSource property,
always by default the same as the Grid.Column.ControlSource. These are as a
rule assigned automatically when the RecordSource has been set. From the top
you would than say:
Thisform.Grid1.Column9.Check1.ControlSource = 'invoice.inv_prt' or whatever
the field is named.
Whatever posessed you to call a grid 'Header1'?
By the way, there are standards in VFP programming for naming controls,
objects, and variables.
Se the Help index for: Naming conventions - objects.
-Anders

"TonySper" <tsperduti@nospambellsouth.net> wrote in message
news:mlyoh.20615$_X.9057@bigfe9...
> Anders,
> If you mean RecordSource, yes, I have this set to the name of the
> table that I open before I call the form.
> Tony
>
> "Anders" <anders altberg> wrote in message
> news:uTKI9k0MHHA.4376@TK2MSFTNGP03.phx.gbl...
> Have you added a ControlSource for the Checkbox
> -Anders
>
> "TonySper" <tsperduti@nospambellsouth.net> wrote in message
> news:SSuoh.29036$%e7.27296@bignews2.bellsouth.net...
> > Olaf,
> > I am getting closer. I did
> > This.Columns(9).Sparse = .F.
> > THIS.Columns(9).ADDOBJECT("Check1","checkbox")
> > THIS.Columns(9).CurrentControl="check1"
> > Now the grid comes up with the entire column with the field check
> > marked but clicking the mouse on them does not change them. They all
> > stay checked.
> > How do I get the mouse click to toggle the check marks??
> > Thanks for all your help.
> > Tony
> >
> > "Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de> wrote
> > in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
> > > False. I have tried
> > > This.Column(9).Addobject("check1","checkbox")
> > > This.Column(9).Activecontrol="check1"
> > Sorry, should have been CurrentControl
> >
> > Another thing you might want to set is
> > Column(9).Sparse = .F.
> >
> > Then you'll get a checkbox in every row, not only
> > the active row.
> >
> > Bye, Olaf.
> >
> >
> >
> >
>
>
>



Re: Trapping Mouse Click on a grid by TonySper

TonySper
Mon Jan 08 21:41:04 CST 2007

Anders,
Thanks for the help and info. When I created the grid on the form it
named it Header1 and I just left it like that. I have changed the name
of the grid to HARVEY now and still trying to get it to work. From
what you are saying I should be putting all this info in the Form init
not the grid init like I have been doing. You have given me a lot to
look into and I will have to do some more reading on this. I just
about have given this up but after reading your comments I will try
some more.
Thanks.
Tony

"Anders" <anders altberg> wrote in message
news:uhlHu74MHHA.2028@TK2MSFTNGP03.phx.gbl...
No that's not what I mean. The Grid has a RecordSource, which is the
name of
a table, a view, or a cursor. Each grid column has a ControlSource
property
which contains the name of the field in the recordsource that
populates the
column. Each control, normally a textbox, also has a ControlSource
property,
always by default the same as the Grid.Column.ControlSource. These are
as a
rule assigned automatically when the RecordSource has been set. From
the top
you would than say:
Thisform.Grid1.Column9.Check1.ControlSource = 'invoice.inv_prt' or
whatever
the field is named.
Whatever posessed you to call a grid 'Header1'?
By the way, there are standards in VFP programming for naming
controls,
objects, and variables.
Se the Help index for: Naming conventions - objects.
-Anders

"TonySper" <tsperduti@nospambellsouth.net> wrote in message
news:mlyoh.20615$_X.9057@bigfe9...
> Anders,
> If you mean RecordSource, yes, I have this set to the name of the
> table that I open before I call the form.
> Tony
>
> "Anders" <anders altberg> wrote in message
> news:uTKI9k0MHHA.4376@TK2MSFTNGP03.phx.gbl...
> Have you added a ControlSource for the Checkbox
> -Anders
>
> "TonySper" <tsperduti@nospambellsouth.net> wrote in message
> news:SSuoh.29036$%e7.27296@bignews2.bellsouth.net...
> > Olaf,
> > I am getting closer. I did
> > This.Columns(9).Sparse = .F.
> > THIS.Columns(9).ADDOBJECT("Check1","checkbox")
> > THIS.Columns(9).CurrentControl="check1"
> > Now the grid comes up with the entire column with the field check
> > marked but clicking the mouse on them does not change them. They
> > all
> > stay checked.
> > How do I get the mouse click to toggle the check marks??
> > Thanks for all your help.
> > Tony
> >
> > "Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de>
> > wrote
> > in message news:Oynzv5xMHHA.1240@TK2MSFTNGP03.phx.gbl...
> > > False. I have tried
> > > This.Column(9).Addobject("check1","checkbox")
> > > This.Column(9).Activecontrol="check1"
> > Sorry, should have been CurrentControl
> >
> > Another thing you might want to set is
> > Column(9).Sparse = .F.
> >
> > Then you'll get a checkbox in every row, not only
> > the active row.
> >
> > Bye, Olaf.
> >
> >
> >
> >
>
>
>




Re: Trapping Mouse Click on a grid by Olaf

Olaf
Tue Jan 09 02:28:13 CST 2007

> Olaf,
> I am getting closer. I did
> This.Columns(9).Sparse = .F.
> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
> THIS.Columns(9).CurrentControl="check1"
> Now the grid comes up with the entire column with the field check
> marked but clicking the mouse on them does not change them. They all
> stay checked.

Oh my god, sorry.

THIS.Column(9).Check1.Visible=.T. will help!

If you use AddObject, objects are by default invisible,
which let's you set top and left etc. without all that causing
flickering on the form. That is okay for controls added to
the form or a pageframe or container or so.

But the grid has the bug to paint these invisible added
controls nevertheless, I'm already too used to it.

So the one thing you need to add is

THIS.Column(9).Check1.Visible=.T.

and then it will be "more visible". That is, it will be
usable.

Not atall being related to be "born dumb", it's
born "invisibly visible" or so ;-).

The Check1.Controlsource will follow the Column(9).
Controlsource automatically anyway, even though the
control was added after setting the grids recordsource,
the error tells you mainly to leave that as is, and as you
said it works, you see checkboxes checked and
unchecked.

Bye, Olaf.

Re: Trapping Mouse Click on a grid by Anders

Anders
Tue Jan 09 06:18:19 CST 2007

The Grid.Init event is a perfectly good place to put your code, technically.
The Grid.Init occurs after all the columns (and their Init events) has taken
place. The Form.Init event is the very last Init event to occur , after each
contained object's Init.
I wrote Thisform.Grid1.Column9.Check1.ControlSource = 'invoice.inv_prt'
as an example of a common object hierarchy. The grid can of course live in a
container, or pageframe.page, on the form, and you would have a different
hierarchy.
If the Grid's name ( the Name property's assigned custom value) now has
been changed to Harvey. it would be
Thisform.Harvey.Column9.Check1.ControlSource = 'invoice.inv_prt'
Using VFP naming conventions, and properly naming all your objects to show
what kind of object it is and what it does:
Thisform.grdInvoices.grcInv_ptr.chkInv_ptr.ControlSource = 'Inv_ptr'
If placed in the grid's Init event code, which has practical advantages
With This
.grcInv_ptr.chkInv_ptr.ControlSource = 'Inv_ptr'
Endwith

If the Grid later would be moved somewhere else or saved to a class, the
Init Code would accompany it.
Another developer working on the same Grid would more easily find the code
if it is in the Grid's Init.

-Anders

"TonySper" <tsperduti@nospambellsouth.net> wrote in message
news:k9Eoh.29690$h_1.1973@bignews6.bellsouth.net...
> Anders,
> Thanks for the help and info. When I created the grid on the form it
> named it Header1 and I just left it like that. I have changed the name
> of the grid to HARVEY now and still trying to get it to work. From
> what you are saying I should be putting all this info in the Form init
> not the grid init like I have been doing. You have given me a lot to
> look into and I will have to do some more reading on this. I just
> about have given this up but after reading your comments I will try
> some more.
> Thanks.
> Tony
>



Re: Trapping Mouse Click on a grid by Bernhard

Bernhard
Tue Jan 09 06:47:51 CST 2007

Hi Tony

> This.Columns(9).Sparse = .F.
> THIS.Columns(9).ADDOBJECT("check1","checkbox")
> THIS.Columns(9).CurrentControl="check1"
> This.Columns(9).check1.Controlsource="invoice.prt_inv"
>
> And I get this error.
> "Parent object will not allow this property setting for
> invoice_grid.header1.column9.check1.ControlSource".
I also stumpled once over this error message.

Reason: a column has the property .Bound. If it is set to .T. this error appears
when you try to set the controlsource of a contained control.
Bound determins, whether the controls inside a column can have own
controlsources (.F.) or whether all contained controls are bound to the
controlsource of the column (.T.)

Solution:
either set
this.column(9).Bound = .F.
This.Columns(9).check1.Controlsource="invoice.prt_inv"

or set the controlsource of the column instead of the control:
this.column(9).ControlSource = "invoice.prg_inv"

btw, do you have the help file not installed? Searching in help for your error
message would tell you exactly the above.
Maybe have a closer look into the help file on more info about the grid class
and column class.
I admit, handling the grid is not very easy. It needs a couple of reading and a
lot of testing.

Regards
Bernhard Sander

Re: Trapping Mouse Click on a grid by TonySper

TonySper
Tue Jan 09 08:43:10 CST 2007

Bernhard,
Thanks for the explanations. I will give it a try and see what
happens. I think all in all I have goofed this up way beyond me but
with all the help from you and others maybe I will learn something,
(READ THE HELP FILE). My problem is I have a hard time understanding
it sometimes.
Tony

"Bernhard Sander" <fuchs@no.spam> wrote in message
news:OVBlfx%23MHHA.2028@TK2MSFTNGP03.phx.gbl...
Hi Tony

> This.Columns(9).Sparse = .F.
> THIS.Columns(9).ADDOBJECT("check1","checkbox")
> THIS.Columns(9).CurrentControl="check1"
> This.Columns(9).check1.Controlsource="invoice.prt_inv"
>
> And I get this error.
> "Parent object will not allow this property setting for
> invoice_grid.header1.column9.check1.ControlSource".
I also stumpled once over this error message.

Reason: a column has the property .Bound. If it is set to .T. this
error appears
when you try to set the controlsource of a contained control.
Bound determins, whether the controls inside a column can have own
controlsources (.F.) or whether all contained controls are bound to
the
controlsource of the column (.T.)

Solution:
either set
this.column(9).Bound = .F.
This.Columns(9).check1.Controlsource="invoice.prt_inv"

or set the controlsource of the column instead of the control:
this.column(9).ControlSource = "invoice.prg_inv"

btw, do you have the help file not installed? Searching in help for
your error
message would tell you exactly the above.
Maybe have a closer look into the help file on more info about the
grid class
and column class.
I admit, handling the grid is not very easy. It needs a couple of
reading and a
lot of testing.

Regards
Bernhard Sander



Re: Trapping Mouse Click on a grid by TonySper

TonySper
Tue Jan 09 08:50:19 CST 2007

Anders,
Great lesson. Will remember this next time. It sure looks like it
would help.
Tony

"Anders" <anders altberg> wrote in message
news:eZRC6Y%23MHHA.3552@TK2MSFTNGP03.phx.gbl...
The Grid.Init event is a perfectly good place to put your code,
technically.
The Grid.Init occurs after all the columns (and their Init events) has
taken
place. The Form.Init event is the very last Init event to occur ,
after each
contained object's Init.
I wrote Thisform.Grid1.Column9.Check1.ControlSource =
'invoice.inv_prt'
as an example of a common object hierarchy. The grid can of course
live in a
container, or pageframe.page, on the form, and you would have a
different
hierarchy.
If the Grid's name ( the Name property's assigned custom value) now
has
been changed to Harvey. it would be
Thisform.Harvey.Column9.Check1.ControlSource = 'invoice.inv_prt'
Using VFP naming conventions, and properly naming all your objects to
show
what kind of object it is and what it does:
Thisform.grdInvoices.grcInv_ptr.chkInv_ptr.ControlSource = 'Inv_ptr'
If placed in the grid's Init event code, which has practical
advantages
With This
.grcInv_ptr.chkInv_ptr.ControlSource = 'Inv_ptr'
Endwith

If the Grid later would be moved somewhere else or saved to a class,
the
Init Code would accompany it.
Another developer working on the same Grid would more easily find the
code
if it is in the Grid's Init.

-Anders

"TonySper" <tsperduti@nospambellsouth.net> wrote in message
news:k9Eoh.29690$h_1.1973@bignews6.bellsouth.net...
> Anders,
> Thanks for the help and info. When I created the grid on the form it
> named it Header1 and I just left it like that. I have changed the
> name
> of the grid to HARVEY now and still trying to get it to work. From
> what you are saying I should be putting all this info in the Form
> init
> not the grid init like I have been doing. You have given me a lot to
> look into and I will have to do some more reading on this. I just
> about have given this up but after reading your comments I will try
> some more.
> Thanks.
> Tony
>




Re: Trapping Mouse Click on a grid by TonySper

TonySper
Tue Jan 09 08:53:17 CST 2007

Olaf,
Thanks again. Will keep trying. Need a brain rest for a while.
Tony

"Olaf Doschke"
<b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU.strconv.14@t-online.de> wrote in
message news:envjmt$vr0$00$1@news.t-online.com...
> Olaf,
> I am getting closer. I did
> This.Columns(9).Sparse = .F.
> THIS.Columns(9).ADDOBJECT("Check1","checkbox")
> THIS.Columns(9).CurrentControl="check1"
> Now the grid comes up with the entire column with the field check
> marked but clicking the mouse on them does not change them. They all
> stay checked.

Oh my god, sorry.

THIS.Column(9).Check1.Visible=.T. will help!

If you use AddObject, objects are by default invisible,
which let's you set top and left etc. without all that causing
flickering on the form. That is okay for controls added to
the form or a pageframe or container or so.

But the grid has the bug to paint these invisible added
controls nevertheless, I'm already too used to it.

So the one thing you need to add is

THIS.Column(9).Check1.Visible=.T.

and then it will be "more visible". That is, it will be
usable.

Not atall being related to be "born dumb", it's
born "invisibly visible" or so ;-).

The Check1.Controlsource will follow the Column(9).
Controlsource automatically anyway, even though the
control was added after setting the grids recordsource,
the error tells you mainly to leave that as is, and as you
said it works, you see checkboxes checked and
unchecked.

Bye, Olaf.



Re: Trapping Mouse Click on a grid by Dan

Dan
Tue Jan 09 10:54:25 CST 2007

Don't worry. We all have that problem from time to time.

Dan

TonySper wrote:
> Bernhard,
> Thanks for the explanations. I will give it a try and see what
> happens. I think all in all I have goofed this up way beyond me but
> with all the help from you and others maybe I will learn something,
> (READ THE HELP FILE). My problem is I have a hard time understanding
> it sometimes.
> Tony
>
> "Bernhard Sander" <fuchs@no.spam> wrote in message
> news:OVBlfx%23MHHA.2028@TK2MSFTNGP03.phx.gbl...
> Hi Tony
>
>> This.Columns(9).Sparse = .F.
>> THIS.Columns(9).ADDOBJECT("check1","checkbox")
>> THIS.Columns(9).CurrentControl="check1"
>> This.Columns(9).check1.Controlsource="invoice.prt_inv"
>>
>> And I get this error.
>> "Parent object will not allow this property setting for
>> invoice_grid.header1.column9.check1.ControlSource".
> I also stumpled once over this error message.
>
> Reason: a column has the property .Bound. If it is set to .T. this
> error appears
> when you try to set the controlsource of a contained control.
>