Re: Iconic Buttons and Graphic Boilerplate in Forms 5
Date: 1 Apr 2005 05:20:06 -0800
Message-ID: <1112361606.254512.223420_at_o13g2000cwo.googlegroups.com>
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 Received on Fri Apr 01 2005 - 15:20:06 CEST