1 registered members (AndrewAMD),
1,203
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Pointer in the button
#370522
05/13/11 17:54
05/13/11 17:54
|
Joined: Dec 2010
Posts: 16 Brazil, Limeira, SP
Andre_Fernando
OP
Newbie
|
OP
Newbie
Joined: Dec 2010
Posts: 16
Brazil, Limeira, SP
|
Hi! Is there a way to create a pointer in the button? (I don't know if it's a pointer in this case) For exemple: I created a window in "PANEL" and a button like a icon bar, and the button function is move window. I used code bellow:
function MoveWindow(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);
}
}
PANEL* PanelTest={
...
event = MoveWindow;
}
Okay, but there are many windows I'm going to create in the script. Is there a way to create a function to all buttons with the same function "MoveWindow()"? If I put a event in panel, It work! But I wanted it to be in the button. Someone know? Thanks guys!
|
|
|
Re: Pointer in the button
[Re: Andre_Fernando]
#370561
05/14/11 00:10
05/14/11 00:10
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
I don't understand, can you describe your problem in different words? Have you had a look at button(x, y, bmapOn, bmapOff, bmapOver, functionOn, functionOff, functionOver); already? FunctionOn can be replaced with your MoveWindow function if I understand you correctly.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: Pointer in the button
[Re: muffel]
#371034
05/17/11 13:25
05/17/11 13:25
|
Joined: Dec 2010
Posts: 16 Brazil, Limeira, SP
Andre_Fernando
OP
Newbie
|
OP
Newbie
Joined: Dec 2010
Posts: 16
Brazil, Limeira, SP
|
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! 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?
#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!
|
|
|
|