[comp.sys.sun] help needed with Sunview Application

STRIANTAFYLL%KOSDS1@gmr.com (S. Triantafyllopoulos) (05/30/89)

I need some help in doing a relatively (:-)) simple thing on SunView.
(The machine is a Sun 386i / 250, running SunOS, release 4.0.1) I have an
application that uses a two-level button menu, like this:

Entry Panel  -- This is the          Panel after user selects EDIT
initial panel when program first     from Entry Panel. A-F are the
runs. EDIT produces panel shown      editing options, RETURN returns
right, QUIT confirms and quits.      to Entry Panel.

+-------------------------------+    +------------------------------+
+-------------------------------+    +------------------------------+
|  _________       __________   |    |  ___    ___    ___    ___    |
| ( EDIT    )     ( QUIT     )  |    | ( A )  ( B )  ( C )  ( D )   |
|  ---------       ----------   |    |  ---    ---    ---    ---    |
|                               |    |  ___    ___    __________    |
|                               |    | ( E )  ( F )  ( RETURN   )   |
|                               |    |  ---    ---    ----------    |
+-------------------------------+    +------------------------------+

I create the frame as usual, then a panel on top of that as usual, then
define the entry panel buttons, then go into window_main_loop(); 

init_entry_menu_buttons() sets up the two buttons, EDIT & QUIT.

In the entry_menu_button_handler, when EDIT is signalled, I call
a routine to destroy the entry_menu_buttons using the SUNVIEW
routine destroy_panel_item(button...). Then, it calls a routine
init_edit_menu_buttons that initializes the edit buttons A-F & RETURN.

----------- PROBLEM ------------------------------------------------

The problem seems to be the following: When I try to destroy all the items
of the entry panel (EDIT & QUIT) so that the edit buttons can be displayed,
the button that was pressed to bring the edit buttons (EDIT) STAYS there
after I release the mouse. 

The image of the EDIT button stays on the screen but is not selectable. 
Moreover, this ghost image seems to screw up the edit mode buttons as well. 

I think that the image is created and is non-selectable because of the
re-painting that is done after I return from the button handler. I.e. when
the button EDIT is pressed, everything is deleted and the new buttons are
painted, but when control returns, the EDIT image is somehow restored (it
was ``blackened'' when pressed).

I have tried quite a few things and do not seem to be able to get anywhere. 

Do I have to do some more magic to delete buttons; according to the FM 
delete_panel_item's about all it is to delete items. Do I have to write
my own event handler? Manipulate the event queue? ??????

Your help on the subject will be appreciated. Please send e-mail to any
of the addresses below.

Thank you in advance!

Spiros


Spiros Triantafyllopoulos           spiros@gmr.com
Delco Electronics, Kokomo, Indiana  spiros%gmr.com@relay.cs.net
(317) 451-0641                      striantafyll%kosds1.gm@hac2arpa.hac.com

chuck@trantor.harris-atd.com (Chuck Musciano) (06/09/89)

> The problem seems to be the following: When I try to destroy all the items
> of the entry panel (EDIT & QUIT) so that the edit buttons can be displayed,
> the button that was pressed to bring the edit buttons (EDIT) STAYS there
> after I release the mouse. 

Instead of destroying and recreating the buttons, just set the
PANEL_DISPLAY_ITEM attribute to FALSE.  The buttons will disappear.  You
can make them come back by setting the value to TRUE.  I don't know if
this will cause redisplay problems like the panel_destroy_item() routine.
I seem to recall having used this technique without any problems.

Chuck Musciano				ARPA  : chuck@trantor.harris-atd.com
Harris Corporation 			Usenet: ...!uunet!x102a!trantor!chuck
PO Box 37, MS 3A/1912			AT&T  : (407) 727-6131
Melbourne, FL 32902			FAX   : (407) 727-{5118,5227,4004}

Oh yeah, laugh now!  But when the millions start pouring in, I'll be the one
at Burger King, sucking down Whoppers at my own private table! --Al Bundy