Author: A Hilton
Posted: 2000-09-01 at 09:52:29
Thanks. Neat idea but it didn't work.
Never could get the dynamiccurrentcontrol (there is no
dynamiccurrentcontrolsource) to work at all. I tried both calling a
procedure and an iif() function but neither worked. I even tried a very
simple test of a default grid baseclass with just a test free table and
putting another textbox in a column (giving 2 textboxes total) and trying a
dynamiccurrentcontrol on that but it didn't work either. It either gave me
the textbox1 or nothing at all. I'm sure it's something I'm just not setting
correctly. I even tried some grids' setall() methods (I've done that
extensively with dynamicbackgroundcolor,etc. and it's worked well for me
with multiple columns) to see if I could go around that way but, still, no
luck.
As a side note, having another container class and using the
dynamiccurrentcontrol (which didn't show any difference as stated above)
slowed that form down around 15-20% on browsing/navigating the records and
that wouldn't have worked anyway even if it had worked as I wanted. Another
problem I had was removing the second object in the column. It simply would
not be removed/destroyed. I could remove the first (original) container
class by simply doing something like:
thisform.grid.column.removeobject("mycontainer1")
but never could get the second container object removed by any means.
Strange. I'll have to play with that some other time though.
Thanks again for the idea.
- A Hilton
> Not so quick; check out my "DynamicCurrentControlSource" article
> in FoxPro
> Advisor / February 2000 issue. The gist is to have two (2)
> separate controls
> in your column, the only difference being the red label in one of
> them. Set
> the column's Bound property to .F. and ResetToDefault() the column's
> ControlSource (so that's it not set). Then set the ControlSource
> for each
> control (i.e., the two [2] instances of your container] within
> the column.
> Finally, at the end of your grid's Init() event/method, set Column1's
> DynamicCurrentControl property by calling a custom
> "DynamicCurrentControl()"
> method in which you place your If logic (alternatively, you can employ Do
> Case logic if/when you have more than 2 cases) to determine which
> control to
> display when.
>
> (BTW, you can also set the DynamicCurrentControl property with an IIf
> statement but I find it a *ton* easier to debug If and Do Case
> constructs in
> a method than IIf methods *especially* when you have more than 2 cases.)
>
> HTH,
>
> Art Bergquist
> abergquis@cs.com
>