Files
Basalt/docs/objects/ChangeableObject.md
Robert Jelic bb1b1beb79 Basalt 1.7 Update
- New Objects (Flexbox, Graph, Treeview)
- Pluginsystem to add/remove functionality
- Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject
- Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox
- Removed the Animation Object, and added a animation plugin instead
- Removed the Graphic Object and merged it's functionality with the image object
- Updated currently existing objects
2023-04-30 17:05:34 +02:00

1.2 KiB

The ChangeableObject class is a subclass of VisualObject and Object that provides additional methods for handling changes to objects.

In addition to the Object and VisualObject methods, changeableObjects also have the following methods:

setValue Changes the button text
getValue Changes the horizontal text position
onChange Changes the vertical text position

Example

Here's an example of how to create a fully functional button using the Button object:

local main = basalt.createFrame()
local aButton = main:addButton():setText("Click")

aButton:onClick(function(self,event,button,x,y)
  if(event=="mouse_click")and(button==1)then
    basalt.debug("Left mousebutton got clicked!")
  end
end)

Alternatively, you can create a button using an XML layout:

<button onClick="buttonClick" text="Click">
  <onClick>
    if(event=="mouse_click")and(button==1)then
      basalt.debug("Left mousebutton got clicked!")
    end
  </onClick>
</button>

In these examples, a button is created with the text "Click". When the left mouse button is clicked on the button, the message "Left mouse button got clicked!" is printed.