Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid EditBox Click Conundrum
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01146528
Message ID:
01146568
Views:
26
This message has been marked as the solution to the initial question of the thread.
You're still leaving the column's ReadOnly set to .T. Take out loObject.READONLY = .T. right after the ENDWITH.

>I played around with that but I can't seem to get itto work whether I set it on the editbox or the column. Here is my last attempt which had no effect:
>
>		LOCAL loObject
>		loObject = THISFORM.PAGEFRAME.Page1.GrdMain.Column2
>		IF !PEMSTATUS(loObject,'Edit1',5)
>			WITH THISFORM.PAGEFRAME.Page1.GrdMain.Column2
>				.REMOVEOBJECT([Text1])
>				.ADDOBJECT([Edit1],[EditBox])
>				.CURRENTCONTROL = [Edit1]
>				.Edit1.VISIBLE = .T.
>				.CONTROLSOURCE = "(thisform.mymethod())"
>				.WIDTH = 340
>				.Edit1.ReadOnly = .F.
>				.Edit1.Enabled = .F.
>				.Edit1.SelectedBackColor = .parent.Column1.Text1.selectedBackColor
>				.Edit1.SelectedForeColor = .parent.Column1.Text1.selectedForeColor
>			ENDWITH
>			loObject.READONLY = .T.
>			THISFORM.PAGEFRAME.Page1.GrdMain.ALLOWCELLSELECTION = .F.
>		ENDIF
>
>
>>It behaves that way for textboxes, but editboxes seem to be different. I didn't catch that you were setting AllowCellSelect to .F. If that's the case, why not set Enabled to .F. instead? I was able to duplicate your problem with ReadOnly set to .T. I then set the Selected Forecolor and Backcolors of the editbox to the same colors as the textbox of another column. With readonly set to .T., it didn't respect the forecolor, but with readonly set to .F. and Enabled set to .F., it worked just fine.
>>
>>>Hi Barbara,
>>>
>>>I thought setting the grid's allowcellselection to .f. would negate setting focus to any specific control anyway?
>>>
>>>
>>>>I think the problem comes from the fact that the control is readonly and not disabled. Does it really need to have focus? If so, then you may just need to set the SelectedForeColor and SelectedBackColor of the column's textbox. But doing so may make it difficult to tell which object has focus.
>>>>
>>>>>After running the below code (page's activate), whenever column2 is clicked on with the mouse, the editbox changes from the highlight color to a white background as though it could be edited. It is readonly though. The other columns and controls do not do this. the goal is to have the highlight remain in all columns when the user clicks in the any column and it works for all columns except for the one where I add a control on the fly. I have obviously broken a setting, but is it obvious which one?
>>>>>
>>>>>
>>>>>		LOCAL loObject
>>>>>		loObject = THISFORM.PAGEFRAME.Occupants.GrdMain.Column2
>>>>>		IF !PEMSTATUS(loObject,'Edit1',5)
>>>>>			WITH THISFORM.PAGEFRAME.Occupants.GrdMain.Column2
>>>>>				.REMOVEOBJECT([Text1])
>>>>>				.ADDOBJECT([Edit1],[EditBox])
>>>>>				.CURRENTCONTROL = [Edit1]
>>>>>				.Edit1.VISIBLE = .T.
>>>>>				.CONTROLSOURCE = "(thisform.ReturnOccAddr())"
>>>>>				.WIDTH = 340
>>>>>			ENDWITH
>>>>>			THISFORM.PAGEFRAME.Occupants.GrdMain.allowcellselection = .F.
>>>>>		ENDIF
>>>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform