From 394f531146ae200f57b00f0c9c305d5274b10d0d Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Sun, 8 Mar 2026 21:58:12 +0000 Subject: [PATCH] Allow specifying object position in show() method --- riscos_toolbox/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/riscos_toolbox/base.py b/riscos_toolbox/base.py index d9bc1b5..e03970e 100644 --- a/riscos_toolbox/base.py +++ b/riscos_toolbox/base.py @@ -2,6 +2,7 @@ from .events import EventHandler import swi +import ctypes _objects = {} _application = None @@ -68,7 +69,7 @@ def create(class_id, name, id): def show(self, menu_semantics=False, submenu_semantics=False, - type=0, parent=None): + type=0, position=0, parent=None): flags = 0 if menu_semantics: flags |= 1 @@ -80,8 +81,11 @@ def show(self, else: parent_obj = parent_comp = 0 + if isinstance(position, ctypes.Structure): + position = ctypes.addressof(position) + swi.swi('Toolbox_ShowObject', 'IiIIii', - flags, self.id, type, 0, parent_obj, parent_comp) + flags, self.id, type, position, parent_obj, parent_comp) def hide(self): swi.swi('Toolbox_HideObject', 'Ii', 0, self.id)