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!

multi column listbox

Status
Not open for further replies.

adekunleadekoya

Programmer
May 19, 2008
30
i need a sample code that can show a multi column list of items for example showing dis as follows

names age sex score

kunle lola male 40
kunle lola male 40
kunle lola male 40
kunle lola male 40
kunle lola male 40

Sample codes will be appreciated.

 
I'm not sure what your problem is. Consider this code:
Code:
#multicolumn listbox
pack [listbox .lb1 -listvariable lstA] -side top
set l1 {a b c d e}
set l2 {z y x w v}
set lstA [list $l1 $l2]
Is that what you want?

_________________
Bob Rashkin
 
Can the columns will be draggable ?

Any possibility of inserting a checkbox in each list item ?

Can a special color highlighting be applied to any row of item in the list ? Expecially the first row so it takes a different

Can a row selection be binded to an event handler such as a procedure or a tcl/tk script ?

 
Can the columns be made draggable to make them expandable ?

Any possibility of inserting a checkbox in each list item ?

Can a special color highlighting be applied to any row of item in the list , expecially the first row so it takes a different look ?

Can a row selection be binded to an event handler such as a procedure or a tcl/tk script ?
 
No, no, yes, and yes.

for row color said:
pathName itemconfigure index ?option? ?value? ?option value ...?
Query or modify the configuration options of an item in the listbox. If no option is specified, returns a list describing all of the available options for the item (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. The following options are currently supported for items:
-background color
Color specifies the background color to use when displaying the item. It may have any of the forms accepted by Tk_GetColor.
-foreground color
Color specifies the foreground color to use when displaying the item. It may have any of the forms accepted by Tk_GetColor.
-selectbackground color
color specifies the background color to use when displaying the item while it is selected. It may have any of the forms accepted by Tk_GetColor.
-selectforeground color
color specifies the foreground color to use when displaying the item while it is selected. It may have any of the forms accepted by Tk_GetColor.

For the binding, you can bind, say, "double-click" or "right-click" to execute some proc and capture the selection as:
pathName curselection
Returns a list containing the numerical indices of all of the elements in the listbox that are currently selected. If there are no elements selected in the listbox then an empty string is returned.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top