Quantcast Display text instead of link in EditBox? - ESOUI
Thread Tools Display Modes
07/24/19, 06:06 PM   #1
Phuein
 
Phuein's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 96
Post Display text instead of link in EditBox?

I've been looking around, but it looks like all the text fields display only the links. I'd like to toggle my EditBox to display the text of the link instead. It would show the following in plain text:

Code:
|H1:achievement:1820:1:1563935869|h|h

|H1:item:105814:364:50:0:0:0:0:0:0:0:0:0:0:0:1:20:0:1:0:10000:0|h|h

|H1:book:3542|h|h
Any clues? The EditBox is in Lua and I found no useful references.
__________________

Author of beloved and rejuvenated addons:

• ShowMount            • PvP FPS 2018

• Notebook 2018        • Junkee 2018

• BestFriends 2018      • New Addon
  Reply With Quote
07/25/19, 01:52 AM   #2
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 244
you can use GetItemLinkName(string itemLink) maybe?
__________________
EU Server - SŁĄuGhTerHΨuSe
  Reply With Quote
07/25/19, 06:43 AM   #3
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,491
Originally Posted by Scootworks View Post
you can use GetItemLinkName(string itemLink) maybe?
This would only show the item's name but Phuein want's to see the link's complete text instead of the "generated link" from the text.

If the editbox alwasy changes the text to show as link there must be some underlying function or method which parses the contents and creates the link.
Do you use a template for your editbox or what type of control do you create the editbox with? Maybe you can "inherit" from another type of editbox (maybe a LAM 2.0 editbox if it does not the same ZOs box converting the contents to an itemlink) or overwrite your editbox function which generates the itemlink from the text contents (guess it must be something like OnTextChange or something like that?).

If I mark an itemlink via mouse and press CTRL+C I'll have the "|H1:item:1058..." in my clipboard so it basically uses the text and just "shows it differently".
  Reply With Quote
07/25/19, 07:45 AM   #4
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 679
Found this, didn't test:

Code:
h5. AllowMarkupType
* ALLOW_MARKUP_TYPE_ALL
* ALLOW_MARKUP_TYPE_COLOR_ONLY
* ALLOW_MARKUP_TYPE_NONE
There's xml attribute allowMarkupType as well as Get/Set methods on EditBox control.
  Reply With Quote
07/25/19, 08:59 AM   #5
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,491
From this file:
https://github.com/esoui/esoui/blob/...ingeditbox.lua

I found the following function's line:
Lua Code:
  1. local displayText = self.shouldEscapeMarkup and EscapeMarkup(text, ALLOW_MARKUP_TYPE_COLOR_ONLY) or text

Maybe the EscapeMarkup function helps somehow. But I guess the AllowMarkupType in the XML should be best.
  Reply With Quote
07/25/19, 09:50 AM   #6
Phuein
 
Phuein's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 96
tl;dr Doesn't work. And Zeni please include links in SetAllowMarkupType().


<Does some experimentation...> So it really looks like all EditBoxes do indeed markup by default, as Zeni's example manually escapes their markup. Thanks for finding that!

EscapeMarkup() apparently just adds | to an |, but it doesn't even do this properly for all markup. For example:
Code:
|H1:achievement:1820:1:1563935869|h|h
Will not be escaped.

Sadly, this means that copying text is ruined when escaped - as we have no access to the clipboard to unescape it again. So I can't use this.

I still can't find a definition to EditBox where I could stop it from displaying links not-as-plain-text.

It also looks like SetAllowMarkupType() of EditBox should have this feature, but doesn't. It only affects text styling, but not links. Could Zeni add links to it?
__________________

Author of beloved and rejuvenated addons:

• ShowMount            • PvP FPS 2018

• Notebook 2018        • Junkee 2018

• BestFriends 2018      • New Addon

Last edited by Phuein : 07/25/19 at 09:54 AM.
  Reply With Quote
07/25/19, 01:40 PM   #7
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 679
So I did a little bit of testing with the filter edit box in inventory, which I guess doesn't use any explicit EscapeMarkup, only default control behaviour. I was too lazy to type out the mnemonics so I just used SetAllowMarkupType(n) -- assuming 0=NONE 1=COLOR_ONLY 2=ALL.

When allowed markup is NONE, you can type anything and it shows up.
If you then set allowed markup to COLOR_ONLY or ALL, |cXXXXXX and |r don't show up as you type it, and change the color of the text (and also differently colored letters seem wrongly placed, too close), BUT what you typed before with NONE stays as is. And if you change back to NONE, colored text remains colored.

Links behave differently.
With allowed markup set to NONE, they turn into links if you PASTE them as a whole (i.e. manually Ctrl+V or SetText() or InsertText())
For example this inserts an item link in small chunks, none of which contain | followed by a character, and the text stays as non-link:
Lua Code:
  1. for chunk in string.gmatch(itemLink, "[^|]*.") do
  2.   editBox:InsertText(chunk)
  3. end
Perhaps this could be abused to "unlinkify" the text after Ctrl+V, but it sounds wrong, I doubt that's worth it.
  Reply With Quote
07/27/19, 05:41 PM   #8
Phuein
 
Phuein's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 96
Originally Posted by merlight View Post
Perhaps this could be abused to "unlinkify" the text after Ctrl+V, but it sounds wrong, I doubt that's worth it.
Sounds unreliable from your description. Waiting on a Zeni dev' or someone with a solution to pop up.
__________________

Author of beloved and rejuvenated addons:

• ShowMount            • PvP FPS 2018

• Notebook 2018        • Junkee 2018

• BestFriends 2018      • New Addon
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Display text instead of link in EditBox?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off