Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How To Create a Tabbed Interface for a Trainer GUI

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials
View previous topic :: View next topic  
Author Message
AntumDeluge
Cheater
Reputation: 0

Joined: 20 Dec 2018
Posts: 48

PostPosted: Thu Feb 14, 2019 7:57 am    Post subject: How To Create a Tabbed Interface for a Trainer GUI Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 371

Joined: 09 May 2003
Posts: 21921
Location: The netherlands

PostPosted: Thu Feb 14, 2019 9:23 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
AntumDeluge
Cheater
Reputation: 0

Joined: 20 Dec 2018
Posts: 48

PostPosted: Thu Feb 14, 2019 9:28 am    Post subject: Reply with quote

Thank you Dark Byte. But I like to create my forms in Lua. Smile

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites