@@ -303,42 +303,49 @@ function FunFact:OnEnable()
303303 Channel :Disable ()
304304 end
305305
306- -- Fact display text box (larger multi-line)
307- local factDisplayFrame = CreateFrame (' Frame ' , nil , window )
306+ -- Fact display text box (larger multi-line, selectable )
307+ local factDisplayFrame = CreateFrame (' ScrollFrame ' , nil , window )
308308 factDisplayFrame :SetPoint (' TOPLEFT' , Channel , ' BOTTOMLEFT' , - 10 , - 15 )
309309 factDisplayFrame :SetPoint (' TOPRIGHT' , window , ' TOPRIGHT' , - 25 , - 265 )
310310 factDisplayFrame :SetHeight (145 )
311311
312312 -- Add background texture
313313 factDisplayFrame .bg = factDisplayFrame :CreateTexture (nil , ' BACKGROUND' )
314- factDisplayFrame .bg :SetAllPoints ()
314+ factDisplayFrame .bg :SetPoint (' TOPLEFT' , factDisplayFrame , ' TOPLEFT' , - 6 , 6 )
315+ factDisplayFrame .bg :SetPoint (' BOTTOMRIGHT' , factDisplayFrame , ' BOTTOMRIGHT' , 0 , - 6 )
315316 factDisplayFrame .bg :SetAtlas (' auctionhouse-background-index' , true )
316317
317- -- Scrollable fact display
318- local factScroll = CreateFrame (' ScrollFrame' , nil , factDisplayFrame )
319- factScroll :SetPoint (' TOPLEFT' , factDisplayFrame , ' TOPLEFT' , 8 , - 8 )
320- factScroll :SetPoint (' BOTTOMRIGHT' , factDisplayFrame , ' BOTTOMRIGHT' , - 8 , 8 )
321-
322318 -- Modern minimal scrollbar
323- factScroll .ScrollBar = CreateFrame (' EventFrame' , nil , factScroll , ' MinimalScrollBar' )
324- factScroll .ScrollBar :SetPoint (' TOPLEFT' , factDisplayFrame .bg , ' TOPRIGHT' , 6 , 0 )
325- factScroll .ScrollBar :SetPoint (' BOTTOMLEFT' , factDisplayFrame .bg , ' BOTTOMRIGHT' , 6 , 0 )
326- ScrollUtil .InitScrollFrameWithScrollBar (factScroll , factScroll .ScrollBar )
327-
328- local factScrollChild = CreateFrame (' Frame' , nil , factScroll )
329- factScroll :SetScrollChild (factScrollChild )
330- factScrollChild :SetSize (factScroll :GetWidth (), 1 )
331-
332- window .tbFact = factScrollChild :CreateFontString (nil , ' OVERLAY' , ' GameFontNormal' )
333- window .tbFact :SetPoint (' TOPLEFT' , 5 , - 5 )
334- window .tbFact :SetPoint (' TOPRIGHT' , - 5 , - 5 )
335- window .tbFact :SetJustifyH (' LEFT' )
336- window .tbFact :SetJustifyV (' TOP' )
337- window .tbFact :SetWordWrap (true )
338- window .tbFact :SetText (' ' )
319+ factDisplayFrame .ScrollBar = CreateFrame (' EventFrame' , nil , factDisplayFrame , ' MinimalScrollBar' )
320+ factDisplayFrame .ScrollBar :SetPoint (' TOPLEFT' , factDisplayFrame , ' TOPRIGHT' , 6 , 0 )
321+ factDisplayFrame .ScrollBar :SetPoint (' BOTTOMLEFT' , factDisplayFrame , ' BOTTOMRIGHT' , 6 , 0 )
322+ ScrollUtil .InitScrollFrameWithScrollBar (factDisplayFrame , factDisplayFrame .ScrollBar )
323+
324+ -- Create the selectable text edit box
325+ window .tbFact = CreateFrame (' EditBox' , nil , factDisplayFrame )
326+ window .tbFact :SetMultiLine (true )
327+ window .tbFact :SetFontObject (' GameFontNormal' )
328+ window .tbFact :SetWidth (factDisplayFrame :GetWidth () - 20 )
329+ window .tbFact :SetAutoFocus (false )
330+ window .tbFact :EnableMouse (true )
331+ window .tbFact :SetTextColor (1 , 1 , 1 )
332+ window .tbFact :SetScript (
333+ ' OnTextChanged' ,
334+ function (self )
335+ ScrollingEdit_OnTextChanged (self , self :GetParent ())
336+ end
337+ )
338+ window .tbFact :SetScript (
339+ ' OnCursorChanged' ,
340+ function (self , x , y , w , h )
341+ ScrollingEdit_OnCursorChanged (self , x , y - 10 , w , h )
342+ end
343+ )
344+ factDisplayFrame :SetScrollChild (window .tbFact )
345+
346+ -- Add SetValue method for compatibility with existing code
339347 window .tbFact .SetValue = function (self , text )
340348 self :SetText (text )
341- factScrollChild :SetHeight (math.max (self :GetStringHeight () + 10 , factScroll :GetHeight ()))
342349 end
343350
344351 -- FACT! button using RemixPowerLevel style
0 commit comments