A New Design for the Top Bar?

Request a new command, feature, or improvement

Moderator: MSandro

User avatar
Calloway
Posts: 100
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Re: A New Design for the Top Bar?

Post by Calloway » May 20th, '18, 15:52

So the run down for this would be Startup.gp->applySettings.gp->(parses JSON file for style)->(sets global variables)->openProjectEditor.gp

User avatar
Calloway
Posts: 100
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Re: A New Design for the Top Bar?

Post by Calloway » May 20th, '18, 15:55

What if an input isn't recognized, for example no input when asking for a colour or a letter when it's supposed to be a number? Would it go to 'nil', 0, some default value that is set by the applySettings.gp, error out and tell the user?

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Re: A New Design for the Top Bar?

Post by MSandro » May 20th, '18, 15:57

I qm not sure exactly, but you should set default values if some value is missing

User avatar
Calloway
Posts: 100
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Re: A New Design for the Top Bar?

Post by Calloway » May 20th, '18, 16:00

okok that sounds good,
Have you already tried implementing this or nah?

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Re: A New Design for the Top Bar?

Post by MSandro » May 20th, '18, 16:02

I am working on it.

User avatar
Calloway
Posts: 100
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Re: A New Design for the Top Bar?

Post by Calloway » May 20th, '18, 16:05

oo really? Hows it working out for you? I wish i could help more :/

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Re: A New Design for the Top Bar?

Post by MSandro » May 20th, '18, 18:34

I have a problem where you could possibly help me: On my GP Settings menu I want to use "(askUser 'set the stage width:' '800') this is the (ask '') block which is available in Sensing. But I am not able to use it in the ProjectEditor for my confStageResolution methonde. If I use "ProjectEditor" instead of "Page" I got a error. But if I use "Page" GP frezes if I call ths method. It also doesn't matter if I use "to" instead of "method".

Code: Select all

method confStageResolution Page {
  answ = (askUser 'set the stage width:' '800')
}
This also doen't work:

Code: Select all

method confStageResolution Page {
  answ = (call (action 'askUser' 'set the stage width:' '800'))
}
I am not sure what I'm doing wrong
Maybe you will find the solution.

EDIT: I've found the solution, I had to use prompt instead of askUser.

User avatar
Calloway
Posts: 100
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Re: A New Design for the Top Bar?

Post by Calloway » May 20th, '18, 18:58

When you change the resolution of the stage I'm pretty sure it freezes GP and/or it might be because you have to be in Morphic then change the stage height/width then go into the project editor for it to work without errors, although this is just speculation and I'm not 100% positive...

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Re: A New Design for the Top Bar?

Post by MSandro » May 20th, '18, 19:05

That is not the problem atm, I know that GP needs to be restarted for the changes to take effect. I currently try to open a text-box to enter the resolution, but I am not able to call "askUser" out of the ProjectEditor. At the moment, I only want the user to be able to enter the width of the stage resolution. I currently trying to create the menu and the graphical interface for the settings. Menus succeed me very well, but I can call a text input.

Here is my ProjectEditor. Search for "//Settings" to find my code.
Attachments
ProjectEditor.gp
(25.21 KiB) Downloaded 2152 times

User avatar
Calloway
Posts: 100
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Re: A New Design for the Top Bar?

Post by Calloway » May 20th, '18, 21:15

I'm pretty sure the problem is that you're using 'call'
In place of 'call', try using return

code:

Code: Select all

to confStageResolution {
  answ = (return (action 'askUser' 'set the stage width:' '800'))
}
(Maybe take out the first set of parentheses in the code if it doesn't work)

If this still fails then try converting it to a string first then calling it, such as in:

Code: Select all

to confStageResolution {
  answ = (call (toString (askUser 'Set the stage width:' '800')))
}
(Again. take out the first set of parentheses in the code if it doesn't work)

Post Reply