Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid1.column1.container1.check1.controlsource - HELP
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00204268
Message ID:
00204426
Vues:
20
>>Wanted to center a checkbox in a grid. Made a class of a container with a checkbox so that I could set the check.left property to center the checkbox within the container.
>>
>>My grid is bound to a table. All the checkboxes are used for logical fields. The column1.spare is set to .F.
>>
>>I have no code in my container_grid class. After adding the container_grid class to the column of the grid, I set the check1.controlsource in the check1.init to the correct table.fieldname. When I run the app, I get really goofy results. The checkbox has no values, until the grid gets focus. Then when I check on check1 - check2 (another checkbox in a different column) checks or unchecks. What am I missing?
>>
>>Brenda

>In the INIT of the container of my GridCheckBox class, I put:

>This.ChkBox.ControlSource = This.Parent.ControlSource

>This refers to the container, and This.Parent refers to the grid column. So all I have to do is make sure the Column ControlSource is properly defined. I, of course, changed the name of the checkbox in the container to ChkBox and blanked the Caption property.

>I also have Resize code to size the container then center the checkbox in the >container.
>if upper(This.Parent.Parent.BaseClass) = "GRID"
> with This
> .Width = .Parent.Width
> .Height = .Parent.Parent.RowHeight
> .chkBox.Left = max(0, int((.Width - .chkBox.Width) / 2))
> .chkBox.Top = max(0, int((.Height - .chkBox.Height) / 2))
> endwith
>endif

Thanks for the code. Did what you suggested. However I also had to set each columnx.controlsource. Before I had only the grid1.recordsource set and each column.bound = .T. Setting the check1.controlsource messed up (technical term) the following columnx.controlsource. Setting each columns controlsource straightened that out.

Now my problem is that one of the container.check1 is not behaving. I have compared it with the ones that are behaving, but I see no difference. The data shows in the grid corectly. If I then edit the container.check1.value and save, all the checkboxes in that column turn to the same value. They keep that value even if I move to the next header record (parent type record of the grid). The column.check1 keep the same value until I edit again. Obviously this is not changing the data base values, just the display.

Obviously the messed up column must have something different, because the others work. But I have no code in the column, container (other than at the class) or checkbox.

any ideas?

brenda
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform