Originally Posted By: Pappenheimer
As far as I understand the manual correctly, the event isn't meant for buttons at all.
Why are you not satisfied with the way how it works?
Do you want that the event only happens when clicking at a certain area of the panel?
Then you can compare the panel's position with the position of the mouse pointer and write a restriction in the event to a certain rectangle of the panel...

I thought there was some easier way to create buttons for various functions with the same function. But it's true, I can create a function in a certain region of the window, I don't remembered of this. Thanks for help!


Originally Posted By: muffel
You can pass a function of this type
function foo()
or of this type
function foo( var button , PANEL *pan )
to the button

But you pass a function of this type
function foo( PANEL *pan )
to the button.
Maybe this dont work.

muffel

hey muffel, I did a workaround here and worked, but I want know the method that you showed me. Would code be so?
Code:
#include <acknex.h>
#include "default.c"

BMAP* PanelImage = "panel_image.png";
BMAP* ButtonImage = "button_image.png";

function MoveWindow(var button, PANEL* _panel_sel);

PANEL* PanelTest={
        layer=2;
        bmap=PanelImage;
        pos_x=50;pos_y=50;
        button(0,0,ButtonImage,ButtonImage,ButtonImage,MoveWindow,NULL,NULL);
}

function MoveWindow(var button, PANEL* _panel_sel){
	var click_offset[2];
	click_offset[0]=_panel_sel.pos_x - mouse_pos.x;
	click_offset[1]=_panel_sel.pos_y - mouse_pos.y;
	while(mouse_left==ON){
		proc_mode = PROC_EARLY;
		_panel_sel.pos_x = mouse_pos.x+click_offset[0];
		_panel_sel.pos_y = mouse_pos.y+click_offset[1];
		wait(1);
	}
}

function main(){
        ....
        wait(2);
        set(PanelTest,SHOW);
}


I did an test here, and it not worked. How Can I to associate the parameter button?
Thanks!