Incomplete control definitions in SubScripts

Moderators: TomKerekes, dynomotion

Post Reply
LarryJD
Posts: 15
Joined: Wed Sep 01, 2021 6:15 pm

Incomplete control definitions in SubScripts

Post by LarryJD » Thu Sep 16, 2021 10:00 pm

Hi,

I've been working on a screen that is defined with the constant screen content in a main screen script file and the dynamic content specified in individual subscript files. This makes it much easier to add and maintain the screens since the dynamic content can be implemented in small subscript files that don't replicate the entire screen content.

When I saw the 4.3.5f patches (9/13/21) that was made in relation to this discussion viewtopic.php?t=1422&p=4757 I thought I'd see if I could take advantage of a couple of great features in that patch: 1) partial control definitions in subscripts and 2) repainting controls when the text or color changes. Both of these feature would really simplify my subscripts. #1 removed the maintenance challenge of making sure all files are update when a control on the main part of the screen is repositioned, resized, etc. #2 removes the need to set a control to hidden and back to visible to get to to repaint after changing the text or color.

The sample provided loaded the subscript via C code using the ScreenScript() function. I need to load the subscripts in button actions. However that doesn't seem to work for feature #1. What happens is it accepts the subscript file with incomplete control definition but clears the field that are not specified, e.g. position, size, show, etc. Would it be possible to extend this functionality to subscripts loaded by button actions?

Feature #2 works fine if the control is fully specified in the subscript.

Thanks,
Larry

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

Re: Incomplete control definitions in SubScripts

Post by TomKerekes » Fri Sep 17, 2021 4:58 pm

Oops I responded here by mistake.
Regards,

Tom Kerekes
Dynomotion, Inc.

LarryJD
Posts: 15
Joined: Wed Sep 01, 2021 6:15 pm

Re: Incomplete control definitions in SubScripts

Post by LarryJD » Sat Sep 18, 2021 11:27 pm

I may have found a bug with the incomplete control definitions subscripts. It looks like a SubScript triggered by a button action that includes another SubScript doesn't work.

I've attacked a set of simple test screen scripts:
- SimpleTest.scr is the Main screen
- SimpleTestA.scr is the SubScript triggered by the A button
- Same for B and C
- SimpleTestCleanup.scr is a subscript included by each of the button SubScripts

The Screen layout has:
- a label control at the top that displays the status updated by each button SubScripts
- the three buttons
- next to each button is a label displayed when its associated button has been pressed
- under the buttons is a static label defined by the Main page and not changed by the buttons
- under that is a button that will force the cleanup SubScript to run, used to confirm that the cleanup Subscript functions correctly

1) Expected behavior when page loads:
- Status label reads "No Button Selected"
- All buttons are shown as not selected (Darker color background)
- Label controls to the right of each button are all hidden

2) Expected behavior when an initial button is pressed:
- Button pressed displays as selected (lighter button color background color)
- Status label at the top of the screen shows which button was pressed
- Label, to the right of the button pressed, is displayed

3) Expected behavior when a subsequent button is pressed:
- All other buttons are set to the not selected background color
- Labels to the right of all other buttons are set to hidden
- Same as #2 above

Observation:
The first two steps listed in #3 above do not happen, indicating that the cleanup SubScript is not executing.
Pressing the "Force Cleanup" button causes the cleanup SubScript to execute and the expected result is observed

I've also found that the base page cannot be initially loaded by the Screen Editor. It hides the button clicked and hides the Status label. However if it's loaded by the GCodeConigCNC.txt file it works as described above. If the Screen Editor is used after that, it continues the function as above.
Attachments
SimpleTestCleanup.scr
(224 Bytes) Downloaded 55 times
SimpleTestC.scr
(330 Bytes) Downloaded 57 times
SimpleTestB.scr
(330 Bytes) Downloaded 62 times
SimpleTestA.scr
(329 Bytes) Downloaded 57 times
SimpleTest.scr
(52.57 KiB) Downloaded 57 times
Thanks,
Larry

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

Re: Incomplete control definitions in SubScripts

Post by TomKerekes » Sun Sep 19, 2021 5:20 pm

Hi Larry,

The SubScript is called with:

SubScrpt:SimpleTestCleanup.scr

instead of

SScript:SimpleTestCleanup.scr

SScript is the command to execute a Screen Script file. SubScript on the first line of a file tells the Screen Processor that it is not a complete screen description and to not reset all controls to defaults beforehand.

Currently unrecognized Screen Script types are ignored. Probably better for us to display as an error. I realized this after making changes to allow comments with a "#' as the first character and realized the change wasn't necessary.

Thanks for the simple example.
Regards,

Tom Kerekes
Dynomotion, Inc.

LarryJD
Posts: 15
Joined: Wed Sep 01, 2021 6:15 pm

Re: Incomplete control definitions in SubScripts

Post by LarryJD » Sun Sep 19, 2021 9:10 pm

Hi Tom,

I'm sorry for taking your time, I don't know how I missed that. Couldn't see the forest for the trees thing I guess.

Thank you very much for your quick response and patients.
Thanks,
Larry

Post Reply