- LiveCode Mobile Development Cookbook
- Dr Edward Lavieri
- 273字
- 2021-08-05 18:04:01
Setting custom properties
LiveCode's objects come with an impressive number of properties that help us control how they look and function. We can also add our own properties to objects called custom properties. This provides us with a tremendous amount of flexibility.
How to do it...
Follow these steps to set the custom properties:
- Create a main stack.
- Drag any object onto the stack's card (for example, a button).
- Select an object that you wish to add custom properties to.
- Right-click on the object and select Property Inspector.
- Using the property inspector, select Custom Properties. You should see an interface similar to the one displayed in the following screenshot:
- Click on the plus sign to add a new custom property:
- Enter a name for the custom property and click on OK. For example, you might want to use a button to represent a book in a game. Add the custom properties,
bookTitle
,bookYear
,bookAuthor
,bookPublisher
, until your display matches the following screenshot: - Next, we will add content to the custom properties. There are two ways to do this: direct entry and programmatically. We can use the property inspector interface to directly enter the content by selecting the custom property and then typing the content in the Property Contents area (see the following screenshot).
- Alternatively, you can add the content to the custom properties via code:
set the bookPublisher of btn "testButton" to "Packt"
How it works...
We used the property inspector to create custom properties and add content. This content can be changed during an app's execution via code as we demonstrated in step 9.
See also
- The Getting an object's properties recipe
推薦閱讀
- Application Development with Qt Creator(Second Edition)
- C++黑客編程揭秘與防范
- Hands-On Chatbot Development with Alexa Skills and Amazon Lex
- 物聯網關鍵技術及應用
- 互聯網基礎資源技術與應用發展態勢(2021—2023)
- Spring Cloud微服務架構進階
- NB-IoT物聯網技術解析與案例詳解
- 射頻通信系統
- 計算機網絡原理與應用技術
- WordPress Web Application Development
- 網管員必讀:網絡管理(第2版)
- Kong網關:入門、實戰與進階
- 網管工具使用與技巧大全
- 夢工廠之材質N次方:Maya材質手冊
- 端到端QoS網絡設計