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
Joined: 09 May 2003 Posts: 25806 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
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
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