Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Horrible CheckBox within grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00665495
Message ID:
00665506
Vues:
19
This message has been marked as the solution to the initial question of the thread.
Hi!

.Column1.addObject("Lcheck", "Checkbox")
.Column1.Lcheck.Visible = .T.

Controls added in run-time are always added with property Visible = .F.

>Hi, Folks!
>
>I have a silly problem dealing with grid and checkboxes:
>- I have a data source in any open work area.
>- I create a grid using ColumnCount=-1 and bound them to the datasource.
>- Some VFP automatics works very well (calculating column widths etc.)
>- Now the hack: I try to change the first column from textbox to checkbox!
>- That works fine - but the checkbox is always readonly!
>- I tried a lot of stuff:
> - dealing with BoundTo
> - setting ReadOnly=.T. programmatically
> - explicit setting of controlsource of the checkbox
>
>But whatever I do, the ... checkbox is read only at all!
>
>To see what happens copy the code below into a PRG, run it and click on the button!
>
>
>Any help kindly appreciated!
>
>
RELEASE abc
>PUBLIC abc
>abc = NEWOBJECT("formular1")
>
>
>**************************************************
>*-- Class:        formular1
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Zeitstempel: 06/06/02 01:41:08 PM
>*-- Testformular
>*
>DEFINE CLASS formular1 AS form
>
>
>	Top = 0
>	Left = 0
>	Height = 250
>	Width = 459
>	DoCreate = .T.
>	Caption = "Form1"
>	cursor = "test"
>	Name = "formular1"
>
>
>	ADD OBJECT grid1 AS grid WITH ;
>		Height = 200, ;
>		Left = 20, ;
>		Top = 5, ;
>		Width = 410, ;
>		Name = "Grid1"
>
>
>	ADD OBJECT command1 AS commandbutton WITH ;
>		Top = 215, ;
>		Left = 175, ;
>		Height = 27, ;
>		Width = 84, ;
>		Caption = "anzeigen", ;
>		Name = "Command1"
>
>
>	PROCEDURE Destroy
>		IF USED(this.Cursor)
>			SELECT (this.Cursor)
>			USE
>		ENDIF
>	ENDPROC
>
>
>	PROCEDURE Init
>		this.Visible = .T.
>	ENDPROC
>
>
>	PROCEDURE command1.Click
>		LOCAL lcAlias, lnCounter, lnCount, lcName
>		lnCount = 4
>		lcAlias = thisform.cursor
>
>		**************************************************
>		*-- einfach mal nen Cursor erzeugen
>		CREATE CURSOR (lcAlias) (che L(1,0),name C(20,0), Ort C(30,0))
>		m.che = .T.
>		m.name = "Biene"
>		m.Ort = "Berlin"
>		FOR lnCounter = 1 TO lnCount
>			INSERT INTO (lcAlias) FROM memvar
>		ENDFOR
>		GO top
>		**************************************************
>
>
>		*-- in Spalte 1, Textbox1 durch Checkbox ersetzen
>		WITH ThisForm.Grid1
>			.ColumnCount = -1
>			.recordsource = lcAlias
>			lcName = .Column1.CurrentControl
>			.Column1.RemoveObject(lcName)
>			.Column1.addObject("Lcheck", "Checkbox")
>			.Column1.sparse =.F.
>			.Column1.currentcontrol = "Lcheck"
>			.Column1.controls(2).ReadOnly = .F.
>
>		ENDWITH
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: formular1
>**************************************************
>
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform