comparison Comments.lua @ 266:d2f7737fd68b

Fixed mouse-clicking within the comment EditBox.
author James D. Callahan III <jcallahan@curse.com>
date Wed, 20 Mar 2013 11:18:50 -0500
parents 726e8a94391d
children f6f1d49b2a43
comparison
equal deleted inserted replaced
265:726e8a94391d 266:d2f7737fd68b
154 154
155 scroll_frame:SetScript("OnMouseWheel", function(self, delta) 155 scroll_frame:SetScript("OnMouseWheel", function(self, delta)
156 _G.ScrollFrameTemplate_OnMouseWheel(self, delta) 156 _G.ScrollFrameTemplate_OnMouseWheel(self, delta)
157 end) 157 end)
158 158
159 -- This is needed because the EditBox starts with a height of a single line, so getting focus on click would require finding the EditBox blindly.
160 scroll_frame:SetScript("OnMouseUp", function(self)
161 _G.EditBox_SetFocus(self.edit_box)
162 end)
163
159 panel.scroll_frame = scroll_frame 164 panel.scroll_frame = scroll_frame
160 165
161 local edit_container = _G.CreateFrame("Frame", nil, scroll_frame) 166 local edit_container = _G.CreateFrame("Frame", nil, scroll_frame)
162 edit_container:SetPoint("TOPLEFT", scroll_frame, -7, 7) 167 edit_container:SetPoint("TOPLEFT", scroll_frame, -7, 7)
163 edit_container:SetPoint("BOTTOMRIGHT", scroll_frame, 7, -7) 168 edit_container:SetPoint("BOTTOMRIGHT", scroll_frame, 7, -7)
199 _G.GameTooltip:Show() 204 _G.GameTooltip:Show()
200 end) 205 end)
201 206
202 link_button:SetScript("OnLeave", _G.GameTooltip_Hide) 207 link_button:SetScript("OnLeave", _G.GameTooltip_Hide)
203 208
204 local edit_description = edit_container:CreateFontString("MUFASA", "ARTWORK", "GameFontHighlight") 209 local edit_description = edit_container:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
205 edit_description:SetHeight(36) 210 edit_description:SetHeight(36)
206 edit_description:SetPoint("BOTTOMLEFT", edit_container, "TOPLEFT", 5, 3) 211 edit_description:SetPoint("BOTTOMLEFT", edit_container, "TOPLEFT", 5, 3)
207 edit_description:SetPoint("BOTTOMRIGHT", edit_container, "TOPRIGHT", 5, 3) 212 edit_description:SetPoint("BOTTOMRIGHT", edit_container, "TOPRIGHT", 5, 3)
208 edit_description:SetFormattedText(EDIT_DESCRIPTION_FORMAT, _G.BreakUpLargeNumbers(EDIT_MAXCHARS)) 213 edit_description:SetFormattedText(EDIT_DESCRIPTION_FORMAT, _G.BreakUpLargeNumbers(EDIT_MAXCHARS))
209 edit_description:SetWordWrap(true) 214 edit_description:SetWordWrap(true)
210 edit_description:SetJustifyH("LEFT") 215 edit_description:SetJustifyH("LEFT")
211 216
212 local edit_box = _G.CreateFrame("EditBox", nil, scroll_frame) 217 local edit_box = _G.CreateFrame("EditBox", "$parentEditBox", scroll_frame)
213 edit_box:SetMultiLine(true) 218 edit_box:SetMultiLine(true)
214 edit_box:SetMaxLetters(EDIT_MAXCHARS) 219 edit_box:SetMaxLetters(EDIT_MAXCHARS)
215 edit_box:EnableMouse(true) 220 edit_box:EnableMouse(true)
216 edit_box:SetAutoFocus(false) 221 edit_box:SetAutoFocus(false)
217 edit_box:SetFontObject("ChatFontNormal") 222 edit_box:SetFontObject("ChatFontNormal")
218 edit_box:SetSize(420, 220) 223 edit_box:SetSize(420, 220)
219 edit_box:HighlightText(0) 224 edit_box:HighlightText(0)
220 edit_box:SetFrameLevel(scroll_frame:GetFrameLevel() - 1) 225 edit_box:SetFrameLevel(scroll_frame:GetFrameLevel() + 1)
221 226
222 edit_box:SetScript("OnCursorChanged", _G.ScrollingEdit_OnCursorChanged) 227 edit_box:SetScript("OnCursorChanged", _G.ScrollingEdit_OnCursorChanged)
223 edit_box:SetScript("OnEscapePressed", _G.EditBox_ClearFocus) 228 edit_box:SetScript("OnEscapePressed", _G.EditBox_ClearFocus)
224 edit_box:SetScript("OnShow", function(self) 229 edit_box:SetScript("OnShow", function(self)
225 _G.EditBox_SetFocus(self) 230 _G.EditBox_SetFocus(self)
244 end 249 end
245 end) 250 end)
246 251
247 edit_box:SetScript("OnUpdate", function(self, elapsed) 252 edit_box:SetScript("OnUpdate", function(self, elapsed)
248 _G.ScrollingEdit_OnUpdate(self, elapsed, self:GetParent()) 253 _G.ScrollingEdit_OnUpdate(self, elapsed, self:GetParent())
249 end)
250
251 edit_container:SetScript("OnMouseUp", function()
252 _G.EditBox_SetFocus(edit_box)
253 end) 254 end)
254 255
255 scroll_frame.edit_box = edit_box 256 scroll_frame.edit_box = edit_box
256 scroll_frame:SetScrollChild(edit_box) 257 scroll_frame:SetScrollChild(edit_box)
257 258