View Full Version : Iconic Buttons and Graphic Boilerplate in Forms 5
McCormick
03-17-2005, 02:08 PM
What I want to do is put a graphic of an envelope on my form (under
Forms 5.0.6) where the user can click on it to open up another canvas
to edit an address. I know I can use an iconic button, but I am not
happy with the border that comes with all buttons. Importing a graphic
onto the canvas doesn't help because Canvases and Windows have no
triggers associated with them.
I've tried putting a button with the Visible Property off over the
graphic, but it's invisible to the Mouse Pointer as well as the Window.
I've tried putting an ON-MOUSE-CLICK trigger on the block, but that
only triggers when I click on an item belonging to that block. Any
clickable item I put over the graphic occludes it.
I've tried putting an ON-MOUSE-CLICK trigger on the Form itself. That
works, in its way, but I'd have to hard code the coordinates of the
graphic into the trigger function. FIND_ITEM and GET_ITEM_PROPERTY do
not appear to work on canvas graphics.
If anyone knows a way to make a graphic image clickable, or how to
get rid of the borders around a button, I would love to hear it.
Thanks!
Mike McCormick
McCormick
04-01-2005, 05:20 AM
I figured out a solution, but it's kind of ugly. I put the graphic on
the canvas, then I put a button with the Visible property set Off over
it. In a form level WHEN-MOUSE-CLICK trigger I put code like:
IF ( :SYSTEM.MOUSE_ITEM IS NULL ) THEN
IF HIT( 'CUSTOMER.CUST_ADDY_BUTTON' ) THEN
....
where the HIT function looks like:
FUNCTION HIT (item_name VARCHAR2) RETURN BOOLEAN IS
v_mouse_x NUMBER;
v_mouse_y NUMBER;
v_item_x NUMBER;
v_item_y NUMBER;
v_item_width NUMBER;
v_item_height NUMBER;
item_id ITEM;
BEGIN
v_mouse_x := CEIL(TO_NUMBER( :System.Mouse_X_Pos ));
v_mouse_y := CEIL(TO_NUMBER( :System.Mouse_Y_Pos ));
/* Get the id of the "hidden" button */
item_id := Find_Item(item_name);
IF Id_Null(item_id) THEN
NOTE('No such item: '||item_name);
RETURN FALSE;
END IF;
v_item_x := CEIL(TO_NUMBER( GET_ITEM_PROPERTY( item_id, X_POS )));
v_item_y := CEIL(TO_NUMBER( GET_ITEM_PROPERTY( item_id, Y_POS )));
v_item_width := CEIL(TO_NUMBER( GET_ITEM_PROPERTY( item_id, WIDTH
)));
v_item_height := CEIL(TO_NUMBER( GET_ITEM_PROPERTY( item_id, HEIGHT
)));
IF ( v_mouse_x < v_item_x OR v_mouse_x > (v_item_x + v_item_width) )
THEN
RETURN FALSE;
END IF;
IF ( v_mouse_y < v_item_y OR v_mouse_y > (v_item_y + v_item_height) )
THEN
RETURN FALSE;
END IF;
END;
It works, but it is ugly and I'd hate to be the one who'd have to
come in and modify it later. Back to iconic buttons.
Mike McCormick
MyLounge.com Site Map
Forum:
Cars,
Cell Phone,
Database,
Games,
Home Improvement,
IT,
Music,
School,
Sports,
Web Design,
Web Server,
Weight Loss
The MyLounge.com forum is intended for informational use only and should not
be relied upon and is not a substitute for any advice. The information contained
on MyLounge.com are opinions and suggestions of members and is not a representation
of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for
the accuracy, completeness or usefulness of any postings or the qualifications
of any person responding. Please consult a expert or seek the services of an
attorney in your area for more accuracy on your specific situation. Please note
that our forums also serve as mirrors to Usenet newsgroups. Many posts you see
on our forums are made by newsgroup users who may not be members of MyLounge.com
Term of Service
vBulletin v3.0.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.