+ Reply to Thread
Results 1 to 6 of 6

  Click here to go to the first Rift Team post in this thread.   Thread: RiftWindow wonkiness

  1. #1
    RIFT Fan Site Operator Aieny's Avatar
    Join Date
    Feb 2011
    Location
    Earth
    Posts
    472

    Default RiftWindow wonkiness

    So, after working on the RiftWindow frame, I've noticed a few things. Perhaps I just don't fully understand it, perhaps it's a bug, or perhaps it's just NYI. However, here's somethings I noticed.

    Resizing the window using SetHeight and SetWidth alters the size of the border and, especially, the title bar at the top. Although setting the title via SetTitle still shows the title where it should be, the title bar is shrunk when the window is made shorter than default.

    The window is unmoveable and unsizeable via mouse. I'm not sure if that is something we as Addon developers are expected to implement ourselves; if it is, I'd love for someone to help me out with how to implement that so I don't need to reinvent the circular device that rolls along the ground.
    a community-oriented site for all things Rift

  2. #2
    Champion Lorandii's Avatar
    Join Date
    Jun 2011
    Posts
    516

    Default

    Quote Originally Posted by Aieny View Post
    <snip> so I don't need to reinvent the circular device that rolls along the ground.
    You mean the overweight Gnome? Relax, Gnomes were never invented for Rift, so you don't need to reinvent them.

  3. #3
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    Quote Originally Posted by Aieny View Post
    So, after working on the RiftWindow frame, I've noticed a few things. Perhaps I just don't fully understand it, perhaps it's a bug, or perhaps it's just NYI. However, here's somethings I noticed.

    Resizing the window using SetHeight and SetWidth alters the size of the border and, especially, the title bar at the top. Although setting the title via SetTitle still shows the title where it should be, the title bar is shrunk when the window is made shorter than default.

    The window is unmoveable and unsizeable via mouse. I'm not sure if that is something we as Addon developers are expected to implement ourselves; if it is, I'd love for someone to help me out with how to implement that so I don't need to reinvent the circular device that rolls along the ground.
    I use something like this to attach and manage moving my frames. My LUA is still sketchy so there's probably better way of doing what I do. In pure coding form though, this will be handy.

    Code:
    local function AttachDragFrame(parent, hook, name, layer)
    
    	if not name then name = "" end
    	if not layer then layer = 0 end
    	
    	local DragFrame = UI.CreateFrame("Frame", name.."_DragFrame", parent)
    	DragFrame:SetWidth(parent:GetWidth())
    	DragFrame:SetHeight(parent:GetHeight())
    	DragFrame:SetPoint("TOPLEFT", parent, "TOPLEFT")
    	DragFrame.parent = parent
    	DragFrame.MouseDown = false
    	DragFrame:SetLayer(layer)
    	DragFrame.hook = hook
    	
    	function DragFrame.Event:LeftDown()
    		self.MouseDown = true
    		mouseData = Inspect.Mouse()
    		self.MyStartX = self.parent:GetLeft()
    		self.MyStartY = self.parent:GetTop()
    		self.StartX = mouseData.x - self.MyStartX
    		self.StartY = mouseData.y - self.MyStartY
    		tempX = self.parent:GetLeft()
    		tempY = self.parent:GetTop()
    		tempW = self.parent:GetWidth()
    		tempH =	self.parent:GetHeight()
    		self.parent:ClearAll()
    		self.parent:SetPoint("TOPLEFT", UIParent, "TOPLEFT", tempX, tempY)
    		self.parent:SetWidth(tempW)
    		self.parent:SetHeight(tempH)
    		self:SetBackgroundColor(0,0,0,0.5)
    	end
    	function DragFrame.Event:MouseMove(mouseX, mouseY)
    		if self.MouseDown then
    			self.parent:SetPoint("TOPLEFT", UIParent, "TOPLEFT", (mouseX - self.StartX), (mouseY - self.StartY))
    		end
    	end
    	function DragFrame.Event:LeftUp()
    		if self.MouseDown then
    			self.MouseDown = false
    			self:SetBackgroundColor(0,0,0,0)
    			self:hook()
    		end
    	end
    	
    	return DragFrame
    end
    Last edited by Semele; 09-27-2011 at 04:08 PM. Reason: Updated the function.
    Rank 76 Guardian Mage

  4. #4
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    Oh, I spent the time making the above function generic, should slot in to any program. It WAS static to one of my addons.
    Rank 76 Guardian Mage

  5.   This is the last Rift Team post in this thread.   #5
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Quote Originally Posted by Aieny View Post
    The window is unmoveable and unsizeable via mouse. I'm not sure if that is something we as Addon developers are expected to implement ourselves; if it is, I'd love for someone to help me out with how to implement that so I don't need to reinvent the circular device that rolls along the ground.
    I've been thinking about a good general solution for dragging (and, later, resizing), but haven't yet come up with an API I'm satisfied with. For the time being, it's "do it yourself".

    Quote Originally Posted by Semele View Post
    I use something like this to attach and manage moving my frames. My LUA is still sketchy so there's probably better way of doing what I do. In pure coding form though, this will be handy.
    Note that the MouseMove event passes the new mouse location as parameters to the event handler.
    Last edited by ZorbaTHut; 09-27-2011 at 09:59 AM.

  6. #6
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    Quote Originally Posted by ZorbaTHut View Post
    Note that the MouseMove event passes the new mouse location as parameters to the event handler.
    I was wondering about the x, y returned by a frames mouse move event. At first I dismissed them as being x, y co-ordinates within the frame (ie, as 0,0 being top-left of the frame). Good to know it's 0,0 being 0,0 of the game viewport.
    Rank 76 Guardian Mage

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts