> O/H Michael ???a?e:
> > On 12 May, 23:33, Georgios Petasis <peta@iit.demokritos.gr> wrote:
> >> O/H Michael ???a?e:
> >>> Hello,
> >>> I'm trying to create a virtual keyboard for use on a touch screen
> >>> monitor. I'm using a grid 8x4 of ttk::button but at the moment the
> >>> buttons are too small. I need to make them 98x98 pixels. How can I do
> >>> this? I tried defining something below but it doesn't seem to work.
> >>> Any ideas?
> >>> style configure keyButtons -height 200 -width 200 -pady 2 -padx 2
> >>> ttk::button .a -text A -height 200
> >>> grid x .a
> >>> M.
> >> The following code will ensure that all buttons are at least 98 pixels:
> >> package require tile
> >> for {set row 0} {$row < 4} {incr row} {
> >> grid rowconfigure . $row -weight 1 -uniform buttons -minsize 98
> >> for {set col 0} {$col < 8} {incr col} {
> >> if {!$row} {
> >> grid columnconfigure . $col -weight 1 -uniform buttons -minsize 98
> >> }
> >> grid [ttk::button .b$row$col -text "($row, $col)"] \
> >> -row $row -column $col -sticky snew
> >> }
> >> }
> >> George
> > Thanks George. Your solution is working nicely. So I have:
> > variable TOP[ttk::frame .base]
> > pack $TOP -side top -expand true -fill both
> > set l [ttk::labelframe $pw.l -padding 1 -underline 1]
> > set l [ttk::labelframe $pw.l -padding 1 -underline 1]
> > $pw add $l -weight 1
> > ttk::entry $l.tel_num -textvariable ::tel_num -width 40
> > ttk::entry $l.postcode -textvariable ::postcode
> > ttk::entry $l.property_id -textvariable ::property_id
> > ttk::label $l.1 -text Telephone
> > ttk::label $l.2 -text No
> > ttk::label $l.3 -text Postcode
> > grid $l.1 $l.tel_num -sticky ew -padx 2 -pady 2
> > grid $l.2 $l.property_id -sticky ew -padx 2 -pady 2
> > grid $l.3 $l.postcode -sticky ew -padx 2 -pady 2
> > set keyboard [ttk::frame $::BASE.keyboard]
> > for {set row 0} {$row < 4} {incr row} {
> > grid rowconfigure $keyboard $row -weight 1 -uniform buttons -
> > minsize 98
> > for {set col 0} {$col < 8} {incr col} {
> > if {!$row} {
> > grid columnconfigure $keyboard $col -weight 1 -uniform buttons
> > -minsize 98
> > }
> > grid [ttk::button $keyboard.b$row$col -text "($row, $col)"] \
> > -row $row -column $col -sticky snew -command [list
> > keyBoardAction $row $col]
> > }
> > }
> > $pw add $keyboard
> > In my application I the user selects an entry field and then uses the
> > virtual keyboard to enter the text. Each time a button is pressed then
> > the focus moves to the button. How can I keep focus on the entry
> > field?
> use -takefocus 0 when you create each button
> > Also I want to be able to hide and unhide the virtual keyboard. It is
> > as straight forward as making the height of the panel containing the
> > keyboard much smaller?
> Well it depends on your code. What widget is $pw?
> In your case I will try to unmap the keyboard frame
> (using pack/grid forget or similar...)
> It is not a good idea to make it very small...
> A better solution would have been the keyboard to be on a new toplevel
> (without borders) that appears below/above the entry. When it is not
> need it any more, you destroy it...
> > My final problem is that I want to run on a PDA as well as a touch
> > screen monitor. Is there a way to get the maximum screen size in
> > pixels automatically?
> winfo screenwidth .
> winfo screenheight .
> George
Thanks George. I've taken your suggestion on destroying the panel for M.