eTcl without a pointing device 
Author Message
 eTcl without a pointing device

Hi,

I'm really impressed by eTcl, and very impatient to implement with it
dozen of things.
Among them, are a few GUI things. Of course Tk works perfectly, but I
lack the smartphone culture to know through which Tk abstraction one is
supposed to use soft and hardbuttons (and menus) on phones without a
pointing device. Thanks in advance for a lesson !

-Alex



Tue, 09 Dec 2008 23:19:15 GMT  
 eTcl without a pointing device
keyboard traversal, like with <Tab> on desktop machines?


Tue, 09 Dec 2008 23:50:06 GMT  
 eTcl without a pointing device

Quote:

> keyboard traversal, like with <Tab> on desktop machines?

Sorry I wasn't clear. I mean, how do I *install* (from Tcl)
softbutton-activated commands ?
That is, the ones you install in J2ME with Displayable.addCommand(),
and which appear in the lower corners of the screen and are linked to
general-purpose buttons just below.

Maybe the menubar abstraction is reused for this purpose ?

-Alex



Wed, 10 Dec 2008 00:03:39 GMT  
 eTcl without a pointing device

Quote:


>> keyboard traversal, like with <Tab> on desktop machines?

> Sorry I wasn't clear. I mean, how do I *install* (from Tcl)
> softbutton-activated commands ?
> That is, the ones you install in J2ME with Displayable.addCommand(),
> and which appear in the lower corners of the screen and are linked to
> general-purpose buttons just below.

> Maybe the menubar abstraction is reused for this purpose ?

> -Alex

Note sure to get for sure what you are looking for. DO you want to
handle keypress/keyrelease events on softkeys, and especially on the two
softkeys below the screen? If so:

eTcl has two possible way to handle this:
- If you create a menubar from Tk and attach it to your toplevel, the
right button will automatically by binded to this menu (e.g. see
console; The left button will be translated into a keypress event.
- If you want to be able to program those two keys, and all (actually
most) other softkeys (up, down, left, right, volume up, volumedown,
etc...), you need to use the wce package (part of etcl on WinCE
distribution) to tell eTcl to handle those softkeys as normal keys.
Below is a sample code to activate those softkeys, and let you see which
code they return. The key command is "wce softkey <softkeyname>
<widget>" which means "translate event when softkey <softkeyname> is
pressed or release into a normal KeyPress/KeyRelease event sent to
widget <widget>".

Hope it helps.

Eric

-----
Eric Hassold
Evolane - http://www.evolane.com/

# testkeys.tcl
# Test keyboard handling, and especially support for softkeys
# on WinCE devices

namespace eval ::etcl::test {}

# generic code to adjust toplevel window geometry automatically
proc ::etcl::test::ConfigureRequest {w} {
   switch -exact -- [set ::tcl_platform(os)] {
     "Windows CE" {
       if {[llength [info command ::etcl::autofit]]>0} {
         catch {::etcl::autofit [winfo toplevel $w]}
       }
     }
   }

   return

Quote:
}

proc Quit {} {
   catch {destroy .}

Quote:
}

# Callback for keypress/keyrelease
proc LogKey {keycode keysym str {press 0}} {
   if {$press} {
     set ev "DOWN"
   } else {
     set ev "UP"
   }

   set msg [format "%4s 0x%04x %s (%s)\n" $ev $keycode $keysym $str]
   .c insert end $msg
   .c yview end

   return

Quote:
}

package require Tk

wm deiconify .
raise .

# Create GUI
set w [text .c -borderwidth 0 -background white]
pack $w

::etcl::test::ConfigureRequest $w

# Install our custom bindings
bind . <ConfigureRequest> {::etcl::test::ConfigureRequest %W}
bind . <Expose> {::etcl::test::ConfigureRequest %W}

# Application need a menubar to handle softkeys
# (this is a WinCE behavior)
set mb [menu .mb]
. configure -menu .mb

if {![catch {package require wce}]} {
   # Register some special keys. One may get list of all supported
   # softkeys aliases typing "wce keyon XXX"
   wce keyon soft1 .
   wce keyon soft2 .
   wce keyon volumeup .
   wce keyon volumedown .

Quote:
}

# A button to quit
set w [button .quit -text "Quit" -command Quit]
pack $w -fill x -expand true

bind .c <KeyPress> "LogKey %k %K %A 1; break"
bind .c <KeyRelease> "LogKey %k %K %A 0; break"
focus .c

bind .c <Return> Quit

tkwait window .
exit



Thu, 11 Dec 2008 02:51:36 GMT  
 eTcl without a pointing device

Eric Hassold a crit :

Quote:

> Note sure to get for sure what you are looking for.
> [...]
> Hope it helps.

That's exactly what I was looking for. Thanks Eric !

Now there's another wince-specific thing I'd like to do: handle the
close box and background/foreground events.

As you know very well, the usual behavior of wince applications when
you hit the close box in the upper right corner of the window/screen,
is *not* to exit or even close the document, but simply to go to the
background, expecting to come back later with smaller delay (but
enormous memory footprint in the meantime, hey that's MS, remember).

How can we, with eTcl

 (a) intercept the close box and really exit
 (b) or, decide to play by the rules, hence let the close box behave
normally, and be notified of a subsequent "bring to foreground" event,
possibly with a filename argument (eg  a new document to open)

TIA,

-Alex



Fri, 12 Dec 2008 04:34:39 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Files without blocks on non-disk devices

2. Floating point maths on an 80x86 without coprocessor

3. Floating point arithmetic without FPU

4. print a floating point number without a period

5. writing a real without the decimal point

6. Help. Need to grab focus without using a pointing device.

7. Real-Time Embedded OS Device Drivers for LAN/WAN Devices

8. Real-Time Embedded OS Device Drivers for LAN/WAN Devices

9. ANNOUNCE: eTcl 1.0-rc7

10. eTcl 1.0-rc3 released

11. eTcl on SMT5600 Smartphone?

12. newbie question - using eTcl and sqlite3

 

 
Powered by phpBB® Forum Software