Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insertion point disappears when DynamicCurrentControl is present

Status
Not open for further replies.

darrellblackhawk

Programmer
Aug 30, 2002
846
US
Hello:

I've got an interesting problem that hopefully someone has
encountered already.

I have a grid on a form with 3 columns.
The columns types are: DateTime, Text, and Date.

In the init() method of the grid I have the following code:
[tt]
This.ADDPROPERTY("aDeletedRecs[1,1]",0)
This.addproperty("nDeletedRecs",0)
This.addproperty("nCurRec",1)
This.addproperty("nStartUp",0)

This.SetAll("DynamicBackColor", ;
"IIF(recno(this.recordsource)==this.nCurRec, RGB(0,255,0), RGB(255,255,255))", "Column")

This.SetAll("DynamicForeColor", ;
"IIF(recno(this.recordsource)==this.nCurRec, RGB(255,0,0), RGB(0,0,0))", "Column")

this.columns(3).DynamicCurrentControl = "Thisform.SetExtraDate(eval(this.columns(2).controlsource))"
[/tt]

The first two dynamic column properties just set the
foreground and background of the current grid row.

The last dynamic property calls on a form method
(SetExtraDate()) that determines if the value contained
in column2 is of a certain class of values and switches
the column3 control to either text1 or nothing.

This all works perfectly and is very fast.

The problem is when the DynamicCurrentControl property is
used and the textbox in column3 gets the focus, the
insertion point is invisible but otherwise the control
behaves normally.

I wrote a function that gathers all of the properties of
both the column and the textbox before and after the
DynamicCurrentControl property is defined, but there is
nothing different; other than the DynamicCurrentControl
property.

Any ideas?

Darrell
 
I fixed the problem by setting the sparse property to .f.,
but I'd rather understand exactly what was going on.

Darrell
 
So would I Darrell, saw your post but I couldn't think of anything that would cause the insertion point to completely disappear. Odd that setting sparse to .F. would solve it.

I was thinking that maybe you needed to Set Cursor On or something to work around the problem, but I wasn't sure and I didn't have the time to reproduce the problem. Glad you solved it and hopefully someone knows the why of it.

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
I was thinking of trying "Set Cursor On" when the control
got the focus, but it just didn't make sense that it
should disappear. The other controls don't exhibit this
problem - of course they don't have a DynamicCurrentControl
setting in their containing column.

It maybe because I'm setting the Current Control to nothing
when the contents of column2 meet certain criteria.

I'll add a second control temporarily when I finish the
other sections and have the SetExtraDate() method
set the current control to that to see what happens.


Darrell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top