Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
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
4 registered members (AndrewAMD, 7th_zorro, TedMar, Ayumi), 800 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
panel on_click problem #247858
01/22/09 23:41
01/22/09 23:41
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline OP
Senior Member
Jaxas  Offline OP
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
I can't handle panel on_click function. Here's an example:


////////////////////////////////////////
PANEL* test =
{
pos_x = 100;
pos_y = 100;
layer = 1;
bmap = panel_bmp;
flags = OVERLAY | VISIBLE;
on_click = mouse_use;
}

function mouse_use(panel)
{
test.pos_x = mouse_cursor.x;
test.pos_y = mouse_cursor.y;
}
////////////////////////////////////////////

On_click function doesn't call mouse_use() function. I work with A7.


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: panel on_click problem [Re: Jaxas] #247860
01/22/09 23:51
01/22/09 23:51
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!
Remove :
on_click = mouse_use;
from the PANEL* test
Place this line in a function
like main under a while loop
Now if you want to click on something look for examples of buttons in manual.

This will get you started smile

Ottawa

Re: panel on_click problem [Re: Ottawa] #247865
01/23/09 00:09
01/23/09 00:09
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline OP
Senior Member
Jaxas  Offline OP
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
you see,there are 2 on_click functions,one which used for panels, and second for view. Like you said, to use not in panel, but then on_click will afect view. In Aum48 is morrowing example(Link, direct to code snippets),and inventory.wdl, i tried to do the same thing,but it don't work. I can't understand where's the problem.


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: panel on_click problem [Re: Jaxas] #247866
01/23/09 00:17
01/23/09 00:17
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi Jaxas smile

In a panel definition there are certain codes that you can and
cannot use. Your line "on_click..." should not be there.
I don't know the example your using.
You can place buttons in the panel. You will be
able to clic on these buttons with the mouse and the things that you
have put in a function will be done.

Hope this helps.

Re: panel on_click problem [Re: Ottawa] #247869
01/23/09 00:32
01/23/09 00:32
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline OP
Senior Member
Jaxas  Offline OP
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
but how else i know i'm clicking on panel or not? Here's an example from GameStudio manual:

/////////////////////////////////////////////////////////////

panel.on_click
Instead of the 'global' ON_CLICK function, this given function is performed by left clicking with the mouse pointer anywhere within the panel bitmap, as long as no panel element (like a button) is hit. The panel pointer is passed as optional parameter to the function and can be used for determining which panel was clicked on.
Example:

function redblue(panel); //prototype

PANEL* redpan = { x = 10; y = 20; bmap = redmap; on_click = redblue; }
PANEL* bluepan = { x = 10; y = 40; bmap = bluemap; on_click = redblue; }

function redblue(panel)
{
if (panel == redpan) { print("redpan clicked!"); }
if (panel == bluepan) { print("bluepan clicked!"); }
}

///////////////////////////////////////////////

As you can see,functio on_click are used in panel wink


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: panel on_click problem [Re: Jaxas] #247912
01/23/09 10:55
01/23/09 10:55
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
first its a event = mouse_use;

second its mouse_use(PANEL* pan)

on_lick and panel is c_script


"empty"
Re: panel on_click problem [Re: flits] #247913
01/23/09 11:07
01/23/09 11:07
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline
Expert
Cowabanga  Offline
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Code:
PANEL* test = 
{
	pos_x = 100;
	pos_y = 100;
	layer = 1;
	bmap = panel_bmp;
	flags = OVERLAY | VISIBLE;
	event = mouse_use;
}

function mouse_use()
{
	if(mouse_left == 1)
	{
		test.pos_x = mouse_cursor.x;
		test.pos_y = mouse_cursor.y;
	}
}


This will work! smile

Re: panel on_click problem [Re: Cowabanga] #247944
01/23/09 14:58
01/23/09 14:58
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

I've gone back to the manual and checked for on_click
On_click is an event as was said by Cowabanga

The manual says
Quote:
The on_click function is executed when clicking left with the mouse pointer somewhere
within a VIEW, without hitting any object or panel.


and when clicking in a view an event is activated.
This situation can also be used in panels, which is what your trying to do but there is a difference

Quote:
This function is triggered by left clicking with the mouse pointer anywhere
within the panel bitmap, as long as no panel element (like a button) is hit.


Look up in the index --- event (panel) for the Light-C correct syntax.


On_click in an event but in panel you use the word event.

Hope this is helpfull

Ottawa smile

Re: panel on_click problem [Re: Ottawa] #247959
01/23/09 16:34
01/23/09 16:34
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline OP
Senior Member
Jaxas  Offline OP
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
Solved problem. I set mouse_map to bmap, and on_click work now. Thanks for helping all wink

Last edited by Jaxas; 01/23/09 19:55.

The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)

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