Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, OptimusPrime), 15,359 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
pan_create -- event not working #178394
01/18/08 01:38
01/18/08 01:38
Joined: Mar 2002
Posts: 580
San Francisco
clone45 Offline OP
User
clone45  Offline OP
User

Joined: Mar 2002
Posts: 580
San Francisco
Hello,

I'm trying to do a pan_create like so:

pan_create("bmap = slot_bg.pcx; event = slot_on_click_handler;",3);

Although the bmap seems to be getting set OK, the event does not seem to be triggering when I click on the panel. Any ideas?

My slot_on_click_handler function looks like:

function slot_on_click_handler(PANEL* panel)
{
diag("\n*** TEST! ***\n");
}

Thanks,
- Bret

Re: pan_create -- event not working [Re: clone45] #178395
01/18/08 01:57
01/18/08 01:57
Joined: Mar 2002
Posts: 580
San Francisco
clone45 Offline OP
User
clone45  Offline OP
User

Joined: Mar 2002
Posts: 580
San Francisco
Ah!

Nevermind. I figured it out. I was moving around a panel that tracked my mouse movement. When I clicked, the "floating" panel intercepted the click event.

I modified my code a bit too. Instead of trying to include the event in the pan_create options string, I set it after the panel was created like this:

panel_pointer->event = function_name;

Thanks,
- Bret

Re: pan_create -- event not working [Re: clone45] #178396
02/09/08 18:32
02/09/08 18:32
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
hey im needing to know that too.. how to assign an event to a panel..

Re: pan_create -- event not working [Re: MMike] #178397
03/06/08 07:51
03/06/08 07:51
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
As clone45 said:
panel->event = function_name;

My question would be how to recognize different event_types on a plane (EVENT_CLICK, EVENT_TOUCH, EVENT_RIGHTCLICK,...)

Re: pan_create -- event not working [Re: PadMalcom] #178398
03/07/08 16:48
03/07/08 16:48
Joined: Nov 2007
Posts: 60
D
darci Offline
Junior Member
darci  Offline
Junior Member
D

Joined: Nov 2007
Posts: 60
i´m not surre if i understand you right
maybe that helps

PANEL test_pan =
{//...........................................
bmap = "slot_bg.pcx;";
pos_x = 0;
pos_y = 0;
button (130, 102, "p.bmp", "p.bmp", "p.bmp", function_onclick, NULL, NULL);
//tje button pos must be into the panel or i dosnt´t works
flags = VISIBLE;
}

Re: pan_create -- event not working [Re: darci] #178399
03/07/08 17:03
03/07/08 17:03
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
You can do it like this:

Code:
  
PANEL* Test_pan;

Test_pan = pan_create("button (0,0,Level_element_9.tga,Level_element_9.tga,Level_element_9.tga,SETZEN_ELEMENT,NULL,NULL);",10);
set(Test_pan,VISIBLE);


or like this:

Code:
 
PANEL* Your_pan;
PANEL* My_create(char* content, var layer, var Pos_x, var Pos_y ,char* bitmap, long flags)
{
PANEL* Temp_pan = pan_create(content, layer);
if (bitmap != 0)
{
Temp_pan.bmap = bmap_create(bitmap);
Temp_pan.size_x = bmap_width(Temp_pan.bmap);
Temp_pan.size_y = bmap_height(Temp_pan.bmap);
}
Temp_pan.pos_x = Pos_x;
Temp_pan.pos_y = Pos_y;
set(Temp_pan,flags);
return (Temp_pan);
}
Your_pan = My_create("button(0,0,Your_bmp.tga,Your_bmp.tga,Your_bmp_ok.tga,NULL,NULL,your_func);",5,x,y,NULL,TRANSLUCENT);



Last edited by Widi; 03/07/08 17:10.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1