Gamestudio Links
Zorro Links
Newest Posts
Bug in train mode, or it seem to me
by mistery. 09/24/26 17:34
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 09/22/26 12:21
Capital slider is not saving in Z12
by Petra. 09/22/26 06:49
Parent/child object
by VoroneTZ. 09/22/26 05:52
Zorro tutorial ideas?
by AndrewAMD. 09/21/26 14:50
Trades during a running bar
by Martin_HH. 09/21/26 12:03
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (AndrewAMD), 8,001 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Knull, Opus, Jubilee, lopezsergio07, mistery
19240 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Panel event stops after one frame #353665
01/12/11 05:34
01/12/11 05:34
Joined: Jan 2011
Posts: 120
United States
Logan Offline OP
Member
Logan  Offline OP
Member

Joined: Jan 2011
Posts: 120
United States
I'm working on a click-n-drag feature for a specific panel, and I wrote this code:
Code:
function popupbox_click_event();
PANEL* popupbox = 
{
	bmap = popupbox_map;
	layer = 4;
	event = popupbox_click_event;
}

function popupbox_click_event()
{
	while(mouse_left)
	{
		popupbox.pos_x += mickey.x;
		popupbox.pos_y += mickey.y;
		wait(1);
	}
}



It doesn't work. If I am dragging the mouse AS I click on it, it moves a few pixels in the direction the mouse was moving. That's evidence to me that the while() loop ran, but only once. I've tried proc_mode = PROC_GLOBAL; as well as changing the loop to while(1) just for experimentation's sake. It's also true that freeze_mode = 1 when this function runs, but using proc_mode = PROC_NOFREEZE didn't work either. Even worse, if I add a wait(1) to the beginning of the event function, nothing happens at all. So it looks like the engine only gets one frame into the function and then stops for an unknown reason. This looks like a bug to me.

The panel event sample in the manual only sets some values, which would only take one frame anyway, so I couldn't test it to see if it would work. If you need any more information ask away. I am using A8.10 Free.

Re: Panel event stops after one frame [Re: Logan] #353741
01/12/11 16:52
01/12/11 16:52
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
I've tested it and it moves as long as the mouse is clicked. Are you setting 'mouse_mode'?

Also this is a nicer way to write your click event...
Code:
function popupbox_click_event(PANEL* panel)
{
	while(mouse_left)
	{
		panel.pos_x += mickey.x;
		panel.pos_y += mickey.y;
		wait(1);
	}
}



Re: Panel event stops after one frame [Re: DJBMASTER] #353745
01/12/11 17:19
01/12/11 17:19
Joined: Jan 2011
Posts: 120
United States
Logan Offline OP
Member
Logan  Offline OP
Member

Joined: Jan 2011
Posts: 120
United States
Yeah. In a tiny isolated script with just that code, it works, but in my project, it doesn't. I'm trying to isolate each possible reason and test it (e.g. perhaps panel events stop after one frame if there was a pan_setbutton applied to that panel) but I haven't found anything yet. I will post my findings as they come.


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