Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wiring up a Checkbox for NULL

Status
Not open for further replies.

stanlyn

Programmer
Sep 3, 2003
945
US
Hi,

How is the best way to wire up a checkbox that is connected to a remote view that is connected to MSSQL's bit datatype? I see the checkbox control has 3 visual states, checked, blanked and a heavy outlined one that must represent null. Is this all automatic, which it doesn't appear to be...

Thanks,
Stanley

 
The visual style of a NULL checkbox is a light grey check, I don't remember having seen heavy outlined checkboxes. I remember also a grey checkerboard pattern, but I don't know if that was even Foxpro.

I don't know what exactly is your problem. One thing is for sure, the controlsource has to be the view field. You have to ensure the values will be .T./.F./.NULL., I think, not 0/1/.NULL.

Also, whenever the user clicks, the box will only switch to .T. or .F., it can only start with .NULL. but never get back to .NULL. If you want the user to be able to cycle through 3 states, you better use something else.


Chriss
 
I checked it, no pun intended.

And I get a black square inside the box when it's .NULL. Focus doesn't change it's look much. That's on Windows 10, I remember there is a faint check in Win5/XP, I think Vista made the change. But I don't know when there ever was a heavy outlined checkbox. Do you have hottracking on? Either way if it's just a visual state of focussing it's not any actual state. Whatever the checkbox value is, focussing it or hovering the mouse and causing the hottracking look, does not change its value.

You can interactively set it to .NULL., if you allow CTRL+0, but that should be disabled for many reasons.

If you look for a real tristate control look elsewhere.

Chriss
 
Here is what I see in Win10p

Null_Checkbox_cosm25.jpg


Sorry, instead of a heavy outline, it is an inside black square.

The 2-state is fine,

Stanley
 
Yes, that's the display of .NULL.

It was more intuitive in older Windows version, where it was displayed as a faint check.

Now click it. I see it go from .NULL. to .F. (unchecked, empty) first, then .T. (checked), then .F. (unchecked) again, it's not getting back to .NULL.

Which can become a problem of a user just accidentally clicking and not getting it back to its unused state. You could of course offer a Cancel button that reverts the state to .NULL. by tablerevert(), if the record is buffered.

The only problem I see is when you fetch a bit as .null. or 0 or 1. Though the VFP checkbox also allows 0 and 1 as values. Using a view you'll just need to ensure it's taken as a logical field on the VFP side, and then it works as such. There's no dependency on the control, just on the field type.

If you use SPT and some drivers, bits can come over as integers.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top