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 (Ayumi, NewbieZorro, TipmyPip), 13,888 guests, and 6 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
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