Home > Archive > Programming with dBASE > December 2005 > changing grid column width









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author changing grid column width
Moses Hanna

2005-12-27, 3:23 am

I want to change the width of a grid column when it gets focus (let's say
make it 7 instead of orginal 4) and put it back to 4 when it looses focus.
Some help?
Thanks
Moses


Marko Mihorko [dBVIPS]

2005-12-27, 7:23 am

Hello Moses!

"Moses Hanna" je napisal v sporočilo...

>I want to change the width of a grid column when it gets focus (let's say make
>it 7 instead of orginal 4) and put it back to 4 when it looses focus. Some
>help?


Well, I hope that the example below could be looked upon as "some help". ;-)

As usual mark/copy/paste/save everything below to a file named f.e. <moses.wfm>
and later on doubleclick on it under the <Forms> tab of the <Navigator> window.

The second column "b" should manifest the behaviour which you are after. You
can try to move between the grid colums by pressing the keys' combinations
<Tab> vs. <Shift+Tab> and <RightArrow> vs. <LeftArrow>, respectively.

You can try to click in the grid columns as well, however, you must click twice
in order to be able to leave whichever cell in the second column successfully
(and the very same applies if you change to an another cell in that second
column). Right now I don't have more time to explore this further and perhaps
manage to find a solution. And that's also the reason for my first sentence.
;-)

Marko Mihorko [dBVIPS]


set database to; close tables
if file('moses_M.dbf'); drop table moses_M
endif
create table moses_M (a char(10), b char(10), c char(10))
use moses_M
gene 20
use
** END HEADER -- do not remove this line
//
// Generated on 27.12.2005
//
parameter bModal
local f
f = new mosesForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class mosesForm of FORM
with (this)
text = "Moses - changing grid column width"
endwith

this.MOSES_M1 = new QUERY()
this.MOSES_M1.parent = this
with (this.MOSES_M1)
sql = 'select * from "Moses_M.dbf"'
active = true
endwith

this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.moses_m1.rowset
columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1)
columns["COLUMN1"].dataLink = dataLink.fields["a"]
columns["COLUMN1"].width = 14
columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1)
columns["COLUMN2"].dataLink = dataLink.fields["b"]
columns["COLUMN2"].width = 4.0
columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1)
columns["COLUMN3"].dataLink = dataLink.fields["c"]
columns["COLUMN3"].width = 14
with (columns["COLUMN2"].editorControl)
onGotFocus = class::EDITORCONTROL
_ONGOTFOCUS
endwith
height = 15.0
left = 1.0
top = 0.5
width = 38.0
endwith

this.rowset = this.moses_m1.rowset

function editorControl_onGotF
ocus
this.onGotFocus = null
this.parent.columns[this.parent.currentColumn].width = 7
this.onLostFocus = class::EDITORCONTROL
_ONLOSTFOCUS
return

function editorControl_onLost
Focus
this.onLostFocus = null
this.parent.columns[this.parent.currentColumn].width = 4
this.onGotFocus = class::EDITORCONTROL
_ONGOTFOCUS
return
endclass


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com