Updated Button (markdown)

Robert Jelic
2022-04-02 08:32:17 +02:00
parent 459db05874
commit f08b586b5f

@@ -3,7 +3,7 @@ Buttons are objects, which execute function by clicking on them
Here is a example of how to create a standard button: Here is a example of how to create a standard button:
````lua ````lua
local mainFrame = CreateFrame("myFirstFrame"):show() local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):show() local aButton = mainFrame:addButton("myFirstButton"):show()
```` ````
@@ -15,7 +15,7 @@ Here are all possible functions available for buttons. Remember button inherit f
## setText ## setText
Sets the displayed button text Sets the displayed button text
````lua ````lua
local mainFrame = CreateFrame("myFirstFrame"):show() local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):show() -- you could also use :setValue() instead of :setText() - no difference local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):show() -- you could also use :setValue() instead of :setText() - no difference
```` ````
**args:** text<br> **args:** text<br>
@@ -24,7 +24,7 @@ local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):show() --
# Examples # Examples
Add a onClick event: Add a onClick event:
````lua ````lua
local mainFrame = CreateFrame("myFirstFrame"):show() local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):onClick(function(self,event,button,x,y) local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):onClick(function(self,event,button,x,y)
if(event=="mouse_click")and(button==1)then if(event=="mouse_click")and(button==1)then
NyoUI.debug("Left mousebutton got clicked!") NyoUI.debug("Left mousebutton got clicked!")