I've one unsolved problem regardings usage of listbox where I've initialised with 2 columns and defined columnwidths. After that,I've assign rowsource with two fields from cursor. It seems to be appeared nicely but problems appeared when I tried to change the columnwidths with different sequence of cursor's fields where the first columns width suppose assign with correct width but it overlapped until reached width as same to form's width. Only first columns could able to see but not second columns.I probably need two columns display on listbox but it is only appeared in one columns after second changed.
My listbox class code
define class frmlist as form
name = "frmlist"
width = 325
height = 70
alwaysontop = .t.
titlebar = 0
borderstyle = 0
add object list_supcode as listbox with ;
visible = .t.,;
height = this.height,;
columncount = 2,;
columnwidths="25,300",;
width = this.width
procedure list_supcode.init
select distinct supcode,supplier ;
from supplier ;
into cursor tmpsup
this.rowsourcetype = 6
this.rowsource = "tmpsup.supcode,supplier"
endpro
enddefine =>Here is initialisation stage and it is appeared to be normal.
Keypress Event on textbox to change the sequence of fields with columnwidth
LPARAMETERS nKeyCode, nShiftAltCtrl
local vl_fldcount,vl_criteria,vl_size
do case
case nkeycode = -3
if not wexist('frmlist')
this.parent.addproperty("listobj")
this.parent.listobj = createobject("frmlist")
this.parent.listobj.show()
this.parent.listobj.move(objtoclient(this,2)+8,objtoclient(this.parent.dt_pick1,1)+;
(this.parent.txt_supcode.height/2))
this.parent.txt_supcode.setfocus()
else
with this.parent.listobj
.LIST_SUPCODE.rowsource = ""
sele tmpsup
do case
case FIELDS(1) = "SUPCODE"
vl_size = "300,25"
vl_criteria = "tmpsup.supplier,supcode"
case FIELDS(1) = "SUPPLIER"
vl_size = "25,300"
vl_criteria = "tmpsup.supcode,supplier"
endcase
.LIST_SUPCODE.columnwidths = "&vl_size"
.LIST_SUPCODE.rowsource = "&vl_criteria"
.LIST_SUPCODE.refresh()
endwith
endif
endcase
Hopefully somone could help to solved my problem.Thanks.
My listbox class code
define class frmlist as form
name = "frmlist"
width = 325
height = 70
alwaysontop = .t.
titlebar = 0
borderstyle = 0
add object list_supcode as listbox with ;
visible = .t.,;
height = this.height,;
columncount = 2,;
columnwidths="25,300",;
width = this.width
procedure list_supcode.init
select distinct supcode,supplier ;
from supplier ;
into cursor tmpsup
this.rowsourcetype = 6
this.rowsource = "tmpsup.supcode,supplier"
endpro
enddefine =>Here is initialisation stage and it is appeared to be normal.
Keypress Event on textbox to change the sequence of fields with columnwidth
LPARAMETERS nKeyCode, nShiftAltCtrl
local vl_fldcount,vl_criteria,vl_size
do case
case nkeycode = -3
if not wexist('frmlist')
this.parent.addproperty("listobj")
this.parent.listobj = createobject("frmlist")
this.parent.listobj.show()
this.parent.listobj.move(objtoclient(this,2)+8,objtoclient(this.parent.dt_pick1,1)+;
(this.parent.txt_supcode.height/2))
this.parent.txt_supcode.setfocus()
else
with this.parent.listobj
.LIST_SUPCODE.rowsource = ""
sele tmpsup
do case
case FIELDS(1) = "SUPCODE"
vl_size = "300,25"
vl_criteria = "tmpsup.supplier,supcode"
case FIELDS(1) = "SUPPLIER"
vl_size = "25,300"
vl_criteria = "tmpsup.supcode,supplier"
endcase
.LIST_SUPCODE.columnwidths = "&vl_size"
.LIST_SUPCODE.rowsource = "&vl_criteria"
.LIST_SUPCODE.refresh()
endwith
endif
endcase
Hopefully somone could help to solved my problem.Thanks.