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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, alibaba), 1,426 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
event of panel's button #341020
09/09/10 17:41
09/09/10 17:41
Joined: Jun 2010
Posts: 30
rangpur,bangladesh
J
Jahid Offline OP
Newbie
Jahid  Offline OP
Newbie
J

Joined: Jun 2010
Posts: 30
rangpur,bangladesh
i am trying to make a gui control.
but my button is not respondig on corresponding event.
i am new in lite c and first time with gui cintrols.
i have made this code after reading PANEL chapter from manual.i have also tried to EVENT chapter. may be i need to read more.
i have tried.but failed to figure out where is the problem in my code.

it will be helpful if someone point out me to those required chapter related to panel event
and
where is my mistake in this code and what to write to activate those button.

here is my code:

#include <default.c>
#include <stdio.h>

enable_mouse = 1;

function func_on()
{printf("func_on");}


function func_off()
{printf("func_off");}

function Click()
{printf("button has been Clickcked");}

function Leave()
{printf("button has been leaved");}

function Over()
{printf("mouse is Over this button ");}

PANEL* pan =
{
size_x = 800;
size_y = 600;

bmap = BG.pcx;//image size is 800*600

//all images used in button is 200*100

button(350,200,SG.pcx,SG.pcx,SG.pcx,func_on,func_off,Over);
button_radio(350,265,SG.pcx,OP.pcx,QG.pcx,Click,Leave,Over);
button_toggle(350,320,SG.pcx,OP.pcx,SG.pcx,QG.pcx,Click,Leave,Over);

flags = SHOW;
}


function main()
{

screen_color.red =255;
screen_size.x = 1000;
screen_size.y = 800;
video_screen=1;

}



keep moving forward
Re: event of panel's button [Re: Jahid] #341022
09/09/10 18:14
09/09/10 18:14
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
When you read the manual you should read all the lines to understand the given definition.
For example there is definition for the button in the manual like this:
button(x, y, bmapOn, bmapOff, bmapOver, functionOn, functionOff, functionOver);

Now you have to read more, because you don't know what is x, y, bmapOn and so on.

You read the next lines and this word Parameters catches your eyes. You can shout; Oh i got it!
The third line after the Parameter writes this:
Quote:
bmapOn Bmap displayed when the button is switched on; gives also the size of the button.

Now you know you should use a BMAP to show your button, and you know your declaration SG.pcx will not fit for the proper showing of the button.
You look up for BMAP. You read all the lines and so on. This is the way how you have to use/read the manual.
One hint at the end:
Code:
BMAP* bmapSG = "SG.pcx";


And:
Code:
button(350,200,bmapSG,bmapSG,bmapSG,func_on,func_off,Over);



Last edited by Aku_Aku; 09/09/10 18:15.
Re: event of panel's button [Re: Aku_Aku] #341053
09/10/10 01:09
09/10/10 01:09
Joined: Jun 2010
Posts: 30
rangpur,bangladesh
J
Jahid Offline OP
Newbie
Jahid  Offline OP
Newbie
J

Joined: Jun 2010
Posts: 30
rangpur,bangladesh
Aku_Aku,first time i have used BMAP*.after that i have used image files directly to test.there was no difference.so i had decided to use image file directly.may be it can save a bit of ram.
may be i was wrong.but what is the advantage of using BMAP*.
what u are meaning by this :
bmapOn Bmap displayed when the button is switched on; gives also the size of the button.

when i am directly using images,is not compiler able to find the size of the button?only using BMAP* can give it.
i am from c++.pointer does not work in this way in c++.may be it is a matter of compiler.i do not know about compiler's aecitecture.

all though,i have done it.but it is not the way i am looking for.


keep moving forward
Re: event of panel's button [Re: Jahid] #341054
09/10/10 01:11
09/10/10 01:11
Joined: Jun 2010
Posts: 30
rangpur,bangladesh
J
Jahid Offline OP
Newbie
Jahid  Offline OP
Newbie
J

Joined: Jun 2010
Posts: 30
rangpur,bangladesh
i have done it.it is not the way i am looking for.it has to do in runtime using pan_setbutton().
but there is a problem.in window mode,it is ok.no problem.
but in fullscreen mode:i can not see mouse pointer .
but clicking is working.i mean when some how mouse pointer goes on button it works.the problem is:i am not seeing the mouse pointer.

here is the code:

#include <default.c>
#include <stdio.h>

//all images used in button is 200*100BMAP*bmap_sg="SG.pcx";
BMAP* bmap_click = "OP.pcx";
BMAP* bmap_over = "QG.pcx";
BMAP* bmap_normal = "SG.pcx";

function func_on()
{printf("func_on");}

function func_off()
{printf("func_off");}

function Click()
{printf("button has been Clickcked");}

function Leave()
{printf("button has been leaved");}

function Over()
{printf("mouse is Over this button ");}

PANEL* pan =
{
size_x = 800;
size_y = 600;
bmap = BG.pcx;//image size is 800*600
flags = SHOW;
}



function main()
{

screen_color.red =255;
screen_size.x = 800;
screen_size.y = 600;
video_screen=1;
mouse_mode = 4;

pan_setbutton(pan,0,1,350,200,bmap_click,bmap_normal,bmap_over,NULL,Click,Leave,Over);

}


keep moving forward
Re: event of panel's button [Re: Jahid] #341076
09/10/10 12:50
09/10/10 12:50
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
you'll need to set mouse_map when using full_screen

Re: event of panel's button [Re: MrGuest] #341089
09/10/10 15:23
09/10/10 15:23
Joined: Jun 2010
Posts: 30
rangpur,bangladesh
J
Jahid Offline OP
Newbie
Jahid  Offline OP
Newbie
J

Joined: Jun 2010
Posts: 30
rangpur,bangladesh
MrGuest,no result;
i have tested it by this panel defination and code:


BMAP* maus = "maus.pcx"; //32*32
PANEL* pan =
{
size_x = 800;
size_y = 600;
layer=1;
bmap = main_menu.pcx;//image size is 800*600
mouse_map = maus;
flags = LIGHT | SHOW;
}



//other code lines

function main()
{
enable_mouse = 1;
mouse_map = maus;

//set(mouse_map,maus);--------!!!!!!!!!no effect,!!!!!!no error!!!!!

//other code lines

}



Last edited by Jahid; 09/10/10 15:24.
Re: event of panel's button [Re: Jahid] #341112
09/10/10 21:36
09/10/10 21:36
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
Why did you define mouse_map for the panel?

Re: event of panel's button [Re: Aku_Aku] #341114
09/10/10 22:39
09/10/10 22:39
Joined: Jun 2010
Posts: 30
rangpur,bangladesh
J
Jahid Offline OP
Newbie
Jahid  Offline OP
Newbie
J

Joined: Jun 2010
Posts: 30
rangpur,bangladesh
First time I have tested it in panel defination.
Then only in main().
Finally,in both place.no result.
From ur asking,it seems that i have to use it in some other place.where?
I have done all these things from manual.may be there was two example.plz see in manual.it is 4 a.m.no electricity for raining.
If Again false reading?then i am really a bad reader. I have stuck here for 3.5 days.i am trying to make a gui just like san andress and cod4.


keep moving forward
Re: event of panel's button [Re: Jahid] #341116
09/10/10 23:20
09/10/10 23:20
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
Use the mouse_map out of panel, put it into your main function.
Hopefully that solves your problem.

Edit: if you use the manual, don't stop at the first place. When you search for the mouse_map, you definitely got more than one hit. Please read all of them.

Last edited by Aku_Aku; 09/10/10 23:22.

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