How does SetVisibleInView command work with elements of list?

János Losonczi shared this question 4 years ago
Answered

Dear All,

I have segments (f, g, h, i) in a list (List1), and I've created a unique list (UniqueList1) from it.

My goal is to set visible / not visible the elements of UniqueList1. I attempted to use SetVisibleInView command without any effect. Here are some of my attempts:


SetVisibleInView(List1, 1, true)         /* no effect
SetVisibleInView(List1, 1, false)        /* no effect
SetVisibleInView(UniqueList1, 1, true)        /* OK
SetVisibleInView(UniqueList1, 1, false)       /* OK
SetVisibleInView(Element(List1, 1), 1, true)        /* no effect
SetVisibleInView(Element(List1, 1), 1, false)       /* no effect
SetVisibleInView(Element(UniqueList1, 1), 1, true)  /* no effect
SetVisibleInView(Element(UniqueList1, 1), 1, false) /* no effect
SetVisibleInView(f, 1, true)       /* OK
SetVisibleInView(f, 1, false)      /* OK
1. My MAIN question is, how to to set visible / not visible the elements of UniqueList1.

2. By the way I'd like to know why SetVisibleInView(UniqueList1, 1, true) does work and SetVisibleInView(List1, 1, true) does not.Best regards, JL

Comments (7)

photo
1

This test.ggb is an attachment for my previous question.

JL

Files: test.ggb
photo
1

A good solution to hide/unhide objects is the property/advanced/conditionToShow in the object himself (no script).

In the attachment one of the possible answers.

I'm not sure to understand the question correct because: to only show/hide A,B....X needs not the 2 lists (only the property conditionToShow in this objects: with the condition "view" for all objects same see version 02)

Maybe you must define the question more exact.

photo
1

My 1st, main question is, that I'd like to switch (ON, OFF) the visibility of the elements of a list in a loop (of course in a script).

Element by element (n) ON, OFF. In a way, like this:

SetVisibleInView(Element(UniqueList1, n), 1, true)

SetVisibleInView(Element(UniqueList1, n), 1, false)

My 2nd question is, that what is the difference (from the point of view of SetVisibleInView command) between List1 and UniqueList1, because SetVisibleInView(UniqueList1, 1, true) does work, and SetVisibleInView(Element(List1, 1), 1, true) does not.


photo
1

Element(List1, 1)
makes a copy of the element which is why
SetVisibleInView(Element(List1, 1), 1, true)

doesn't (can't) work as you want.


What is your overall aim?

photo
1

I have some not unique sets of segments and I want to show / hide random subsets of their unique sets. In order to extract the unique sets, I put into lists the not unique sets, then I created unique lists from them. My next step would be to get random elements from the unique lists and show them in a loop, then hide them in another loop.

Do I understand well, that an element of list itself can't be visible or not visible only it's copy?

photo
1

The answer is yes.

A list is 1 object.

1 object has allway 1 propertie from 1 propertie-type (1 color, 1 show/hide, 1 size etc)

-------------------


But was also is possible:

you have a list l1.

create 2 list more , both based on l1

l2 = all elements from l1 has condition1 true

l3 = all elements from l1 has condition1 false

then hide l1 and show only one of the lists l1 and l2 (or show both with different colors)

attached a sample.

Use the operation "\". This mean all elements from left side there are not elements from right side.

photo
1

I understood the root of my problem already.

Thank you for your help, you may close this topic.

Best regards,

JL

© 2023 International GeoGebra Institute