04-04-22, 08:02 AM | #1 |
Listiview: avoid text overlap
This is my project:
xml template: Code:
<Frame name="GroupBox" toplevel="true" virtual="true"> <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> <BackgroundInsets> <AbsInset left="3" right="3" top="5" bottom="3" /> </BackgroundInsets> <TileSize> <AbsValue val="16" /> </TileSize> <EdgeSize> <AbsValue val="16" /> </EdgeSize> <Color r="0.1" g="0.1" b="0.1" a="0.5"/> <BorderColor r="0.4" g="0.4" b="0.4"/> </Backdrop> <Layers> <Layer level="OVERLAY"> <FontString parentKey="label" inherits="GameFontNormal" text="" justifyH="LEFT"> <Anchors> <Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT"> <Offset> <AbsDimension x="10" y="15"/> </Offset> </Anchor> </Anchors> </FontString> </Layer> </Layers> </Frame> <Frame name="listview_template" inherits="UnitScan_GroupBox" virtual="true"> <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> <BackgroundInsets> <AbsInset left="3" right="3" top="5" bottom="3" /> </BackgroundInsets> <TileSize> <AbsValue val="16" /> </TileSize> <EdgeSize> <AbsValue val="16" /> </EdgeSize> <Color r="0.1" g="0.1" b="0.1" a="0.5"/> <BorderColor r="0.4" g="0.4" b="0.4"/> </Backdrop> <Frames> <ScrollFrame name="$parentScrollBar" parentKey="scroll" inherits="FauxScrollFrameTemplate" hidden="false"> <Anchors> <Anchor point="TOPLEFT" x="0" y="-8"/> <Anchor point="BOTTOMRIGHT" x="-30" y="8"/> </Anchors> <Scripts> <OnVerticalScroll> FauxScrollFrame_OnVerticalScroll(self, offset, 16, ScrollUpdate); </OnVerticalScroll> </Scripts> </ScrollFrame> </Frames> <Scripts> <OnLoad> self.data, self.buttons = {}, {} self:Hide() </OnLoad> <OnShow> self.selected = nil listview_CreateList(self, self:GetHeight()/20) <-- ! Adapt to listview height, while GetHeight() doesn't works on OnLoad template script --> </OnShow> </Scripts> </Frame> Lua Code:
I would like to avoid button text overlap on button when the listview is showed. I tried two options: the first is to insert this code at listview_CreateList begin Lua Code:
The second one is insert this code at listview_CreateList end Lua Code:
The second method implies that the listview is hidden by default. Do you know better methods? General advice to improve this project? If there is any part of the code you don't understand, please ask. |
|
04-04-22, 09:29 AM | #2 |
Every time it's shown you run listview_CreateList
Every time listview_CreateList is run, among other things, it creates a new fontstring on the buttons so you are getting overlay. Maybe change your xml to only create the buttons, fontstrings etc. once, or do it OnLoad. Code:
<OnShow> self.selected = nil if not self.buttons then listview_CreateList(self, self:GetHeight()/20) end </OnShow>
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 04-04-22 at 09:52 AM. |
|
WoWInterface » Developer Discussions » Lua/XML Help » Listiview: avoid text overlap |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|