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!

Listbox problem after reinitialisation changes

Status
Not open for further replies.

koklimabc

Programmer
Jun 17, 2013
49
MY
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.
 
 http://files.engineering.com/getfile.aspx?folder=c52bf776-39fe-4b56-ad65-cc8f0c6f1e16&file=listbox-problems.jpg
I never do listboxes with changing column order, but would .LIST_SUPCODE.requery() help?

Bye, Olaf.

 
The form containing the listbox is too narrow.
define class frmlist as form
* .....
width = 325
must be replaced with a bigger value, at least :
width = 350

Expressions like :
.LIST_SUPCODE.columnwidths = "&vl_size"
can be simplified this way :
.LIST_SUPCODE.columnwidths = vl_size

Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top