How to make a tool usable a few times

Lukas Vizek shared this question 2 years ago
Answered

Hello,

I wonder how I could make a tool disappear after being picked up and used. Let me explain it.

I’d like to create a GeoGebra applet (as a part of a construction activity). I want to use only selected tools. I know that I can customize the tool bar. Moreover, I’d like to use certain tool only a few times. For example, there is the tool “circle with center through point” on the tool bar of the applet and it is possible to use it just for one time. It means that if I use this tool, i.e. I draw a circle, I’m not able to use it any more, i.e. I can’t draw any other circle. And if I delete the circle, I can use the tool, I’m able to construct the circle...

I’m thinking about other functionality. Is it possible to force GeoGebra to construct some object while using certain sequence of tools? I mean this: Can I prepare an activity (applet) which can be solved by the use of (for example) “point”, “point”, “line segment”, “circle with center and radius”, “intersection”, “center or midpoint”, “perpendicular line”? How can I do that? Any idea?

Thanks a lot!

Lukas

Comments (11)

photo
1

Maybe possilble with JavaScript: ggbApplet.setMode() changes the selected tool

photo
1

la page des "modes" (anglais) est ici


“point”, 1

“line segment”, 15

“circle with center and radius”, 34

“intersection”, 5

“center or midpoint”, 19

“perpendicular line”, 4

photo
1

mon brouillon


@Mike (ou Raymond ?)

j'ai perdu du temps avant de tester en ligne, avec mon GGb5 Classic desktop 5 le passage à l'étape 3 construisait un segment fantôme ????)

photo
1

Hi Noèl,

Le plus grand problème est de déterminer l'état actuel du "compteur d'utilisation" d'un outil particulier. Lors de la suppression, plusieurs objets dépendants ayant des origines d'outils différentes peuvent être affectés. Le paramètre ggbApplet.setOnTheFlyPointCreationActive(<boolean>) est également important dans ce contexte.

L'approche de solution suivante sera peut-être utile :

Pour chaque outil, un outil personnalisé est créé, qui est appelé via un bouton. L'outil personnalisé crée des objets de texte invisibles en plus des objets. Celles-ci contiennent une chaîne de reconnaissance et le nom du compteur concerné. La valeur actuelle du compteur est recalculée dans un JS à chaque appel d'outil. Les valeurs des compteurs sont utilisées dans la coditionToShow des boutons.

Dans l'ensemble, c'est assez élaboré. En plus de cela, le sens du feature n'a pas vraiment de sens pour moi. Je veux dire : aussi les mauvaises manières d'atteindre un objectif favorisent l'apprentissage. Les solutions ne doivent donc pas être limitées.

Salutations

Ramond

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

Das grösste Problem ist die Ermittlung des aktuellen Standes des "Benutzungs-Zählers" für ein bestimmtes Tool. Beim Löschen können mehrere abhägige Objekte mit unterschiedlicher Toolherkunft betroffen sein. In diesem Zusammenhang ist auch der Parameter ggbApplet.setOnTheFlyPointCreationActive(<boolean>) von Bedeutung.

Vielleicht ist der folgende Lösungsansatz zielführend:

Pro Tool wird ein custom-tool erstellt, das über einen button aufgerufen wird. Das custom-tool erstellt zusätzlich zu den Objekten jeweils nicht sichtbare Text-Objekte. Diese enthalten einen Erkennungs-String sowie den Namen des betroffenen Zählers. Mit jedem Tool-Aufruf wird in einem JS der aktuell Zählerstand neu errechnet. Die Zählerstände werden in coditionToShow der buttons verwendet.

Alles zusammen recht aufwändig. Kommt noch dazu, dass mir der Sinn des Features nicht wirklich einleuchtet. Ich meine: gerade die Irrwege zu einem Ziel fördern das Lernen. Deshalb sollten die Lösungswege nicht eingeschränkt werden.

photo
1

Bonjour Ramond,


aussi les mauvaises manières d'atteindre un objectif favorisent l'apprentissage. Les solutions ne doivent donc pas être limitées.


tout à fait d'accord


Salutations

photo
photo
1

euh mon fichier en ligne fonctionne avec FireFox mais pas avec Chrome !!!!


.... si des fois, si j'insiste ... j'ouvre le lien, essaye le fichier, tout disparaît, rafraichis la page, et là ça fonctionne ???

photo
1

@Lukas Vizek

Please make a sample

- Picture of finish construction

- List of constructions steps as text

for example: {1, used Tool, what tool disappear after this step}......{nn, used Tool, what tool disappear after this step}

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

I think your other question is a custom tool

Give the description of a sample

photo
1

j'en reste là, à défaut de réaction du demandeur


https://www.geogebra.org/m/tbxr8rx8

photo
1

...

photo
1

Dear all,

Thank you very much for your comments on my question. I appreciate it. I have to note two points. First, I like the solution by @Noel Lambert. Second, I'm beginner in scripting.

So, please apologize my asking now. I'd like to create ggb file with this property related to my previous question: There is a figure on graphics. I want it to become a tool. See the attachment as an example. We can think about three versions:

  1. When we click on the figure, the tool Line is selected. We can construct lines as many as we want.
  2. We click on the figure, the tool Line is selected, we construct one line. Then the tool Move ("arrow") is selected automatically. We can click again on the figure, the tool Line is selected, we construct one line. Then the tool Move ("arrow") is selected automatically etc.
  3. We click on the figure, the tool Line is selected, we construct one line. Then the tool Move ("arrow") is selected automatically. We cannot click again on the figure, because it disappear. When we delete the line, we can use the figure again, because it reappears.

So, I don't want to work with the toolbar. The question is, what do I need to write as the script in each cases? What to input to the properties of the figure? I read the commands on https://wiki.geogebra.org/e..., but I don't know the structure of scripting language, if I may say so. I'm sorry about that.

I look forward to your ideas.

Best,

Lukas

© 2023 International GeoGebra Institute