Subject |
Re: logical field check box behavior in a grid |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Sun, 25 Jun 2017 14:58:54 +0200 |
Newsgroups |
dbase.getting-started |
Attachment(s) |
test_gridtick.wfm |
On 2017-06-25 2:32 PM, Heinz Kesting wrote:
> Probably you will have this checkbox on your grid datalinked, to a
> logical field. If so, and if the field value itself is still empty, that
> is NEITHER TRUE nor FALSE, then it would be WAD. (That's the case with a
> new or untouched logical field, if you haven't assigned a default field
> value.)
> In this case, the first click sets the value from "nothing" (or "empty")
> to FALSE, and only the second click reverses that to TRUE.
>
> Check this behaviour with a row where you know that the field value is
> definitely FALSE or TRUE. With such a row you should get the reversing
> value with just ONE click.
I'm afraid, in dBASE 11 certainly, it doesn't work that way. Even if a
tickbox shows the tick it still normally needs two clicks to change it's
value.
Attached is an amended version of the example I posted for Charlie.
This uses the query syntax that dBASE 2.8 will digest. I haven't
bothered to change the file and class names as either will work for
Charlie. Selecting the second radiobutton leaves the grid in its
default condition.
Mervyn.
| if file('test_gridtick.dbf')
// drop table test_gridtick
endif
if not file('test_gridtick.dbf')
create table test_gridtick (id autoinc,data character(15),tickbox boolean)
use test_gridtick
generate 5
use
endif
** END HEADER -- do not remove this line
//
// Generated on 2017-06-25
//
parameter bModal
local f
f = new test_gridtickForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class test_gridtickForm of FORM
with (this)
height = 14.1818
left = 8.7143
top = 5.0455
width = 74.1429
text = ""
endwith
this.TEST_GRIDTICK1 = new QUERY()
this.TEST_GRIDTICK1.parent = this
with (this.TEST_GRIDTICK1)
left = 4.0
width = 11.0
height = 1.0
sql = 'select * from "test_gridtick.DBF"'
active = true
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.test_gridtick1.rowset
columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN1"])
dataLink = form.test_gridtick1.rowset.fields["id"]
editorType = 1 // EntryField
width = 15.7143
endwith
columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN2"])
dataLink = form.test_gridtick1.rowset.fields["data"]
editorType = 1 // EntryField
width = 21.4286
endwith
columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN3"])
dataLink = form.test_gridtick1.rowset.fields["tickbox"]
editorType = 2 // CheckBox
width = 10.0
endwith
with (columns["COLUMN1"].headingControl)
value = "id"
endwith
with (columns["COLUMN2"].headingControl)
value = "data"
endwith
with (columns["COLUMN3"].editorControl)
onLeftMouseDown = class::EDITORCONTROL_ONLEFTMOUSEDOWN
onRightMouseDown = class::EDITORCONTROL_ONRIGHTMOUSEDOWN
endwith
with (columns["COLUMN3"].headingControl)
value = "tickbox"
endwith
height = 9.0
left = 9.0
top = 4.0
width = 58.0
endwith
this.TEXT1 = new TEXT(this)
with (this.TEXT1)
height = 3.0
left = 44.0
top = 0.0
width = 24.0
text = "Left mouse click to change checkbox value. Right mouse click to reverse change."
endwith
this.RADIOBUTTON1 = new RADIOBUTTON(this)
with (this.RADIOBUTTON1)
height = 1.0909
left = 17.0
top = 0.5
width = 23.0
text = "One click on tickbox"
group = true
value = true
endwith
this.RADIOBUTTON2 = new RADIOBUTTON(this)
with (this.RADIOBUTTON2)
height = 1.0909
left = 17.0
top = 2.0
width = 21.0
text = "Two clicks on tickbox"
endwith
this.rowset = this.test_gridtick1.rowset
function editorControl_onLeftMouseDown(flags, col, row)
if form.radiobutton1.value = true
this.value = not this.value
endif
return
function editorControl_onRightMouseDown(flags, col, row)
if form.radiobutton1.value = true
this.value = not this.value
endif
return
endclass
|
|