Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid seems to loose track of what row it´s on (VFP6 /SP3
Message
From
06/07/2000 08:16:42
 
 
To
03/07/2000 08:19:32
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00387036
Message ID:
00388781
Views:
12
Bill,

Unfortunately it aint that easy, ´cause if it were I would have figured it out myself. You see, your solution will correctly disable the spinner, it will also correctly enable the spinner in another, checked row, but you wont be able to spin the thing until you have moved to yet another checked row.

I have been fiddeling with this problem of and on for a while now, and lo and behold, there is a solution!

BTW, MS has acknowledged to be a bug, and they have helped out with a workaround.

Here it comes: In the AfterRowColChange method

LPARAMETERS nColIndex
*
* The grid has trouble keeping track of which row it´s at in calculations
* Therefore the following loop is highly reccomended i a grids base class

FOR i=1 TO THIS.COLUMNCOUNT
THIS.COLUMNS(i).CONTROLSOURCE=THIS.COLUMNS(i).CONTROLSOURCE
ENDFOR

THISFORM.LOCKSCREEN=.T.

* Moving from the active cell and back again
THIS.ACTIVATECELL(THIS.ACTIVEROW,1)
THIS.ACTIVATECELL(THIS.ACTIVEROW,nColIndex)

* Set ENABLED/DISABLED, no need for if´s here
THIS.COLUMNS(2).SPINNER1.ENABLED=THIS.COLUMNS(1).CHECK1.VALUE

* And again
THIS.ACTIVATECELL(THIS.ACTIVEROW,1)
THIS.ACTIVATECELL(THIS.ACTIVEROW,nColIndex)

THIS.REFRESH
THISFORM.LOCKSCREEN=.F.



>>Quite possibly, but how?
>>
>>Peter
>
>Hi Peter,
>
>As a simple test I created a table with a logical field and an integer field to bind to the check box and the spinner in the grid. I then created a form, placed a grid on the form, placed a check box in column 1 and a spinner in column 2 making the check box the CurrentControl of column 1 and the spinner the CurrentControl of column 2. I set the Sparse property of column 1 to .F. so all the check boxes would show.
>
>In the grid's AfterRowColChange event I placed the following code:
>
>IF MyTable.check    && "check" is the logical field name
>    THIS.COLUMN2.SPINNER1.ENABLED = .T.
>ELSE
>    THIS.COLUMN2.SPINNER1.ENABLED = .F.
>ENDIF
>In the check box's Click event I placed the following code:
>
>IF THIS.VALUE
>    THIS.PARENT.PARENT.COLUMN2.SPINNER1.ENABLED = .T.
>ELSE
>    THIS.PARENT.PARENT.COLUMN2.SPINNER1.ENABLED = .F.
>ENDIF
>
>I believe this gave the basic behavior you are looking for. Now this was just a quick example. You would probably need to experiment and adjust settings to get the details of how you want it to work ironed out.
>
>Bill
Peter Pirker


Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?

(Woody Allen)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform