Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to set their own handlers for hyperlinks #1152

Closed
yusdacra opened this issue Jan 23, 2022 · 2 comments · Fixed by #1506
Closed

Allow users to set their own handlers for hyperlinks #1152

yusdacra opened this issue Jan 23, 2022 · 2 comments · Fixed by #1506
Labels
feature New feature or request

Comments

@yusdacra
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I want to be able to handle link opening myself, such that I can use different code for different protocols, and other stuff like being able to open the link in a seperate tab on web, rather than the current tab.

Describe the solution you'd like
This could easily be implemented via just passing a closure to the hyperlink widget.

Describe alternatives you've considered
None?

Additional context
Nothing.

@yusdacra yusdacra added the feature New feature or request label Jan 23, 2022
@emilk
Copy link
Owner

emilk commented Feb 5, 2022

I think this could be implemented in another way:

If we add a new widget LinkButton that just takes a label (no URL) and does nothing on click, then you could do it yourself:

if ui.add(LinKButton::new("Documentation")).clicked() {}

It would look the same as HyperLink but have no click response, no url, and now hover text. Hyperlink could use LinkButton internally.

@yusdacra
Copy link
Contributor Author

yusdacra commented Feb 5, 2022

I think this could be implemented in another way:

If we add a new widget LinkButton that just takes a label (no URL) and does nothing on click, then you could do it yourself:

if ui.add(LinKButton::new("Documentation")).clicked() {}

It would look the same as HyperLink but have no click response, no url, and now hover text. Hyperlink could use LinkButton internally.

Yeah that would work better, more composition 😅

emilk added a commit that referenced this issue Apr 16, 2022
This looks like a Hyperlink, but doesn't do anything when clicked.
Or rather: it lets the user decide what happens on click.

Closes #1152
@emilk emilk mentioned this issue Apr 16, 2022
emilk added a commit that referenced this issue Apr 16, 2022
This looks like a Hyperlink, but doesn't do anything when clicked.
Or rather: it lets the user decide what happens on click.

Closes #1152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants