Re: XForms: XForms, cursors and others (fwd)

vsexton (vsexton@sirinet.net)
Tue, 03 Nov 1998 22:49:21 -0600

# To subscribers of the xforms list from vsexton <vsexton@sirinet.net> :

Joao Filipe Ferreira wrote:

>
> Three problems arise:
>
> - Firstly, the colormap. Is there anyway in XForms to make the two
> windows, i.e. the one with the original and the one with the
> magnified version, share the same colormap? Please give me
> a simple XForms solution, if there is such a thing, as reading
> the XWindows System manuals has already given me a headache.
> Time is crucial!
>
> - Secondly, defining a suitable cursor. I would like a rectangular
> cursor with the size of the region to be magnified; unfortunatly
> I tried to read the "cursors.c" demo source and understood very
> little - most of it uses things not explained on the online
> manual. Any help here?
>
> - Finaly, the positioning of the forms. All the examples and
> the online manual always position the forms at the center of
> the screen. Thus, I fail to understand how one may position
> them elsewhere. It is very important for me to do so, since I
> would like to create a system with multiple windows/forms. Any
> sugestions?
>
> I need an answer until the end of the week to be succesful, and I would
> be deeply grateful if you manage to send it to me before that deadline. If
> it happens that there is no way of doing so, please answer me anyway -
> sooner or later I will use the information anyhow.
>

Well, I cannot help much with 1, but I can give you a quick process for the cursor, and where
to look for window placement.
First, create the cursor pixmap (or in this case, a bitmap) using the program __bitmap__.
This is a black and white only program, but you may change colors later. Before you begin
filling in the the pixel squares, you may resize the bitmap using the Resize option under the
File menu. Choose the size you want, e.g. 100x100. I presume you want a square or rectangle,
so fill in a 2-pixel wide square in the grid -- BUT leave the outermost pixels blank. You
need these for the mask. After you have made your cursor design, place the 'hotpoint' and
save the file. Now fill in the pixels to either side of the cursor design -- therefore making
it 4 pixels thick. This will be your mask. Clear the hotpoint and do a SAVEAS to another
file name.
Include these where you will be creating your cursor. Now you should be able to follow
cursor.c for the most part. Open your cursor and mask files to find the constant identifiers
for the hotpoint coordinates and height and width values for using in routines such as
fl_create_from_pixmapdata(). You may also use a routine (I forget what the name is) to set
the 2 colors to whatever you want, or just leave them as black and white. The mask makes the
cursor 'stand out' on a similar-colored background, so make it a color opposite that of the
cursor. I recommend you leave it as black and white for now.
You may now set the cursor to your pixmap as in cursor.c!
Another recommendation is to call fl_check_forms() after setting and resetting the cursor.
You will need to play around with the size of the cursor. 100x100 may not be large enough. A
typical cursor arrow uses 16x16.

As for the window placement, look in your XForms manual for the settings FL_PLACE_FREE,
FL_PLACE_POSITION, FL_PLACE_MOUSE, etc. for options on how to place your window other than at
the center. These are used in place of FL_PLACE_CENTER in the fl_show_form() function call.

I hope this was clear enough, and that it helps.

Veronica Sexton

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/