| View previous topic :: View next topic |
| Author |
Message |
skynet888 !BEWARE! Deletes post on answer
Reputation: 1
Joined: 12 Apr 2021 Posts: 66
|
Posted: Tue Oct 14, 2025 5:50 am Post subject: the menuitem "TOPMOST" added by lua cannot display |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25807 Location: The netherlands
|
Posted: Tue Oct 14, 2025 6:51 am Post subject: Re: the menuitem "TOPMOST" added by lua cannot dis |
|
|
| 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 |
|
 |
skynet888 !BEWARE! Deletes post on answer
Reputation: 1
Joined: 12 Apr 2021 Posts: 66
|
Posted: Tue Oct 14, 2025 11:49 pm Post subject: Re: the menuitem "TOPMOST" added by lua cannot dis |
|
|
| 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 |
|
 |
C1aref5 Cheater
Reputation: 0
Joined: 20 Feb 2025 Posts: 32
|
Posted: Thu Oct 23, 2025 3:37 pm Post subject: |
|
|
Weird, I ran into something similar before.
It seems the autorun Lua runs before the main form’s menu is fully created, so the item never attaches visually.
|
|
| Back to top |
|
 |
|