This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 11 - Pages: 1 - Last Post: 26-Oct-2017 12:40 Last Post By: RobM
AndreWolff

Posts: 2,131
Registered: 14-Dec-2007
Parameter not checked on close project
Posted: 17-Oct-2017 19:34
 
  Click to reply to this thread Reply
I added a new parameter in my onload.bsh file:
JCheckBox useWholeWindow = new JCheckBox("Image should fill the whole view-port");
slideImage.add("br",ui.useWholeWindow);
file headless-settings.jap contains:
skin.useWholeWindow=false
If I change the value of this check-mark and next close the jAlbum project, it is not asked whether the new value should be saved. If I re-open the project, I see the new value is not saved.

The new parameter is only saved if I use the File / Save menu item.

Why don’t see I the question ‘Save changes to the project?’ if the new parameter is changed?

Jalbum version 14.1.13 and Windows 10.

Edit:

This problem is independent of the skin, I see it too with the Minimal skin:
		JCheckBox responsiveSlides = new JCheckBox("Responsive slides", true);
		JCheckBox useWholeWindow = new JCheckBox("Image should fill the whole view-port");
		ControlPanel aa = new ControlPanel() { // Invisible container to control sizes of boxes within it
			ControlPanel allPagesPanel = new ControlPanel() {
				{
					setTitle("All Pages");
					add(new JLabelFor("Album font size", albumFontSize));
					add("tab", albumFontSize);
					add(new JLabelFor("px", albumFontSize));
					add("br", useLineborder);
					add("br", new JLabelFor("Border width", borderWidth));
					add("tab", borderWidth);
					add(new JLabelFor("px", borderWidth));
					add("br", new JLabelFor("Border padding", borderPadding));
					add("tab", borderPadding);
					add(new JLabelFor("px", borderPadding));
					add("br", fixedShapeThumbs);
					add("br", keyboardNavigation);
					add("br", useWholeWindow);
				}
So I think it is a bug in jAlbum.

Edited by: AndreWolff on 18-Oct-2017 09:27
davidekholm

Posts: 21,450
Registered: 18-Oct-2002
Re: Parameter not checked on close project
Posted: 18-Oct-2017 13:31   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
It does ask whether I wish to save changes when testing on Minimal here. What checkbox in Minimal did you test with?
jGromit

Posts: 33,170
Registered: 31-Jan-2006
Re: Parameter not checked on close project
Posted: 18-Oct-2017 13:39   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
David, this occurs if you don't provide a default value for the checkbox (true/false), and then change it from false to true the first time you access it. Once you've changed it and saved the project, any subsequent changes do, in fact, trigger the save dialog.
AndreWolff

Posts: 2,131
Registered: 14-Dec-2007
Re: Parameter not checked on close project
Posted: 18-Oct-2017 14:34   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
It does ask whether I wish to save changes when testing on Minimal here. What checkbox in Minimal did you test with?
David I did add a new checkbox useWholeWindow as you can see in the code above.
davidekholm

Posts: 21,450
Registered: 18-Oct-2002
Re: Parameter not checked on close project
Posted: 18-Oct-2017 14:40   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
What if you include the default for this component in a SkinModel file?
AndreWolff

Posts: 2,131
Registered: 14-Dec-2007
Re: Parameter not checked on close project
Posted: 18-Oct-2017 15:04   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
What if you include the default for this component in a SkinModel file?
No problem if I use this code:
JCheckBox useWholeWindow = new JCheckBox("Image should fill the whole view-port", false);
The problem occurs only if I use this code:
JCheckBox useWholeWindow = new JCheckBox("Image should fill the whole view-port");
jGromit

Posts: 33,170
Registered: 31-Jan-2006
Re: Parameter not checked on close project
Posted: 18-Oct-2017 16:11   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
What if you include the default for this component in a SkinModel file?

It prompts for a project save if you define a default setting either in onload.bsh or in SkinModel.java. It prompts for a project save if you don't define any default anywhere, but then save the project - from then on, it always detects changes. It fails only upon the initial, "choose the skin and change that variable."

OT, but why is the SkinModel file in the distributed version of Minimal called SkinMode-disl.Java?
davidekholm

Posts: 21,450
Registered: 18-Oct-2002
Re: Parameter not checked on close project
Posted: 19-Oct-2017 14:51   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
davidekholm wrote:
What if you include the default for this component in a SkinModel file?

It prompts for a project save if you define a default setting either in onload.bsh or in SkinModel.java. It prompts for a project save if you don't define any default anywhere, but then save the project - from then on, it always detects changes. It fails only upon the initial, "choose the skin and change that variable."

OT, but why is the SkinModel file in the distributed version of Minimal called SkinMode-disl.Java?

Good. Oh, that was a test file that has been disabled. I'll delete it from the next distribution.

RobM

Posts: 4,382
Registered: 4-Aug-2006
Re: Parameter not checked on close project
Posted: 19-Oct-2017 17:05   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
What if you include the default for this component in a SkinModel file?
jGromit wrote:

It prompts for a project save if you define a default setting either in onload.bsh or in SkinModel.java. It prompts for a project save if you don't define any default anywhere, but then save the project - from then on, it always detects changes. It fails only upon the initial, "choose the skin and change that variable."

Good.
Is this a bug in Beanshell? If so I can update the wiki to show default values should always be specified either within the GUI code and/or in SkinModel.java
AndreWolff

Posts: 2,131
Registered: 14-Dec-2007
Re: Parameter not checked on close project
Posted: 25-Oct-2017 14:07   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Well David, what is your decision:
are you going to repair this bug or do you generate an error message if no a default value for a checkbox is used?
davidekholm

Posts: 21,450
Registered: 18-Oct-2002
Re: Parameter not checked on close project
Posted: 25-Oct-2017 15:25   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
I won't spend time with it now at least
RobM

Posts: 4,382
Registered: 4-Aug-2006
Re: Parameter not checked on close project
Posted: 26-Oct-2017 12:40   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
I won't spend time with it now at least
I have updated the documentation at Organisation of a skin to show default values need to be specified. If this changes in the future I’’ll remove the note.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums