wxEuphoria woes
I've been messing around with wxEuphoria recently trying to learn it (if I'm
going to use GUIs they're going to have to be cross-platform) and I've writen a
simple program that just displays my TODO list in a window. However, after
leaving it running for a few seconds in MS Windows or moving the window the
Windows Task Manager says that EXW.EXE is using around 50% of my CPU (it starts
at 0%) which causes the screen to lock up at times (I have to ctrl-alt-delete and
kill it when that happens). All the program does is open a file and show its
contents so I'm wondering if this is caused by a bug in wxEuphoria or my code or
if that's just how wxEuphoria acts.
Here's my code:
without warning
include wxEuphoria.e
include wxGraphics.e
constant TASKS_FILE = "TODO.txt"
integer fn
fn = open(TASKS_FILE, "r")
if fn = -1 then
fn = message_box( sprintf("Can't open file %s.", {TASKS_FILE}), "", 0 )
abort(1)
end if
sequence tasks
tasks = {}
object line
line = gets(fn)
while sequence(line) do
tasks = append(tasks, line)
line = gets(fn)
end while
constant FRAME = create(wxFrame, {0, -1, "TODO list", -1, -1, 200, 200})
constant WINDOW = create(wxPanel, {FRAME})
procedure print_tasks(atom this, atom event, atom it, atom event_type)
atom dc
dc = create( wxPaintDC, {this})
for i=1 to length(tasks) do
wx_puts({this, 0, (i-1) * 15, dc}, tasks[i])
end for
end procedure
set_event_handler(WINDOW, get_id(WINDOW), wxEVT_PAINT,
routine_id("print_tasks"))
wxMain(FRAME)
The Euphoria Standard Library project :
http://esl.sourceforge.net/
The Euphoria Standard Library mailing list :
https://lists.sourceforge.net/lists/listinfo/esl-discussion
|
Not Categorized, Please Help
|
|