[comp.windows.x] Message boxes and other questions

arne@yc.estec.nl (Arne Lundberg) (03/29/89)

I have some questions about the X toolkit and the HP X widgets.


1) I would like to have a function that displays a message box on the
   screen containing several pushbuttons.  And returns back to the
   calling function an indication of which button the user pressed.  I
   would like to use this for asking questions of the type

	------------------------------- 
        | 'Are yoy sure?  (YES) (NO)  |
	-------------------------------

   and get the answer back in a single function call.

   I can get the box and the buttons etc on the screen.  The problem is
   that I have to exit the function in order to come back to XtMainLoop
   and at that moment I don't which button the user will press.

   Is this possible to do?  How?

   I have previosly done some programming with HP's XrLib for X10 and
   in that library was built for this way of usage.
   
2) I want to have a bitmap created by bitmap(1) #included in my program
   and converted to a XImage suitable for use with the static raster
   widget.  How is this done?

3) I am using the pulldown menu manager of the HP X widgets.  Using this
   menu manager I can create 'pullright' submenus for all menupanes
   except the first one.  Is this a known limitation in the X widgets?


Thanks in advance for all help.

-- Arne Lundberg; ESTEC/YCV, The Netherlands
   arne@yc.estec.nl || arne@esatst.UUCP || ALUNDBER@ESTEC.BITNET

mac@trantor.harris-atd.com (Mike McDonald) (03/30/89)

In article <1014@esatst.yc.estec.nl> arne@yc.estec.nl (Arne Lundberg) writes:
>   
>2) I want to have a bitmap created by bitmap(1) #included in my program
>   and converted to a XImage suitable for use with the static raster
>   widget.  How is this done?
>
>-- Arne Lundberg; ESTEC/YCV, The Netherlands
>   arne@yc.estec.nl || arne@esatst.UUCP || ALUNDBER@ESTEC.BITNET

     I just tried to do the same thing today. There is an example
of this in the HP widget code. The file of interest is 
Xw/CreateTile.c. HP's basic stratigy if to create a Pixmap with 
the raster in it, create an XImage, and then use XPutImage to 
copy the Pixmap into the XImage. If my understanding of Pixmaps 
is correct, it's the responsibility of the Xlib's Pixmap routines
to correct the byte ordering, bit ordering, etc. for the server. 
XImages on the other hand are the responsibility of the user. 


  Hope this helps,



  Mike McDonald

  mac@trantor.harris-atd.com
  postmaster@trantor.harris-atd.com
  (407) 727-5060

  Advanced Technology Dept.
  Harris Corp.
  M.S. 3A-1912
  P.O. Box 37
  Melbourne, Florida
             32902

duanev@kauai.ACA.MCC.COM (Duane Voth) (03/31/89)

In article <1014@esatst.yc.estec.nl>, arne@yc.estec.nl (Arne Lundberg) writes:
> 1) I would like to have a function that displays a message box on the
>    screen containing several pushbuttons.  And returns back to the
>    calling function an indication of which button the user pressed.
>    The problem is
>    that I have to exit the function in order to come back to XtMainLoop
>    and at that moment I don't which button the user will press.

I ran across this problem too.  Insisting on returning back to
XtMainLoop makes the application code look realy ugly.  Calling
XtMainLoop from within the function that displays the popup
widget implies abuse ala setjmp/longjmp (gag!).  XtMainLoop
(XtAppMainLoop actually :) however is very straight forward
and I can see no problem with duplicating the loop in your own
function:

    while (global_var_that_gets_set_via_a_pushbutton) {
        XtAppNextEvent(app, &event);
        XtDispatchEvent(&event);
    }

seems to perform admirably *and* looks pretty too.  If the Xaw
folks have a better way, I'd like to hear about it.  This may
also be an R3 only solution - I'm not familiar with R2.

-- 
--- Effectiveness is the measure of Truth:
----            ALL systems are arbitrary!
--- duane voth              duanev@mcc.com
--