Thread Tools Display Modes
12-19-09, 01:22 AM   #1
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
ChatFrame1:SetPoint()

Code:
ChatFrame1:ClearAllPoints()
ChatFrame1:SetPoint("BOTTOMLEFT", UIParent, 10, 10)
ChatFrame1:SetWidth(321)
ChatFrame1:SetHeight(121)
can anyone tell me why this isn't enough to move my ChatFrame1 ? It sets the width and height. I'm a Lua noob but im trying to learn

((just a small section of the entire addon))
  Reply With Quote
12-19-09, 01:30 AM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Code:
ChatFrame1:ClearAllPoints()
ChatFrame1:SetPoint('BOTTOMLEFT', UIParent, 'BOTTOMLEFT', 10, 10)
ChatFrame1:SetWidth(321)
ChatFrame1:SetHeight(121)
  Reply With Quote
12-19-09, 01:33 AM   #3
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
tried that as well it doesnt work

im using idChat addon, is there something that I miss which clashes or stops it from moving?
  Reply With Quote
12-19-09, 01:45 AM   #4
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
You could try making it so the frame can't be moved after you move it with:
Code:
ChatFrame1:ClearAllPoints()
ChatFrame1:SetPoint('BOTTOMLEFT', UIParent, 'BOTTOMLEFT', 10, 10)
ChatFrame1:SetWidth(321)
ChatFrame1:SetHeight(121)

local function DoNothing() end
ChatFrame1.ClearAllPoints = DoNothing
ChatFrame1.SetPoint = DoNothing
  Reply With Quote
12-19-09, 02:04 AM   #5
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
thx alot Vrul that did it

just wondering if ur bothered to answer. do u have an idea on what wouldve stopped it from moving originally?
  Reply With Quote
12-19-09, 02:23 AM   #6
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
That's an odd behavior. Been coming across a lot of those lately....
  Reply With Quote
12-19-09, 02:33 AM   #7
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by alimjocox View Post
do u have an idea on what wouldve stopped it from moving originally?
It was moving, it was just getting moved right back again.
  Reply With Quote
12-28-09, 02:57 PM   #8
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
yea its not odd behavior at all. The chat.cache.txt controls what loads. You may want to change that code to have a SetUserPlaced(true) in there as well so that it will actually save your changes to the chat.cache.txt.

The chat frame code for GrimUI sets up the windows once then saves any changes the user makes, i just made it work like this last night actually so its all fresh in my head... here is the code example.

Code:
ChatFrame1:ClearAllPoints()
	ChatFrame1:SetPoint("BOTTOMLEFT", GrimUIcoreArtB1, "BOTTOMLEFT", 14, 25)
	ChatFrame1:SetWidth(350)
	ChatFrame1:SetHeight(190)
	ChatFrame1:SetFrameLevel(8)
	ChatFrame1:SetUserPlaced(true)
Now that will set up where its located and what size it is. The SetUserPlaced(true) will make it save to the chat.cache.txt file so it will reload t his way every time. NOW for the catch... if you do not put this piece of code inside another function that is only called once on the first login it is used it will automatically move the chatframe back to this location every time you log in. In other words you need to have a function that creates a saved variable. Then have the chat code look for the saved variable if it does NOT find it then it runs the code above. IF it does then it does nothing. The dummy commands you are useing to prevent the chat.cache.txt from loading again can then be removed since the chatcache will then have your settings saved into it.

So to sum it up.... the reason for the funny behavior is that the chat.cache.txt loads after your addons are loading and you are not saving the position your addon has done to the chat.cache.txt without having that setUserPlaced function in there.

So when it loads the chat.cache.txt it loads what ever the settings were prior to your addon changing the positioning.

You can leave it the way you had done it but should you make any changes to the chat windows in game they will reset when you logout.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-21-10, 08:15 PM   #9
shrike126
A Defias Bandit
AddOn Compiler - Click to view compilations
Join Date: Feb 2008
Posts: 3
This isn't working for me and I cannot figure out why. I want to create a small Lua file that just changes the chat settings to a specific position but for the life of me it doesn't seem to work...

Code:
-- position the Chat window
ChatFrame1:ClearAllPoints()
ChatFrame1:SetPoint("BOTTOMLEFT", UIParent, 25, 25)
ChatFrame1:SetWidth(350)
ChatFrame1:SetHeight(111)

-- position the ChatEdit frame on top of the Chat window
ChatFrameEditBox:ClearAllPoints()
ChatFrameEditBox:SetPoint('BOTTOMLEFT',  'ChatFrame1', 'TOPLEFT',  -5, 0)
ChatFrameEditBox:SetPoint('BOTTOMRIGHT', 'ChatFrame1', 'TOPRIGHT', 5, 0)

local function DoNothing() end
ChatFrame1.ClearAllPoints = DoNothing
ChatFrame1.SetPoint = DoNothing
The part that changes the position of the ChatEdit box seems to work, but it isn't moving ChatFrame1 at all. /cry
  Reply With Quote
02-21-10, 08:34 PM   #10
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
are u using any other addons?
  Reply With Quote
02-21-10, 08:41 PM   #11
shrike126
A Defias Bandit
AddOn Compiler - Click to view compilations
Join Date: Feb 2008
Posts: 3
Originally Posted by alimjocox View Post
are u using any other addons?
None, I suspected another addon could be the culprit so I've cleaned out my Interface and WTF directories. But even after this, changes made to the x,y locations above don't seem to result in changes of the actual chat window's location.

Okay this is messed up... I added this to the end and now it seems to be working.
Code:
ChatFrame1:SetUserPlaced(false)
I thought I'd deleted the folders in WTF to clear out any chat config cache, would that line prevent it from calling from stored variables? Or perhaps I changed something else and that last part isn't doing anything.

Edit: It looks like if you move the chat window in-game at all, then changing the Lua code above doesn't have any effect on positioning. But if you delete the items under WTF and login again you can change it in the above code all you want.

Last edited by shrike126 : 02-21-10 at 09:00 PM.
  Reply With Quote
02-21-10, 09:17 PM   #12
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Your code was likely running before the chat frame's position was being pulled from the file in the WTF folder.

If you wait to run your code until after the default UI is finished loading, then you shouldn't have any issues.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-21-10, 09:54 PM   #13
AxnJackson11
A Fallenroot Satyr
Join Date: Oct 2009
Posts: 28
why do you need lua?

why not just right click on the General Tab, click Unlock Chat Frame, then drag and resize to your delight?? or is this part of a all in one ui you want others to download?
  Reply With Quote
02-21-10, 10:09 PM   #14
shrike126
A Defias Bandit
AddOn Compiler - Click to view compilations
Join Date: Feb 2008
Posts: 3
Originally Posted by AxnJackson11 View Post
why not just right click on the General Tab, click Unlock Chat Frame, then drag and resize to your delight?? or is this part of a all in one ui you want others to download?
Exactly that. I figure this will be a small entry level building block into a UI that I can share with friends with little or no settings to configure by the end user.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » ChatFrame1:SetPoint()


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off