1

I'm trying to use a textedit widget in a window I have created and activated, but the textedit is not being properly redrawn. For example, when you press backspace, the cursor backs up and the character is removed from the buffer, but it is left on the screen. If you then type another, it will then replace the other one on the screen. When I try to isolate the code (as below), it works fine, and I can't figure out why this works and my program doesn't.

(P.S., If I build this code with OPTIMIZE_RAM_CALLS, it crashes with the message "Line 1111 Emulator" on the TI-89 Titanium. Is this a bug?)
#include <tigcclib.h> #define BUFFER_SIZE 200 TEXT_EDIT gsTextEdit; CALLBACK void textEventHandler(EVENT *psEvent) { if (psEvent->Type == CM_KEYPRESS && psEvent->extra.Key.Code == KEY_ENTER) ER_throw (1); /* Exit the event loop */ if (!TE_handleEvent (&gsTextEdit, psEvent)) EV_defaultHandler (psEvent); } void _main(void) { WINDOW sWindow; HANDLE hInputBuffer; char *pInputBuffer; if (!WinOpen(&sWindow, &(WIN_RECT){ScrRect->xy.x0, ScrRect->xy.y0, ScrRect->xy.x1, ScrRect->xy.y1}, WF_NOBORDER)) return; WinFont(&sWindow, F_6x8); WinActivate(&sWindow); WinClr(&sWindow); sWindow.Flags &= ~WF_DIRTY; hInputBuffer = HeapAlloc(BUFFER_SIZE); pInputBuffer = HeapDeref(hInputBuffer); memset(pInputBuffer, 0, BUFFER_SIZE); TE_openFixed(&gsTextEdit, &sWindow, &(WIN_RECT){10, 10, 159, 17}, pInputBuffer, BUFFER_SIZE - 1, TE_MORE_ELLIPSES); TE_select(&gsTextEdit, 0, 0); CU_start(); /* Start the cursor */ EV_captureEvents (textEventHandler); TRY EV_eventLoop (); ONERR EV_captureEvents (NULL); ENDTRY CU_stop(); /* Stop the cursor */ HeapFree(hInputBuffer); WinClose(&sWindow); }

2

Without your complete, compilable testcase, there's no way people can debug your issue. The only code you posted is the one which doesn't reproduce it!

I suspect your issue is that the complete program is not using the event loop properly. Any refreshes are done in the event loop.
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

3

Kevin Kofler (./2) :
Without your complete, compilable testcase, there's no way people can debug your issue. The only code you posted is the one which doesn't reproduce it!

I suspect your issue is that the complete program is not using the event loop properly. Any refreshes are done in the event loop.


Yes, I know, that's what's frustrating me. That code is pretty much exactly what I have in the whole program. I just copy-pasted it together. (It's the exact same event callback). I was half hoping someone would be able to say "Aha! you're not setting attribute X on your window, which is needed for TextEdit to work reliably." Anyway, I'll see if I can narrow down where things are going wrong, and hopefully create a properly broken testcase.

Unfortunately, I can't share the actual source because the copyright belongs to my university.

4

I'd expect the GCC4TI developers to treat any source code you send to them for debugging purposes in a strictly confidential way. The TIGCC Team definitely does. So copyright should not be an issue.
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

5

Okay, I finally (after several days) managed to track down the problem. It appears that my WIN_RECT was getting corrupted, such that x1 < x0. Now that it is a valid WIN_RECT, all is good.

Sorry for the post, and thank you for your response.

-- Erik