wcwang@iuvax.cs.indiana.edu (08/20/87)
From: Bill Wang <wcwang@iuvax.cs.indiana.edu>
From ihnp4!attunix!apollo!molson Thu Aug 20 06:37:28 1987
Received: by ihnp4.ATT.COM id AA19151; 19 Aug 87 20:17:13 CDT (Wed)
Received: by apollo.UUCP id AA07017; Wed, 19 Aug 87 17:40:59 edt
From: Margaret Olson <ihnp4!apollo!molson>
Message-Id: <8708192140.AA07017@apollo.UUCP>
Date: Wed, 19 Aug 87 17:35:51 EDT
Subject: dsee popup problem
To: ihnp4!iuvax!wcwang
Cc: schulert
Status: R
Bill,
I'm no Dialog expert, but I have dealt with the problem I think you are
describing. I'll redescribe it just to make sure.
The problem:
There is a popup that upon some action calls a subroutine. If
the subroutine succeeds, the popup should popdown. If the subroutine
fails, the popup should remain visible with it's associated error
condition.
If the .dps just says * popdown, then the popup pops down as soon
as the subroutine exits, along with any error msg. The error message
is impossible to see if the user is not a super-speed reader.
The solution:
The only way to control popups from a program is with task groups.
Defining a task group for every popup is a pain, so what I have done
is define one task group, which pops down whatever thing the locating
cursor is on. When the subroutine is executing the locating cursor is
on the popup that caused the subr to be called, so this works. The only
trick is that the dummy task is never deactivated, and if you just keep
reactivating it dialog won't do the activate action. So you need to
write something to 'really_activate'. really_activate gets the activate
count, deactivates down to zero, and then activates the task.
Here is a simple example, with a popup string. Once you have set this up,
you don't have to modify your .dps for every popup technique. You just
have to remember to call really_activate at the end of every popup-derived
subroutine call.
The .dps:
DIALOG
APPLICATION_INTERFACE foo
popped_string_thing := string:
comp => <call do_string_thing>;
end
dummy_task := null:
end
dummy_task_group := task_group:
tasks = (dummy_task)
end
most_tasks_group := task_group:
tasks = (popped_string_thing)
end
USER_INTERFACE foo
dummy_task_group activate => <* popdown>; /* popdown the popup under the locater */
popped_string_tech := string_field:
task = popped_string_thing;
/* [cr] => <+ accept>, by default if you use dialog_user.ins.dps */
end
popped_string_pop := popup:
contents = popped_string_tech;
end
< more stuff for window >
The application, in c:
void really_activate()
{
int i;
status_$t st;
short count;
dp_$task_get_activate_count(dummy_task_group,count,status);
for (i = 0; i < count; i++)
dp_$task_deactivate(dummy_task_group,status);
/* really activate task! */
dp_$task_activate(dummy_task_group,status);
}
void do_popped_string_thing(task_id,event_id)
dp_$task_id *task_id;
dp_$event_id *evnet_id;
{
if (anything_fails)
dp_$task_notify_msg(*task_id,....)
else
really_activate();
}
Hope this helps,
Margaret Olson
Apollo Computer
molson!apollo
-------
====
Bill Wang
Speech & Hearing Center, Indiana University, Bloomington, IN 47405
UUCP = {ihnp4,seismo,cbosgd}!iuvax!wcwang
CSNET = wcwang@indiana
ARPA = wcwang@iuvax.cs.indiana.edu
Phone = (812) 335-0714