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
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
6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,268 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
pan_setstring - epic fail #411642
11/18/12 14:52
11/18/12 14:52
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Code:
BMAP * AppletCalender_Background = "images\background.png";
STRING * MonthYear = "April 2008";
////////////////////////////////////////////////////////////////////////////////////////////////////
PANEL * Calender =
{
	bmap =  AppletCalender_Background;
	
	digits(20,20,"","Arial#15",1,0);
	digits(00,40,5,"#50",1,sys_day);
	
	digits(20,100,MonthYear,"#20",1,0);
	flags = TRANSLUCENT;
}
int main ()
{
	STRING * Weekdays[7];
	Weekdays[1] = " Monday";
	Weekdays[2] = " Tuesday";
	Weekdays[3] = "Wednesday";
	Weekdays[4] = "Thursday";
	Weekdays[5] = " Friday";
	Weekdays[6] = "Saturday";
	Weekdays[7] = " Sunday";
	
	STRING * Months[12];
	Months[1] =  " January ";
	Months[2] =  " February ";
	Months[3] =  "  March   ";
	Months[4] =  "  April   ";
	Months[5] =  "   May    ";
	Months[6] =  "  June    ";
	Months[7] =  "  July    ";
	Months[8] =  " August   ";
	Months[9] =  "September ";
	Months[10] = " October  ";
	Months[11] = " November ";
	Months[12] = " December ";
	
	STRING * Year = "               ";
	str_for_num(Year,sys_year);
	error(Weekdays[sys_dow]);
	pan_setstring(Calender,1,20,20,"#15b",Weekdays[sys_dow]);
	
	set(Calender,SHOW);
	STRING * MonthYear = str_cat((Months[sys_month]),Year);
	
}



There's the code.
I encounter 2 invalid arguments.The error(msg) show the string that I expect(Sunday).But one Invalid Argument is from pan_setstring and one more is by the last statement of the function.

What's possibly wrong here??

Thanks


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: pan_setstring - epic fail [Re: Yashas] #411645
11/18/12 14:58
11/18/12 14:58
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You shouldn't assign character arrays to STRING pointers.

char* != STRING* !

Please read the manual section concerning strings.


Always learn from history, to be sure you make the same mistakes again...
Re: pan_setstring - epic fail [Re: Uhrwerk] #411652
11/18/12 15:31
11/18/12 15:31
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Thanks ,Going through the manual wink


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: pan_setstring - epic fail [Re: Uhrwerk] #411657
11/18/12 16:01
11/18/12 16:01
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Originally Posted By: Uhrwerk
You shouldn't assign character arrays to STRING pointers.

char* != STRING* !

Please read the manual section concerning strings.


I have gone through the manual.
And I changed all STRING * to char *.
I don't get any "Invalid Arguments" but as soon as I start a Windows Dialog Box pops up saying "acknex.exe has stopped working....".

The error is in the line "set(Calender,SHOW);".
(Tested, When I remove it everything goes fine)


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: pan_setstring - epic fail [Re: Yashas] #411659
11/18/12 16:47
11/18/12 16:47
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
this is because digits only can show STRING* and not char*
you've gone the wrong way


Visit my site: www.masterq32.de
Re: pan_setstring - epic fail [Re: MasterQ32] #411822
11/20/12 10:21
11/20/12 10:21
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
I added a str_create while providing pan_setstring.Compiles well.

If I "set(Calender,SHOW)" it crashes ,I get a Windows Message "acknex.exe has stopped working"

Current Code:
Code:
BMAP * AppletCalender_Background = "images\background.png";
STRING * MonthYear = "April 2008";
////////////////////////////////////////////////////////////////////////////////////////////////////
PANEL * Calender =
{
	bmap =  AppletCalender_Background;
	
	digits(20,20,"ABC","Arial#15",1,0);
	digits(00,40,5,"#50",1,sys_day);
	
	digits(20,100,MonthYear,"#20",1,0);
	flags = TRANSLUCENT;
}
int main ()
{
	char * Weekdays[7];
	Weekdays[1] = " Monday";
	Weekdays[2] = " Tuesday";
	Weekdays[3] = "Wednesday";
	Weekdays[4] = "Thursday";
	Weekdays[5] = " Friday";
	Weekdays[6] = "Saturday";
	Weekdays[7] = " Sunday";
	
	char * Months[12];
	Months[1] =  " January ";
	Months[2] =  " February ";
	Months[3] =  "  March   ";
	Months[4] =  "  April   ";
	Months[5] =  "   May    ";
	Months[6] =  "  June    ";
	Months[7] =  "  July    ";
	Months[8] =  " August   ";
	Months[9] =  "September ";
	Months[10] = " October  ";
	Months[11] = " November ";
	Months[12] = " December ";
	
	STRING * 
	STRING * Year = "               ";
	str_for_num(Year,sys_year);
	error(Weekdays[sys_dow]);
//	pan_setstring(Calender,1,20,20,"#15b",str_create(Weekdays[sys_dow]));
	
	set(Calender,SHOW);
	STRING * MonthYear = str_cat(str_create(Months[sys_month]),Year);
	
}



Thanks


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: pan_setstring - epic fail [Re: Yashas] #411824
11/20/12 10:32
11/20/12 10:32
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
Code:
//pan_setstring(Calender,1,20,20,"#15b",str_create(Weekdays[sys_dow]));

pan_setstring(Calender,1,20,20,font_create("Arial#15b"),str_create(Weekdays[sys_dow]));



smile

Last edited by 3dgs_snake; 11/20/12 10:33.
Re: pan_setstring - epic fail [Re: 3dgs_snake] #411828
11/20/12 10:50
11/20/12 10:50
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
That's not the prob.
"acknex.exe has stopped working..." when I do set(Calender,SHOW);


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: pan_setstring - epic fail [Re: Yashas] #411831
11/20/12 10:54
11/20/12 10:54
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Fixed, did a font_create and it works!!!

But a question , when I set a element in a panel, I directly "Arial#25" ;provide a string but in case of pan_set.. I need to add a font_create.Why??


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: pan_setstring - epic fail [Re: Yashas] #411838
11/20/12 11:25
11/20/12 11:25
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
In the manual, when you create an element in a panel :

font : TrueType or bitmap character set for the display. Either a predefined FONT, or A6.6 a font filename or Truetype font name with size and style (like "Arial#24bi") can be given. If '*' ist given, the engine standard font is used.

with pan_set :

font : FONT *

wink

Page 1 of 2 1 2

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