View previous topic :: View next topic |
Author |
Message |
AntumDeluge Cheater Reputation: 0
Joined: 20 Dec 2018 Posts: 48
|
Posted: Thu Feb 14, 2019 7:57 am Post subject: How To Create a Tabbed Interface for a Trainer GUI |
|
|
Recently, I was trying to figure out how to create a tabbed interface for my trainer in straight Lua. I came across this old post by Dark Byte that said that the "pagecontrol object isn't exposed to lua". I did a search through Cheat Engine's GitHub repo & found that it now can be accessed through Lua.
After tinkering with it for a bit, these are the steps I've figured out to use it:
1. Create a Form.
2. Create a PageControl with the createPageControl() function & set the Form as its owner.
Code: | local form = createForm()
local tabs = createPageControl(form) |
3. To use the entire area of the main Form, set its Align property to alClient.
4. Tab positioning can be set with the TabPosition property: String value of tpTop, tpBottom, tpLeft, or tpRight.
Code: |
tabs.Align = alClient
tabs.TabPosition = "tpBottom"
|
5. Create new tabs using the addTab() method (Note: Objects created with PageControl.addTab() are TabSheet instances.
Code: |
local tab1 = tabs.addTab()
tab1.setCaption("Tab 1")
local tab2 = tabs.addTab()
tab2.setCaption("Tab 2")
|
6. Now you can add controls to the panels under each tab.
Code: |
local button1 = createButton(tab1)
button1.setCaption("Button 1")
|
Here is the entire script:
Code: |
-- create main window
form = createForm(false)
-- create tabbed interface
local tabs = createPageControl(form)
-- set tabbed interface alignment & position
tabs.Align = alClient
tabs.TabPosition = "tpBottom"
-- add some tabs to the interface with labels
local tab1 = tabs.addTab()
tab1.setCaption("Tab 1")
local tab2 = tabs.addTab()
tab2.setCaption("Tab 2")
-- add controls to the first tab's panel area
local button1 = createButton(tab1)
button1.setCaption("Button 1")
-- give the window its own icon in the taskbar
form.ShowInTaskBar = "stAlways"
-- show the main window
form.show()
|
An example image is attached.
I have also updated the wiki on the PageControl class (incomplete).
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 460
Joined: 09 May 2003 Posts: 25361 Location: The netherlands
|
Posted: Thu Feb 14, 2019 9:23 am Post subject: |
|
|
Just for future reference: pagecontrol is exposed to CE, and just rightclick on it on the form and click "Add tab" and it'll add the tab
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
AntumDeluge Cheater Reputation: 0
Joined: 20 Dec 2018 Posts: 48
|
Posted: Thu Feb 14, 2019 9:28 am Post subject: |
|
|
Thank you Dark Byte. But I like to create my forms in Lua.
The Form Designer actually helped me figure out some of the properties & methods.
Edit: And yes, I noticed I could right-click in the Form Designer to add tabs on the PageControl.
|
|
Back to top |
|
|
GREATBULLET How do I cheat? Reputation: 0
Joined: 02 Apr 2020 Posts: 4
|
Posted: Thu Apr 02, 2020 12:53 pm Post subject: |
|
|
YES BUT IT OPENS A NEW WINDOW THAT YOU CANT EDIT
|
|
Back to top |
|
|
|