Thread Tools Display Modes
10-22-10, 09:02 PM   #1
barbol12
A Cyclonian
 
barbol12's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 42
lua help...button

hello all.. i am trying to make a button, for something i am doing... and having some issues

i have tried multiple codings for this button, and nothing wants to show up in the game... i want to make a button, so that it has 2 different textures(one for normal, and one when i click on it) and i want to be able to load other functions, when i click on it....
  Reply With Quote
10-22-10, 09:30 PM   #2
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
post what you have so far, we can see what your missing.


clarify the texture choices. Like when you click the button the image changes, or when you have the button pushed change the texture? Load functions? Like change whats already set

like in state one, when you push it, it prints ("hey") and then when you click the button, it changes the function to do print("there")?
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
10-22-10, 09:35 PM   #3
barbol12
A Cyclonian
 
barbol12's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 42
ok, first off... i am trying to set it, so that it shows 1 textures, when i click on it, loads another texture.... (custom textures i made). and i am trying to make so that when i initially login, i can push the button and load addons... aka the other functions, to load... right now i am just making a "test" lua button. to try and get the button itself to show and work.. heres what i have for it so far...

local button = CreateFrame("Button",nil,nil)
button:SetPoint("CENTER")
button:SetNormalTexture("Interface\\Addons\\textures\\install.tga")
button:SetPushedTexture("Interface\\Addons\\textures\\install2.tga")
button:SetScript("OnClick", function(self, button, down) print("clicky") end)
end


i have tried all kinds things, NOTHING is working, not even coming up.. but i typed this in-game chat.../run local b=CreateFrame("Button",nil,nil,"OptionsButtonTemplate") b:SetPoint("CENTER")
that worked fine.. WTF is going on?
  Reply With Quote
10-22-10, 09:42 PM   #4
Taroven
A Cyclonian
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 49
Code:
button:SetWidth(50)
button:SetHeight(50)
Try it with those. Your button has no dimensions at the moment.
__________________
Former author of EventHorizon Continued and Other Releases.
  Reply With Quote
10-22-10, 10:57 PM   #5
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
Originally Posted by Taroven View Post
Code:
button:SetWidth(50)
button:SetHeight(50)
Try it with those. Your button has no dimensions at the moment.
this.

the inherited frame ,"OptionsButtonTemplate" has dimenisions already, your custom button does not.

for switching functions, you could do

myButton:SetScript("OnClick", function(self)
--do some stuff
myButton:SetScript("OnClick", newFunction)
end)

actually, i wonder if that would work... theoritically it makes sense to me, but unsure of the results
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » lua help...button


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