Re: Grids - DynamicCurrentControl by Rush
Rush
Mon Oct 01 16:28:54 PDT 2007
This is a multi-part message in MIME format.
--------------050802070203010209000206
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Well, now we're getting somewhere! Set the .controlsource property for
the textbox and checkbox to the desired fields, and, in the column, set:
.controlsource to (none)
.sparse to .F.
.bound to .F.
That should do it for you.
- Rush
Dan Tallent wrote:
> Exactly. I was looking for some method that would let me link the
> checkbox to a separate field in the table.
>
> At this point, I have a combo box swapping in where I would of used a
> checkbox. The user can pick between three
> values: blank, checked, unchecked.
>
> I was just hoping that someone found a way to have some rows using a
> checkbox so it would be easier for my users.
>
> Thanks
> dan
>
>
>
> "Rush Strong" <rpstrong@gmail.com <mailto:rpstrong@gmail.com>>
> wrote in message news:MG8Mi.3386$Hb2.3190@trndny07...
> A checkbox can have either numeric or logical values - not text.
> What are your expected values?
>
> - Rush
>
> Dan Tallent wrote:
>> I am getting the same problem I was having... Data Type mismatch.
>>
>> Any idea what I am doing differently?
>>
>> Created a form, added a grid. Added the checkbox control to second column.
>> In the code, I create a cursor with 3 fields
>> Create cursor temp1 ;
>> (cName c(30), cValue c(30), ControlType n(1))
>>
>> select temp1
>> append blank
>> replace temp1.cName with "Test Line 1"
>> replace temp1.cValue with ""
>> replace temp1.cControlType with 1
>>
>> select temp1
>> append blank
>> replace temp1.cName with "Test Line 1"
>> replace temp1.cValue with ""
>> replace temp1.cControlType with 2
>>
>> select temp1
>> append blank
>> replace temp1.cName with "Test Line 1"
>> replace temp1.cValue with ""
>> replace temp1.cControlType with 1
>>
>> thisform.Grid1.recordsourcetype = 1
>> thisform.Grid1.recordsource = "Temp1"
>> thisform.Grid1.column1.controlsource = "Temp1.cName"
>> thisform.Grid1.column2.controlsource = "Temp1.cValue"
>>
>> thisform.Grid1.column2.DynamicCurrentControl = "iif(Temp1.ControlType =
>> 1,'Text1','Check1')"
>>
>> Thanks
>> Dan
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> "Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
>> news:rsuqf3hrt9lg33n66e2v6u5u271jkkjigr@4ax.com...
>>
>>> On Fri, 28 Sep 2007 14:34:04 -0400, "Dan Tallent" <spam@microsoft.com>
>>> wrote:
>>>
>>>
>>>> I am trying to create a grid to work something like this:
>>>>
>>>> The grid would have 2 columns. The first column is always a textbox that
>>>> contains the property name. The second
>>>> column will allow the user to enter whatever value they wish for each
>>>> property. I want to swap out the control for this second column
>>>>
>>> >from a textbox to a checkbox. Some of the properties are Yes/No and
>>>
>>>> some
>>>> are just a character field.
>>>>
>>>> Has anyone been able to do this? and if so, how?
>>>>
>>> Add a checkbox control to the second column. In the designer, with
>>> the grid being edited drop a checkbox onto column 2.
>>>
>>> Set the second column's DynamicCurrentControl to a text string
>>> containing an expression that selects the proper control.
>>>
>>> For example, if the grid's rowsource cursor has a field 'controltype'
>>> whose value is 0 for rows that should have a textbox and 1 for rows
>>> that should have a checkbox, and the textbox in the column is named
>>> text1 and the checkbox is named checkbox1:
>>>
>>> Thisform.Grid.Column2.DynamicCurrentControl =
>>> "IIF(controltype==0,"text1","checkbox1")"
>>>
>>> If you have a complex expression it is usually better to create a form
>>> method that does the calculation and returns the text string
>>> containing the expression and then:
>>>
>>> Thisform.Grid.Column2.DynamicCurrentControl =
>>> "Thisform.GetCol2CurrentControl()"
>>>
>>
>>
>>
>
--------------050802070203010209000206
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Well, now we're getting somewhere! Set the .controlsource property for
the textbox and checkbox to the desired fields, and, in the column, set:<br>
<br>
.controlsource to (none)<br>
.sparse to .F.<br>
.bound to .F.<br>
<br>
That should do it for you.<br>
<br>
- Rush<br>
<br>
Dan Tallent wrote:
<blockquote cite="mid:%23LxxGAHBIHA.4612@TK2MSFTNGP03.phx.gbl"
type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.6000.16525" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">Exactly. I was looking for some
method that would let me link the checkbox to a separate field in the
table.</font></div>
<div> </div>
<div><font face="Arial" size="2">At this point, I have a combo box
swapping in where I would of used a checkbox. The user can pick
between three</font></div>
<div><font face="Arial" size="2">values: blank, checked, unchecked.</font></div>
<div> </div>
<div><font face="Arial" size="2">I was just hoping that someone found
a way to have some rows using a checkbox so it would be easier for my
users.</font></div>
<div> </div>
<div><font face="Arial" size="2">Thanks</font></div>
<div><font face="Arial" size="2">dan</font></div>
<div> </div>
<div> </div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Rush Strong" <<a moz-do-not-send="true"
href="mailto:rpstrong@gmail.com">rpstrong@gmail.com</a>> wrote in
message <a moz-do-not-send="true"
href="news:MG8Mi.3386$Hb2.3190@trndny07">news:MG8Mi.3386$Hb2.3190@trndny07</a>...</div>
A checkbox can have either numeric or logical values - not text. What
are your expected values?<br>
<br>
- Rush<br>
<br>
Dan Tallent wrote:
<blockquote cite="mid:Oq09vnDBIHA.4568@TK2MSFTNGP02.phx.gbl"
type="cite">
<pre wrap="">I am getting the same problem I was having... Data Type mismatch.
Any idea what I am doing differently?
Created a form, added a grid. Added the checkbox control to second column.
In the code, I create a cursor with 3 fields
Create cursor temp1 ;
(cName c(30), cValue c(30), ControlType n(1))
select temp1
append blank
replace temp1.cName with "Test Line 1"
replace temp1.cValue with ""
replace temp1.cControlType with 1
select temp1
append blank
replace temp1.cName with "Test Line 1"
replace temp1.cValue with ""
replace temp1.cControlType with 2
select temp1
append blank
replace temp1.cName with "Test Line 1"
replace temp1.cValue with ""
replace temp1.cControlType with 1
thisform.Grid1.recordsourcetype = 1
thisform.Grid1.recordsource = "Temp1"
thisform.Grid1.column1.controlsource = "Temp1.cName"
thisform.Grid1.column2.controlsource = "Temp1.cValue"
thisform.Grid1.column2.DynamicCurrentControl = "iif(Temp1.ControlType =
1,'Text1','Check1')"
Thanks
Dan
"Jack Jackson" <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="mailto:jacknospam@pebbleridge.com"><jacknospam@pebbleridge.com></a> wrote in message
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="news:rsuqf3hrt9lg33n66e2v6u5u271jkkjigr@4ax.com">news:rsuqf3hrt9lg33n66e2v6u5u271jkkjigr@4ax.com</a>...
</pre>
<blockquote type="cite">
<pre wrap="">On Fri, 28 Sep 2007 14:34:04 -0400, "Dan Tallent" <a
moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="mailto:spam@microsoft.com"><spam@microsoft.com></a>
wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I am trying to create a grid to work something like this:
The grid would have 2 columns. The first column is always a textbox that
contains the property name. The second
column will allow the user to enter whatever value they wish for each
property. I want to swap out the control for this second column
</pre>
</blockquote>
<pre wrap="">>from a textbox to a checkbox. Some of the properties are Yes/No and
</pre>
<blockquote type="cite">
<pre wrap="">some
are just a character field.
Has anyone been able to do this? and if so, how?
</pre>
</blockquote>
<pre wrap="">Add a checkbox control to the second column. In the designer, with
the grid being edited drop a checkbox onto column 2.
Set the second column's DynamicCurrentControl to a text string
containing an expression that selects the proper control.
For example, if the grid's rowsource cursor has a field 'controltype'
whose value is 0 for rows that should have a textbox and 1 for rows
that should have a checkbox, and the textbox in the column is named
text1 and the checkbox is named checkbox1:
Thisform.Grid.Column2.DynamicCurrentControl =
"IIF(controltype==0,"text1","checkbox1")"
If you have a complex expression it is usually better to create a form
method that does the calculation and returns the text string
containing the expression and then:
Thisform.Grid.Column2.DynamicCurrentControl =
"Thisform.GetCol2CurrentControl()"
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>
--------------050802070203010209000206--