SetCaption of Element from list

bostonquad shared this question 6 years ago
Answered

I've made a list of points A and B. The list is named "points".

I can change A's caption directly with this...

  1. SetCaption[A, "X"]

but trying to change a point by accessing it via the list like this...

  1. SetCaption[Element[points, 2], "Y"]

doesn't work. Am I doing something wrong? (.ggb file attached.)

Comments (8)

photo
1

elements of list has not its own properties

and

the captions is only the showed name; it is not usefull in a command (ie: setcaption[A,"X"] setvalue[X,(0,0)] does not change A)

photo
1

So is there no way to set the caption of an object stored in a list?

If so, that's very disappointing. I want to label an unknown number of points. (The number of points is set by a slider, and then the points are automatically generated in a list.)

photo
1

hello


  1. and then the points are automatically generated in a list.)

that means: a list is generated by the points

you can created points A1,A2,A3,.......... in the spreadsheet, captions of points in B1,B2,B3,............... marks for each point (ie:yes/no or 1,2,3,4,5...) in C1,C2,C3...........

then set the captions for Ai using %c (https://www.geogebra.org/ma...)

then create the list using Keepif and zip

it is possible there is a simpler method, now I do not imagine it

saludos

photo
1

Thank you mathmagic. I've been looking at the Spreadsheet commands, but I'm not sure that can accomplish what I'm trying to do. I've attached a .ggb that helps to show what I want to accomplish. Note that the number of points can increase, decrease, and change position. The first point is labelled A, and I'd like like to label the others appropriately. Is this possible?


Sorry if mathmagic has already pointed me in the right direction, and I'm having trouble seeing it. I tried implementing mathmagic's suggestion, starting by using FillColumn to copy the generated points into Column A, but that just duplicated points in the Graphics view. I felt like I was heading down the wrong path.

photo
2

I have created A1:C2 typing definitions, then drag&drop creates the next rows

select A10,B10,C10 then drag-down&drop the little blue square in down-right corner of rectangle of selection, for more points, until maximum value of points slider

if you want label A1,A2,A3, it is not necesary the C column. you can define the points in A: A1=first point A2=A1+1/points u then down-copy draggin; if you want different caption you can edited the C column(ie:C1="A_{" + A1 + "}" then down-drag&drop,then F9)


see the trick in properties->advanced->condition to show object for showing the interesting points

BTW: formulas with x(A) and y(A) at once are necessary few times; better formulas with the whole name of point (see the list definition)

photo
1

Wow, thanks!

photo
3

Hi,

try :

Sequence[Text[CaptionFree(i), points(i) + (0.5, 0.5)], i, 1, Length[points]]

with :

CaptionFree = {"A", "B", "C"}

or

CaptionFree = {"X", "Y", "Z"}

see script OnClic buttons.

...

photo
1

Great, I see how you're doing that! Thanks Patrick!


In fact, thanks to both mathmagic and Patrick for your quick replies and working solutions!

© 2023 International GeoGebra Institute