[HOME][CONTENTS][DOWNLOAD][PREV][NEXT]


COMB WIDGET EXAMPLES

Post. Post (post) is a comb-widget that is used to post a graphic list of bitmap related objects. It consists of a canvas and related procedures to provide a user interface to a multi-selection of objects. Objects in a post are presented with image, text, and rectangle. Objects in a post have tags ranging from id0, id1, ..., idn. In addition, an object k has tags txtk, imgk, and rectk

EXAMPLE: The following example creates a frm and then adds a post widget in it. The post widget is configured for multi-selection. A double-click on Button-3 is bound to a script that prints out the IDs of the selected objects. The images are those created when XBit starts. 

catch "destroy .post"
update
toplevel .post
set frm [frm.create .post.frm -label {-text Post}]
set post [frm.add $frm -post post.create {-msel 1 \
    -canv {-highlightthickness 0 -relief sunk -bd 1}}]
foreach obj [image names] {
lappend objects "$obj $obj"}
post.set $post $objects
pack $frm -expand 1 -fill both
pack $post -expand 1 -fill both -pady 2
post.bind $post <Double-Button-3> "puts \[post.get $post\]" -canv 
An example of a post widget configured for multi-selection 

CLASS NAME: post

COMB-WIDGET OPTIONS

-canv options It specifies options of a Canvas to draw a list of image objects that can be highlighted and selected with a mouse. 
-vscr options It specifies options of a Scrollbar to scroll the canvas in vertical direction. If no image objects are covered in vertical direction, the scroll bar will be hidden from display. 
-hscr options It specifies options of a Scrollbar to scroll the canvas in horizontal direction. If no image objects are covered in horizontal direction, the scroll bar will be hidden from display. 
-list imageObjList It specifies a list of image objects {{img0 txt0} {img1 txt1} ... {imgn txtn}}, where imgi is the ith image and txti is text for the ith image. 
-x0 x0 It specifies the x coordinate of the first object in display (at the upper-left). 
-y0 y0 It specifies the y coordinate of the first object in display (at the upper-left). 
-dx DX It specifies an integer for the maximum width of an object in display. 
-dy DY It specifies an integer for the maximum height of an object in display. 
-miny MINY It specifies an integer for the minimum rows of the objects in display. 
-msel multiSeloction It specifies the flag of multi-selection 0:No, otherwise Yes. 
-txt textItemOptions It specifies configuration options of a canvas text item related to displaying the text component in an image object. 
-sbg selectionBackground It specifies a color definition for the selection background. 
-sfg selectionForeground It specifies a color definition for the selection foreground. 
-fcs outlineColor It specifies a color definition for a highlighted outline rectangle of a focused object. 
WIDGET API
post.bind pathname event scripts -varName This command binds an event of a sub-widget referred to by -varName to scripts. 
post.create pathname ?options? This command creates a post widget with configuration specified by options. 
post.cget pathname -varName This command retrieves a configuration option of a variable referred to by -varName
post.deSelect pathname This command deselects all selected items and redraw them in normal display. 
post.get pathname This command returns a list of IDs of selected items. 
post.redraw pathname This command redraws the post widget in display. 
post.selAt pathname x y ButtonPressedFlag This command selects an item if it has not been selected. Otherwise it deselects the item. If ButtonPressedFlag is set, it deselects all the items. 
post.set pathname imgObjList This command sets a list of items into a post. Each item is a triple of {image text description}. 
post.setScrollbar pathname This command sets the positions of scroll bars of the post widget. 
RELATED PROCEDURES

The followings are procedures used in a post widget implementation and test. A user may access to these procedures through the post widget API, and should never use these procedures directly in an application program. 

post.addSelObj pathname id
post.drawFocus pathname id
post.drawSelect pathname id
post.drawNormal pathname id
post.focus pathname x y
post.free pathname
post.rmvSelObj pathname id
post.winconfig pathname
post.test pathname

[HOME][CONTENTS][DOWNLOAD] 1