Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
1 registered members (AndrewAMD), 599 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: button in panel only works at pos(0,0) [Re: Lukas] #398647
04/04/12 22:57
04/04/12 22:57
Joined: Mar 2009
Posts: 20
A
atlee Offline OP
Newbie
atlee  Offline OP
Newbie
A

Joined: Mar 2009
Posts: 20
The main bitmap covers the entire window so it is not possible to put the buttons outside the main panel. All of the buttons appear on the main panel, but only one will work at a time from the main panel button function. Perhaps there is a way to use this single button function to call ONE function that could handle many buttons using the button number parameter passed by the button function on the main panel. I don't know how to access that number in order to use it, however.

Re: button in panel only works at pos(0,0) [Re: atlee] #398649
04/04/12 23:08
04/04/12 23:08
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
Well, you could check the mouse position to check which button has been clicked. But normally such a crude workaround shouldn't be necessary, because normally the buttons should work!
Maybe, if you show more of your code, we will be able to see where the error is.

Of course, you can always just use LBGUI. grin

Re: button in panel only works at pos(0,0) [Re: Lukas] #398650
04/05/12 00:13
04/05/12 00:13
Joined: Mar 2009
Posts: 20
A
atlee Offline OP
Newbie
atlee  Offline OP
Newbie
A

Joined: Mar 2009
Posts: 20
This is the code that currently works for a single button:

BMAP* gpsfaset_bmp = "gpsfasetup.bmp";
BMAP* quitprogrambutt_bmp = "quitprogrambutt.bmp";
(The following BMAP* is for a second button)
BMAP* runanalysisbutt_bmp = "runanalysisbutt.bmp";


PANEL* gpsfasetup_pan =
{
layer = 0;
bmap = gpsfasetup_bmp;
button(0,0,quitprogrambutt_bmp,NULL,NULL,quitprogram,NULL,NULL);
flags = SHOW;

PANEL* quitprogrambutt_pan
{
pos_x = 220;
pos_y = 550;
layer = 10;
bmap = quitprogrambutt_bmp;
flags = SHOW;

function quitprogram()
{
sys_exit(NULL);
}

The above code for one button works. But need to add more buttons.The button BMAP runanalysis_bmp needs to run the runanalysis function, for example. Thus, adding a additional button function would seem sensible:

button(0,0, runanalysisbutt_bmp,NULL,NULL,runanalysis,NULL,NULL;

PANEL* runanalysisbutt_pan;
{
pos_x = 80;
pos_y = 550;
layer = 10;
bmap = runanalysis_bmp;
flags = SHOW;
}

This additional code does NOT work. The runanalysis button appears, but calls the quitprogam function, not the runanalysis function as coded. The quitprogram button works properly.

Re: button in panel only works at pos(0,0) [Re: atlee] #398655
04/05/12 06:56
04/05/12 06:56
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Why you define 3 Panels? Try with my code, and if it is working, replace step by step my bitmaps with yours and then the code also.
Code:
#include <acknex.h>
#include <default.c>

PANEL* gpsfasetup_pan;
FONT* font_16 = "Arial#16"; 

BMAP* gpsfasetup_bmp = "#200x100x32";
BMAP* quitprogrambutt_bmp = "#30x30x32";
BMAP* runanalysisbutt_bmp = "#30x30x32";

void quitprogram()
{
	pan_setdigits (gpsfasetup_pan,1,0,0,"BUTTON 1 WAS PRESSED",font_16,1,result);
}

void runanalysis()
{
	pan_setdigits (gpsfasetup_pan,1,0,0,"BUTTON 2 WAS PRESSED",font_16,1,result);
}

void main()
{
	video_mode = 6;
	level_load (NULL);
	
	wait(1);
	
	bmap_fill (gpsfasetup_bmp,vector(150,150,150),100);
	bmap_fill (quitprogrambutt_bmp,vector(0,0,255),50);
	bmap_fill (runanalysisbutt_bmp,vector(255,0,0),50);
	
	mouse_mode = 4;
}

PANEL* gpsfasetup_pan =
{
	pos_x = 10;
	pos_y = 10;
	layer = 1;
	bmap = gpsfasetup_bmp;
	flags = SHOW;
	
	button(10,30,quitprogrambutt_bmp,quitprogrambutt_bmp,quitprogrambutt_bmp,quitprogram,NULL,NULL);
	button(100,30,runanalysisbutt_bmp,runanalysisbutt_bmp,runanalysisbutt_bmp,runanalysis,NULL,NULL;
	
	digits (0,0,"NO BUTTON PRESSED",font_16,1,0);  
}



Last edited by Widi; 04/05/12 06:59.
Re: button in panel only works at pos(0,0) [Re: atlee] #398657
04/05/12 07:59
04/05/12 07:59
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
Originally Posted By: atlee

PANEL* gpsfasetup_pan =
{
layer = 0;
bmap = gpsfasetup_bmp;
button(0,0,quitprogrambutt_bmp,NULL,NULL,quitprogram,NULL,NULL);
flags = SHOW;

PANEL* quitprogrambutt_pan
{
pos_x = 220;
pos_y = 550;
layer = 10;
bmap = quitprogrambutt_bmp;
flags = SHOW;


i dont know if you made this mistake with your post text or
also in your code but i think it would'nt have run if it were in your code
but just mentioning:
Code:
PANEL* gpsfasetup_pan =
{
layer = 0;
bmap = gpsfasetup_bmp;
button(0,0,quitprogrambutt_bmp,NULL,NULL,quitprogram,NULL,NULL);
flags = SHOW;
}<- wheres this missing bracket

PANEL* quitprogrambutt_pan
{
pos_x = 220;
pos_y = 550;
layer = 10;
bmap = quitprogrambutt_bmp;
flags = SHOW;
}<- wheres this missing bracket




Compulsive compiler
Re: button in panel only works at pos(0,0) [Re: Wjbender] #398661
04/05/12 08:16
04/05/12 08:16
Joined: Mar 2009
Posts: 20
A
atlee Offline OP
Newbie
atlee  Offline OP
Newbie
A

Joined: Mar 2009
Posts: 20
Missing brackets were just a posting error on my part.

Re: button in panel only works at pos(0,0) [Re: atlee] #398662
04/05/12 08:25
04/05/12 08:25
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
okay sorry for wasting space in your thread ,confirm widi's code workes on mine


Compulsive compiler
Re: button in panel only works at pos(0,0) [Re: Widi] #398732
04/05/12 19:57
04/05/12 19:57
Joined: Mar 2009
Posts: 20
A
atlee Offline OP
Newbie
atlee  Offline OP
Newbie
A

Joined: Mar 2009
Posts: 20
Widi's code works!
One note: the use of NULL in place of the button bmaps other than bitmapON (the first) does NOT work despite the statement in the user manual to the contrary. Also, mouse_mode 4 is necessary, not mouse_mode 1 which will make the buttons inop.

Thaks to all on the forum who responded.

Page 3 of 3 1 2 3

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