Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,499 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 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 | chip programmers | 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