Currently Online

Latest Posts

Topic: hyperlinks

kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 20:48
Posts: 2397
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2024-01-03, 18:41

I have a question regarding the documentation for links. The doc says:

  • type: Mandatory. What kind of link. Can be "url" or "ui".
  • target: Mandatory. The URL to open or the UI widget to reference.
  • action: Mandatory for UI links: the action to perform. Not allowed for URLs.

If i choose "ui" for the type the target is a ui-widget, e.g. a window or a button?
I don't understand the attribute action. The term action let me assume i can define, or call, a function here but this is obviously a wrong assumption. It seems the only occurrence of this type of links currently implemented are the links to/inside the encyclopedia. But there the action is just a string, not an "action" as i understand the term. It is more like an argument which will be passed to a function. So what is the meaning of action ?

If the target is an ui widget and the action is an argument for a function, how is this function be called (i know that signals are involved here), and where can such a function be defined and probably registered? Is this only possible in the c++ source code and not in lua?

Totally confused about a term face-grin.png


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1917
OS: Debian Unstable
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2024-01-03, 19:39

The "target" is the internal name of the UI widget that you want to handle the hyperlink. Each widget can define its own set of accepted action strings. Currently the only UI widgets that can function as hyperlink targets are the encyclopedia and the help window.

The help window (name "encyclopedia_window") accepts as action the name of a building, worker, or ware, and will load and display the help for this object.

The encyclopedia (name "encyclopedia") acts much the same but additionally accepts immovables and terrains.

Sending a hyperlink to a widget that cannot handle hyperlinks will result in an error.

Edited: 2024-01-03, 19:40

Top Quote