Thread: Resize frame
View Single Post
01-24-14, 06:13 AM   #2
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Try this:
lua Code:
  1. local frame = CreateFrame("Frame", "MyAddOn_MainFrame", UIParent)
  2.  
  3. -- Set up the main frame here
  4.  
  5. local resizeButton = CreateFrame("Button", nil, frame)
  6. resizeButton:SetSize(16, 16)
  7. resizeButton:SetPoint("BOTTOMRIGHT")
  8. resizeButton:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Up")
  9. resizeButton:SetHighlightTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Highlight")
  10. resizeButton:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Down")
  11.  
  12. resizeButton:SetScript("OnMouseDown", function(self, button)
  13.     frame:StartSizing("BOTTOMRIGHT")
  14.     frame:SetUserPlaced(true)
  15. end)
  16.  
  17. resizeButton:SetScript("OnMouseUp", function(self, button)
  18.     frame:StopMovingOrSizing()
  19. end)

This should create a resize button in the bottom right corner of your main frame that looks like the chat frame resize button.

You can add a check for the left mouse button in the OnMouseUp/Down scripts like you have in your code if you want.
  Reply With Quote