Subject |
Re: Grid |
From |
John Jay <bestmar@sbcglobal.net> |
Date |
Tue, 19 Jun 2018 21:26:35 -0400 |
Newsgroups |
dbase.getting-started |
Rob Horsman Wrote:
> Hello dBase friends
>
> I am making a personnel planner for a garage.
> The day is displayed on a line in a grid with colored time blocks.
> With the command leftdoubleklick I can open the whole record for the day
> in question.
> But is there a possibility to stand on a block (cell) and only show the
> info of the cell in question.
>
> Greetings Rob
>
Hi Rob,
Change the table name in the code below and test the form. It worked when I tested it.
If it fits your needs add it to your form's code. Watch for word wrap.
There are notes below -> function GRID1_onLeftMouseUp(flags, col, row)
Hope this helps.
John
** END HEADER -- do not remove this line
//
// Generated on 06/19/2018
//
parameter bModal
local f
f = new AppointmentsForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class AppointmentsForm of FORM
with (this)
metric = 6 // Pixels
height = 463.0
left = 0.0
top = 0.0
width = 1030.0
text = ""
endwith
this.APPOINTMENTS1 = new QUERY(this)
with (this.APPOINTMENTS1)
left = 7.0
width = 76.0
height = 37.0
sql = 'select * from "C:\Program Files (x86)\BridgingSoft\TheBridge\Development\Appointments.dbf"'
active = true
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
onLeftMouseUp = class::GRID1_ONLEFTMOUSEUP
dataLink = form.appointments1.rowset
columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN1"])
dataLink = form.appointments1.rowset.fields["8am"]
editorType = 5 // Editor
width = 100.0
endwith
columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN2"])
dataLink = form.appointments1.rowset.fields["830am"]
editorType = 5 // Editor
width = 100.0
endwith
columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN3"])
dataLink = form.appointments1.rowset.fields["9am"]
editorType = 5 // Editor
width = 100.0
endwith
columns["COLUMN4"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN4"])
dataLink = form.appointments1.rowset.fields["930am"]
editorType = 5 // Editor
width = 100.0
endwith
columns["COLUMN5"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN5"])
dataLink = form.appointments1.rowset.fields["10am"]
editorType = 5 // Editor
width = 100.0
endwith
columns["COLUMN6"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN6"])
dataLink = form.appointments1.rowset.fields["1030am"]
editorType = 5 // Editor
width = 100.0
endwith
with (columns["COLUMN1"].editorControl)
dropDownHeight = 176.0
endwith
with (columns["COLUMN1"].headingControl)
value = "8AM"
endwith
with (columns["COLUMN2"].editorControl)
dropDownHeight = 176.0
endwith
with (columns["COLUMN2"].headingControl)
value = "830AM"
endwith
with (columns["COLUMN3"].editorControl)
dropDownHeight = 176.0
endwith
with (columns["COLUMN3"].headingControl)
value = "9AM"
endwith
with (columns["COLUMN4"].editorControl)
dropDownHeight = 176.0
endwith
with (columns["COLUMN4"].headingControl)
value = "930AM"
endwith
with (columns["COLUMN5"].editorControl)
dropDownHeight = 176.0
endwith
with (columns["COLUMN5"].headingControl)
value = "10AM"
endwith
with (columns["COLUMN6"].editorControl)
dropDownHeight = 176.0
endwith
with (columns["COLUMN6"].headingControl)
value = "1030AM"
endwith
cellHeight = 22.0
hasIndicator = false
rowSelect = true
height = 88.0
left = 35.0
top = 55.0
width = 630.0
endwith
this.EDITOR1 = new EDITOR(this)
with (this.EDITOR1)
height = 363.0
left = 84.0
top = 77.0
width = 735.0
value = ""
pageno = 2
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_ONCLICK
height = 24.0
left = 259.0
top = 44.0
width = 84.0
text = "Save"
upBitmap = "RESOURCE #36"
pageno = 2
endwith
this.PUSHBUTTON2 = new PUSHBUTTON(this)
with (this.PUSHBUTTON2)
onClick = {;form.pageNo = 1}
height = 24.0
left = 378.0
top = 44.0
width = 107.0
text = "Abandon"
upBitmap = "RESOURCE #28"
pageno = 2
endwith
this.rowset = this.appointments1.rowset
function GRID1_onLeftMouseUp(flags, col, row)
/*
1. set the grids multiselect to true (I think you did this already or thr double click
would not work)
2. Make sure all the fields you want to edit are the same width.
3. Add the width of field {"Montuer"] to the cases below
Example - <yourrowset>.fields["Montuer"].width = 40
<yourrowset>.fields["07:00"].width = 25
the first case would be col < 65
*/
do case
case col<100
form.ncol = 1
form.editor1.value = "You Chose field # 1 in this record it's value" +;
" is " + trim(form.appointments1.rowset.fields[1].value)+ ;
" Change this and select save to write new data into table"+ chr(13)+ ;
"or abandon to return without saving data"
case col<200
form.ncol = 2
form.editor1.value = "You Chose field # 2 in this record it's value" +;
" is " + trim(form.appointments1.rowset.fields[2].value)+ ;
" Change this and select save to write new data into table"+ chr(13)+ ;
"or abandon to return without saving data"
case col<300
form.ncol = 3
form.editor1.value = "You Chose field # 3 in this record it's value" +;
" is " + trim(form.appointments1.rowset.fields[3].value)+ ;
" Change this and select save to write new data into table"+ chr(13)+ ;
"or abandon to return without saving data"
case col<400
form.ncol = 4
form.editor1.value = "You Chose field # 4 in this record it's value" +;
" is " + trim(form.appointments1.rowset.fields[4].value)+ ;
" Change this and select save to write new data into table"+ chr(13)+ ;
"or abandon to return without saving data"
case col<500
form.ncol = 5
form.editor1.value = "You Chose field # 5 in this record it's value" +;
" is " + trim(form.appointments1.rowset.fields[5].value)+ ;
" Change this and select save to write new data into table"+ chr(13)+ ;
"or abandon to return without saving data"
case col<600
form.ncol = 6
form.editor1.value = "You Chose field # 6 in this record it's value" +;
" is " + trim(form.appointments1.rowset.fields[6].value)+ ;
" Change this and select save to write new data into table"+ chr(13)+ ;
"or abandon to return without saving data"
endcase
form.pageNo = 2
return
function PUSHBUTTON1_onClick()
form.appointments1.rowset.fields[form.ncol].value = trim(form.editor1.value)
form.appointments1.rowset.save()
form.pageNo = 1
return
endclass
|
|