Checkbox and setFixed (still?) doesn't work in some cases?

johnbmaths shared this question 1 month ago
Needs Answer

As a fairly recent returnee to GGB after a good while away from it I have encountered a number of issues which have severely restrict elegant solutions via scripting both GGB and JS.

For example, on looking through previous threads going back years there seems to be an issue with setFixed for some objects. I can get setFixed(obj,false) to work as a command, GGB script, JS i.e. to unfix an object so it can be moved via setCoords(obj,x,y) except with checkbox which seems to be a problematic entity. A number object with display properties apparently. Although lacking a directly accesible position property a checkbox can be moved around which I need if it were unfixed. However the problem comes if you create one via a script you cannot then unfix it.

A previous suggestion for this sort of defect of preparing one or more of whatever object in advance and setting it unfixed is all well and good if you know how many you need. It would also be OK if you were able to copy an object and keep it's properties which you can't as copyFreeObject uses default properties for object types so if you copy a free unfixed object the copy is fixed and other properties are not carried over.

I asked recently for Duplicate to be considered for adding as a command rather than a manual only facility which would be a big improvement and would alleviate the problem of not being able to change properties reliably in code but this was rejected so I am pretty much left with messy fixes of providing an excess or too few of hidden objects "I might just need" all pre hard coded with names. Doesn't bear thinking about and hardly good precise Maths. Unless anyone has a good suggestion please?

Comments (3)

photo
1

Please post a simple .ggb file showing the problem

photo
1

File with 1 checkbox "a" fixed and selection disallowed posted as requested.

setFixed(a,false,true) leaves "a" fixed but allows selection. As afr as I can see fixed can only be removed manually via accessing settings and not via command or script. As an additinal aside duplicating a non fixed checkbox produces a fixed copy so not a true duplicate.

photo
1

Further to previous description of the "fixed" issue I now find that if a checkbox is unfixed when that file is loaded again the checkbox again becomes fixed. This renders any degree of automation with checkboxes impossible as you can't move them without manual intervention to "unfix". Fortunately buttons and input boxes escape this issue but regrettably no way of altering the inputbox length from script. Has to be done manually.

This needs fixing!. Sorry couldn't resist the pun.

© 2021 International GeoGebra Institute