News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.

Post Reply  Post Thread 
How to bind a key event for widget?
Author Message
Senior Member

Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: How to bind a key event for widget?

Although I'm not sure how well this would work for your needs, if at all, you could try using decimal codes to display the Chinese characters. It isn't ideal, of course, since it will not translate to other machines that don't have the exact font, and without some special magic it is probably useful only for static strings.

Here is a script that will display 256 characters available in the FL_SCREEN font. You'll need to add a set_font line to get your desired font:
Optionally change bro:textfont() to a different constant.

EDIT: Then again, maybe just changing the font would provide the same level of usefulness/uselessness

ww=500; wh=350
win=fltk:Fl_Window(ww,wh,"decimal codes")
for i=0,255 do
if i<10 then t="  " elseif i<100 then t=" " else t="" end
if odd then odd=nil; col="@B52@." else odd=1; col="" end
When including an escaped string of
1, 2, or 3 decimals as part of a Lua
string, those decimals will be read
as the character matching that code.
For example, \64 shows '@' and \10 is
a newline character on systems that
use ASCII:97

In this particular demo, the lines in
the browser were added programatically
rather than being provided as a full
string. Concatenating an escape character
to the string it is intended to escape
is seemingly impossible, but you can get
the same result with string.format:

Results may vary depending on your
system's configuration or chosen font.

This post was last modified: 09-15-2008 11:44 PM by mikshaw.

09-15-2008 11:39 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
RE: How to bind a key event for widget? - mikshaw - 09-15-2008 11:39 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: