Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Container in a grid
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00496243
Message ID:
00496710
Views:
16
>Hi Nadya
>
>I am a bit confused .
>Sorry to trouble you but ...
>Do i post or not ?
>Sorry again

Hi Hiten,

Seems like Cetin's "Images, containers in grid" August 9, 2000 04:45 FAQ #7934
covers this already, though without Larry's suggestion, therefore I think, this FAQ is not needed as a new one. Cetin may update his FAQ with these additions. Sorry, I should have checked FAQ section by myself before making this suggestion. Sometimes, there are excellent ideas, which seem to be good for FAQ, but then we can find out, that it was already written few years ago.

>
>>>Check out Cetin Basoz FAQ titled "Images, containers in grid" for this exact technique. You don't need to add it again.
>>>
>>
>>Thanks, Larry. Disregard this request, Hiten.
>>
>>>>Hi Hiten,
>>>>
>>>>Yes, that's exactly what would be very helpful in the FAQ section. Just don't forget to add formatting around the code < pre > tags and give a link for both threads.
>>>>
>>>>Thanks in advance.
>>>>
>>>>>Hi Nadya
>>>>>Please go throu the FAQ u told me to write ..
>>>>>
>>>>>* FAQ start ->
>>>>>
>>>>>Hello there.
>>>>>
>>>>>I am sure many a times VFP users have felt the need to put a Container control in a grid control or maybe show an image in the grid column. All this works fine but what if you wanted to change properties of a control in the container depending on conditions in the underlying table.
>>>>>
>>>>>Let's take an example.
>>>>>We have a table with the following structure ..
>>>>>
>>>>>tblProducts
>>>>>-------------------
>>>>>cName C(30)
>>>>>nCode N(5)
>>>>>mDescription (Memo)
>>>>>
>>>>>We are displaying this data in a grid via a Container with some controls on them.
>>>>>2 TextBoxes and 1 Command Button
>>>>>The requirement is to enable/disable the Command Button if there is data in the memo field. Simply put we want to do this ..
>>>>>
>>>>>if Empty(MemoField)
>>>>> CommandButton.enabled = .f.
>>>>>else
>>>>> CommandButton.enabled = .t.
>>>>>endif
>>>>>
>>>>>This applys to all records in the table and so to the Container in the grid. Every row in the grid will have a different state of the CommandButton depending on the row in the table from where the data is comming.
>>>>>
>>>>>In a normal situation one could put code in the refresh event of the command button of the control but that does not work.
>>>>>
>>>>>A workaround is to call a function for each row and update the CommandButton's state accordingly.
>>>>>
>>>>>We can do so by setting the DynamicBackColor property to a Function in a form.
>>>>>In our exampl we can set the Grid.Column1.DynamicBackColor property to =Thisform.DummyFunction()
>>>>>
>>>>>The code in the DummyFunction would look something like this
>>>>>
>>>>>* DummyFunction()
>>>>>If empty(Table.MemoField)
>>>>> Thisform.Grid.Column1.Container.CommandButton.Enabled = .F.
>>>>>else
>>>>> Thisform.Grid.Column1.Container.CommandButton.Enabled = .T.
>>>>>EndIf
>>>>>
>>>>>That' all there is to it.
>>>>>
>>>>>--------------- or --------------
>>>>>
>>>>>According to Larry suggestion .....
>>>>>
>>>>>* Larry Miller UT Id #030732
>>>>>* Bifrost Solutions
>>>>>* Odenton, Maryland
>>>>>
>>>>>
>>>>>The Refresh method of the Grid, does not propagate like the Refresh method of a form. You could the following functionality to your grid to correct this "flaw".
>>>>>local lxx, oControl
>>>>>With THIS
>>>>> For lxx = 1 to .ColumnCount
>>>>> oControl = Eval(".Columns[lxx]."+.Columns[lxx].CurrentControl)
>>>>> if pemstatus(oControl,'Refresh',5) then
>>>>> oControl.Refresh()
>>>>> endif
>>>>> Endfor
>>>>>Endwith
>>>>>Add the code to the Refresh method of the grid. It will go through and call the Refresh methods of all currentcontrols. If more than one control is in a column, the non-active one doesn't get updated. You could change this if you like.
>>>>>
>>>>>That's all folks ..!
>>>>>
>>>>>* FAQ End <-
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform