From 23dbc0a2e57ba9ebf1c6ff7c3a7557f718fbb0cb Mon Sep 17 00:00:00 2001 From: Jeff Hobbs Date: Tue, 8 Apr 2003 16:45:24 +0000 Subject: [PATCH] * tkcon.tcl (::tkcon::InitUI): WinCE code to resize the window to fit on the small screen --- ChangeLog | 5 +++++ tkcon.tcl | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/ChangeLog b/ChangeLog index 43c8efd..16b3935 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-04-08 Jeff Hobbs + + * tkcon.tcl (::tkcon::InitUI): WinCE code to resize the window to + fit on the small screen + 2003-03-31 Jeff Hobbs * tkcon.tcl (tkcon::Retrieve): correct the check for tkcon version diff --git a/tkcon.tcl b/tkcon.tcl index 21450fd..dceaa36 100755 --- a/tkcon.tcl +++ b/tkcon.tcl @@ -583,6 +583,25 @@ proc ::tkcon::InitUI {title} { } set OPT(font) [$con cget -font] if {!$PRIV(WWW)} { + if {[string match "Windows CE" $::tcl_platform(os)]} { + $con configure -bd 0 + catch {font create tkconfixed} + font configure tkconfixed -family Courier -size 8 + set cw [font measure tkconfixed "0"] + set ch [font metrics tkconfixed -linespace] + set sw [winfo screenwidth $con] + set sh [winfo screenheight $con] + # We need the magic hard offsets until I find a way to + # correctly assume size + if {$cw*($OPT(cols)+2) > $sw} { + set OPT(cols) [expr {($sw / $cw) - 2}] + } + if {$ch*($OPT(rows)+3) > $sh} { + set OPT(rows) [expr {($sh / $ch) - 3}] + } + # Place it so that the titlebar underlaps the CE titlebar + wm geometry $root +0+0 + } $con configure -setgrid 1 -width $OPT(cols) -height $OPT(rows) } bindtags $con [list $con TkConsole TkConsolePost $root all] -- 2.23.0