Odd Warn() behavior

9 views
Skip to first unread message

Carlo Hogeveen

unread,
Jul 11, 2023, 6:05:30 AMJul 11
to Semware @ GoogleGroups

I am reporting this as just an odd inconvenience, easily ignored or
worked-around.
The context is the latest Windows GUI TSE version.
As discussed in the past, I can understand why Warn() must use a Windows
pop-up instead of a TSE pop-up during TSE's start-up.
But the example macro below waits until the editor is (started up and) idle,
and then still uses a Windows pop-up instead of a TSE pop-up.
Using a list the example macro also shows that TSE pop-ups are possible from
the _idle_ state.

Carlo



proc idle()
integer lst_id = 0
UnHook(idle)
PushLocation()
lst_id = CreateTempBuffer()
AddLine('This is a list presenting a TSE pop-up.')
List('Warning', 40)
PopLocation()
AbandonFile(lst_id)
Warn('This is a Warn() presenting a Windows pop-up. Why?')
PurgeMacro(CurrMacroFilename())
end idle

proc WhenLoaded()
Hook(_IDLE_, idle)
end WhenLoaded




zhong zhao

unread,
Jul 12, 2023, 4:54:17 AMJul 12
to SemWare TSE Pro text editor
Warn() let TSE leave idle status,I guess.

Carlo Hogeveen

unread,
Jul 12, 2023, 5:46:37 AMJul 12
to sem...@googlegroups.com

zhong zhao wrote:
> Warn() let TSE leave idle status,I guess.

That is not how TSE works. Just the opposite.
I expect that to decide which pop-up to use, Warn() should look at whether the editor has finished starting up instead of whatever it is currently looking at.

Aside:
According to TSE's QueryEditState() statement, there is no separate "idle state".
It has the same value as the main editing loop: 0.
In other words, the "idle state" is the main editing loop.

Carlo



S.E. Mitchell

unread,
Aug 24, 2023, 9:34:11 PMAug 24
to sem...@googlegroups.com
On a call to warn(), the editor calls this routine:
bool GUIidleAndSafe(void) {
return idle_hook_called == 0 && cmQueryEditState() == 0;
}

If it returns true, the character mode msgbox is called, otherwise,
the Windows MessageBox is called.
idel_hook_called is <> 0 whenever an idle macro has been called.

int cmQueryEditState(void) {
int state = 0;
if (menu_level) state |= STATE_MENU;
if (process_in_window_level)state |= STATE_PROCESS_IN_WINDOW;
if (popn - popn_base) state |= STATE_POPWINDOW;
if (warn_level) state |= STATE_WARN;
if (twokey_level) state |= STATE_TWOKEY;
if (editor_paused) state |= STATE_EDITOR_PAUSED;
if (u.read_in_use) state |= STATE_PROMPTED;
if (otherwise_busy) state |= STATE_BUSY;
return state;
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/semware/000601d9b4a5%24bec81f10%243c585d30%24%40ecarlo.nl.

Carlo Hogeveen

unread,
Aug 27, 2023, 7:32:08 AMAug 27
to sem...@googlegroups.com

Sammy,

Disclaimer: I do not want to suggest changing GUIidleAndSafe(), because it might be used elsewhere for other purposes.

From my outside point of view, it seems that GUI TSE's Warn() test's
idle_hook_called == 0 && cmQueryEditState() == 0;
should be
idle_hook_called != 0 || cmQueryEditState() == 0;

As per my original post, the purpose of the change would be to not use a Windows pop-up for Warn() when a standard TSE pop-up would work too, which I think is the case during an _idle_ hook.

Carlo
To view this discussion on the web visit https://groups.google.com/d/msgid/semware/CA%2BgEvkZ_7dTF2faPFtXeDRYVBd92ysj14yqPdL6-RW%3DUiRE5WA%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages