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 


the menuitem "TOPMOST" added by lua cannot display

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
skynet888
!BEWARE! Deletes post on answer
Reputation: 1

Joined: 12 Apr 2021
Posts: 66

PostPosted: Tue Oct 14, 2025 5:50 am    Post subject: the menuitem "TOPMOST" added by lua cannot display Reply with quote

autorun lua:
local function toggle_topmost()
local mainForm = getMainForm()
if mainForm.formstyle == "fs_system_stay_on_top" then
mainForm.formstyle = "fs_normal"
else
mainForm.formstyle = "fs_system_stay_on_top"
end
end

local function add_menu_item()
local toolsMenu = getMainForm().menu.items[4]
if not toolsMenu then
showMessage("cannot find menuitem_tools")
return
end

local miToggle = createMenuItem(toolsMenu)
miToggle.caption = "TOPMOST"
miToggle.onclick = toggle_topmost
miToggle.visible = true
end

add_menu_item()
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Oct 14, 2025 6:51 am    Post subject: Re: the menuitem "TOPMOST" added by lua cannot dis Reply with quote

skynet888 wrote:
autorun lua:
local function toggle_topmost()
local mainForm = getMainForm()
if mainForm.formstyle == "fs_system_stay_on_top" then
mainForm.formstyle = "fs_normal"
else
mainForm.formstyle = "fs_system_stay_on_top"
end
end

local function add_menu_item()
local toolsMenu = getMainForm().menu.items[4]
if not toolsMenu then
showMessage("cannot find menuitem_tools")
return
end

local miToggle = createMenuItem(toolsMenu)
miToggle.caption = "TOPMOST"
miToggle.onclick = toggle_topmost
miToggle.visible = true
end

add_menu_item()



1: it's fsSystemStayOnTop , not fs_system_stay_on_top
2: the tools menu isn't always at index 4 (use MainForm.ools1)
3: Often the tools menu is invisible, so make it visible
4: you need to add the new menuitem to the tools menu, just creating it as it's owner doesn't mean it gets added to it

at the end of add_menu_item add this:
Code:

    MainForm.ools1.add(miToggle)
    MainForm.ools1.Visible=true

_________________
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
skynet888
!BEWARE! Deletes post on answer
Reputation: 1

Joined: 12 Apr 2021
Posts: 66

PostPosted: Tue Oct 14, 2025 11:49 pm    Post subject: Re: the menuitem "TOPMOST" added by lua cannot dis Reply with quote

Dark Byte wrote:

1: it's fsSystemStayOnTop , not fs_system_stay_on_top
2: the tools menu isn't always at index 4 (use MainForm.ools1)
3: Often the tools menu is invisible, so make it visible
4: you need to add the new menuitem to the tools menu, just creating it as it's owner doesn't mean it gets added to it

at the end of add_menu_item add this:
Code:

    MainForm.ools1.add(miToggle)
    MainForm.ools1.Visible=true


This is so strange—the newly added menu items still aren't showing up.
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 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 can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites