ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Clickable item links in textbuffer (https://www.esoui.com/forums/showthread.php?t=1138)

CrazyDutchGuy 04/24/14 01:10 PM

Clickable item links in textbuffer
 
I made a textbuffer and i am sending messages to it with :AddMessage(some_msg) If there is an item link in the message, i can't click on it and get a tooltip. If i send the same message to the regular chat window like d(some_msg) then it works. What am i missing to make item links work in textbuffers ?

Seerah 04/24/14 02:03 PM

Is your textbuffer mouse enabled?

Xrystal 04/24/14 02:03 PM

I had the same problem as well. Even having SetLinkEnabled(true) set for the textbuffer didn't make a difference. It wasn't an addon breaker for me so I just changed it from the link displaying to the name.

Xrystal 04/24/14 02:03 PM

Quote:

Originally Posted by Seerah (Post 5681)
Is your textbuffer mouse enabled?

ooh, good point...

darn... yes mine is .. scratch that idea

BadVolt 04/24/14 02:51 PM

Same for me doesn't work at all. May be we should use some SetTooltip method or sth like that.

CrazyDutchGuy 04/24/14 02:53 PM

Quote:

Originally Posted by Seerah (Post 5681)
Is your textbuffer mouse enabled?

It wasn't, but making it mouse enabled didn't make a difference. Below the code that makes the textbuffer
Code:

        CDGLibGui.window.TEXTBUFFER = WINDOW_MANAGER:CreateControl("CDGLibGuiWindow_TB", CDGLibGui.window.ID, CT_TEXTBUFFER)       
        CDGLibGui.window.TEXTBUFFER:SetLinkEnabled(true)
        CDGLibGui.window.TEXTBUFFER:SetMouseEnabled(true)
        CDGLibGui.window.TEXTBUFFER:SetFont("ZoFontChat")
        CDGLibGui.window.TEXTBUFFER:SetHidden(false)
        CDGLibGui.window.TEXTBUFFER:SetClearBufferAfterFadeout(false)
        CDGLibGui.window.TEXTBUFFER:SetLineFade(10, 3)
        CDGLibGui.window.TEXTBUFFER:SetMaxHistoryLines(100)
        CDGLibGui.window.TEXTBUFFER:SetDimensions(500-64, 264-64)
        CDGLibGui.window.TEXTBUFFER:SetAnchor(TOPLEFT,CDGLibGui.window.ID,TOPLEFT,32,32)


Iyanga 04/25/14 04:02 AM

Well, not sure about TESO, but TextBuffers are usually not used for display but used to edit the text over and over again until the code is finished and then copying the result to the real edit control for the display. That's why it's called "Buffer".
So it's likely that the TextBuffer just doesn't do a lot of stuff other controls for displaying stuff is doing.

Xrystal 04/25/14 04:28 AM

Quote:

Originally Posted by Iyanga (Post 5791)
Well, not sure about TESO, but TextBuffers are usually not used for display but used to edit the text over and over again until the code is finished and then copying the result to the real edit control for the display. That's why it's called "Buffer".
So it's likely that the TextBuffer just doesn't do a lot of stuff other controls for displaying stuff is doing.

Makes sense. If that was what it was designed for. But some of the functionality that is listed for it clearly gives the impression that it is used for displaying information (AddMessage) including links (SetLinkEnabled) etc.

BadVolt 04/25/14 04:35 AM

Quote:

Originally Posted by Iyanga (Post 5791)
Well, not sure about TESO, but TextBuffers are usually not used for display but used to edit the text over and over again until the code is finished and then copying the result to the real edit control for the display. That's why it's called "Buffer".
So it's likely that the TextBuffer just doesn't do a lot of stuff other controls for displaying stuff is doing.

That's fine, but TextBuffer have method "SetLinkEnabled". And it do not work.

CrazyDutchGuy 04/25/14 06:51 AM

As far as i could dig into how the current chat tabs work and as far as i can remember at the moment (@work atm) is that the eso ChatTabs also use TEXTBUFFER to display text. I tried to see if there was a difference between the implementation of the eso chattabs and my own textbuffer, but i couldn't find any.

Could it be that some additional event handling needs to be done to make the tooltips work ?

Fathis Ules 04/25/14 07:26 AM

I think it is a bug, experienced the same issue

To solve I set an handler like this

Code:

    buffer:SetHandler("OnLinkClicked", function(self, ...) return ZO_ChatSystem_OnLinkClicked(...) end) -- \esoui\ingame\chatsystem\chatsystem.lua, line 2540 -- linkData, linkText, button

Xrystal 04/25/14 10:20 AM

hmm, maybe not a bug then.

Perhaps the chat frames use a virtual frame that already has that handler configured.

Thanks, will try and will confirm if it resolves my situation.

edit:
Nada. The handler didn't trigger at all. Investigating other settings that may be required on a simple text buffer.

edit2:
Nothing springs to mind that hasn't already been set up.

Fathis Ules 04/25/14 11:23 AM

Quote:

Originally Posted by Xrystal (Post 5840)
Nada. The handler didn't trigger at all

You should have a settings changing from me, in case it helps here is my buffer

Code:

    local frameLogBuffer  = CreateControl(nil, frameLog,      CT_TEXTBUFFER)
    frameLogBuffer:SetMouseEnabled(true)
    frameLogBuffer:SetLinkEnabled(true)
    frameLogBuffer:SetMaxHistoryLines(100000)
    frameLogBuffer:SetAnchor(TOPLEFT, frameLog, TOPLEFT, 8, 8)
    frameLogBuffer:SetAnchor(BOTTOMRIGHT, frameLog, BOTTOMRIGHT, -100, -8)
    frameLogBuffer:SetFont(font.."|12")
    frameLogBuffer:SetHandler("OnLinkClicked", function(self, ...) return ZO_ChatSystem_OnLinkClicked(...) end) -- \esoui\ingame\chatsystem\chatsystem.lua, line 2540 -- linkData, linkText, button
    frameLogBuffer:SetHandler("OnDragStart", dragStart)
    frameLogBuffer:SetHandler("OnDragStop", dragStop)   
    --frameLogBuffer:SetHandler("OnTextChanged", onToggleSlider)
    frameLogBuffer:SetHandler("OnMouseWheel", function(self, delta, ctrl, alt, shift)
        if sliderFrameLog:GetAlpha() == 1 then
            if delta == 1 then
                sliderFrameLog:SetValue(sliderFrameLog:GetValue() - 1)
            else
                sliderFrameLog:SetValue(sliderFrameLog:GetValue() + 1)
            end
        end

double check that you have
:SetMouseEnabled(true)
:SetLinkEnabled(true)

Xrystal 04/25/14 01:38 PM

Yep I do.

However, because I had set up everything else up in XML the SetLinkEnabled setting didn't work. I had to change the xml tag to be linkEnabled="true". Until I made that change it didn't work.

Lua Code:
  1. <TextBuffer name="$(parent)_Info" font="ZoFontChat" maxHistoryLines="500" mouseEnabled="true" linkEnabled="true">
  2.                     <Anchor point="TOPLEFT" offsetX="8" offsetY="85" />
  3.                     <Anchor point="BOTTOMRIGHT" offsetX="-8" offsetY="-35" />
  4.                     <OnLinkClicked>
  5.                         CHAT_SYSTEM:AddMessage("Link Clicked")
  6.                         ZO_ChatSystem_OnLinkClicked(...)
  7.                     </OnLinkClicked>
  8.                     <OnMouseWheel>
  9.                         self:MoveScrollPosition(delta)
  10.                     </OnMouseWheel>
  11.                 </TextBuffer>


All times are GMT -6. The time now is 04:19 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI