Gamestudio Links
Zorro Links
Newest Posts
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
2 registered members (AndrewAMD, Ayumi), 1,395 guests, and 4 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
strategy control panel function panelSave #460677
07/10/16 09:31
07/10/16 09:31
Joined: Apr 2014
Posts: 24
yebit Offline OP
Newbie
yebit  Offline OP
Newbie

Joined: Apr 2014
Posts: 24
Using Zorros S 1.44.1

problem: when saving changes to a control panel, Zorro clears all special panel characters that designate whether a cell is f.i a button or editable.

the panel file:
Code:
Hours,@
short hours,#2
medium hours,#8
long hours,#16
 ,@
Periods,@
short period,#3
medium period,#9
long period,#27
longest period,#2
 ,@
bar period (hours),#4
 ,!Save



Then Zorro code:
Code:
static string panelfile = "History\\testpanel.csv";
void click(int row, int col) {
	panelSave(panelfile);
}
function run() {

if (is(INITRUN)) {
		panel(panelfile,GREY,100);
	}
}



the effect of clicking the panel cell button (with the "save" text) results in the following file contents:

Code:
Hours,
short hours,2
medium hours,8
long hours,16
 ,
Periods,
short period,3
medium period,9
long period,27
longest period,2
 ,
bar period (hours),4
 ,Save



which disables the save button and makes each formerly editable cells read only, allowing a one time only changing of stored values.

Does anyone know of a way to keep the original panel formatting when using the panelSave function?

Re: strategy control panel function panelSave [Re: yebit] #460710
07/11/16 12:51
07/11/16 12:51
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
http://manual.zorro-project.com/panel.htm

The function for loading saved panel content is panelLoad(), not panel().

Re: strategy control panel function panelSave [Re: jcl] #460729
07/12/16 03:30
07/12/16 03:30
Joined: Apr 2014
Posts: 24
yebit Offline OP
Newbie
yebit  Offline OP
Newbie

Joined: Apr 2014
Posts: 24
Not entirely true. From the manual:

Quote:

panelLoad (string filename)
Loads the panel content in .csv format from the given file. Only editable or button cells are affected.

panel (string filename, int color, int size)
Opens a control panel with the structure and content from a .csv spreadsheet file. etc


Those definitions should be for all intents and purposes synonymous, unless the intention is to obfuscate. What's more, replacing panel() with panelLoad() results in nothing, no visible panel, so is a less useful, in practice, function than panel().

It is the panelSave() that is removing the formatting in the csv file.

I've moved on in the meantime to using the file_content() function and a configuration file.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1