Skip to content

VUI Components Can Not Be Removed From The Stack Like Other Widgets #610

@Wajinn

Description

@Wajinn

V version:

V 0.4.11

UI version:

V UI 0.0.4

Ubuntu Linux 25.04, Windows 10

What did you do?

	mut stack := btn.ui.window.child()
	if mut stack is ui.Stack {
		mut widgets := stack.get_children() 
		stack.remove(children: widgets) // if widget is component than removal fails	
		stack.add(child: other_widget) // however component can be added to the stack or switched to
		stack.update_layout()
	}

What did you expect to see?

Successful removal of stack and adding of new stack.

Components (like uic.filebrowser_stack or uic.fontchooser_stack) should be able to be removed from the stack just like any other widget.

What did you see instead?

V panic: string.eq(): nil string
v hash: 880a987
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:13133: at _v_panic: Backtrace
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:15188: by string__eq
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:43962: by ui__Window_is_top_widget
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:31994: by ui__btn_click
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:19600: by eventbus__Publisher_T_string_publish_T_string
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:19582: by eventbus__EventBus_T_string_publish_T_string
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:45344: by ui__window_click_or_touch_tap
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:45387: by ui__window_click_or_touch_tap_and_swipe
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:45079: by ui__on_event
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:23529: by gg__gg_event_fn
/demo/v/thirdparty/sokol/sokol_app.h:3099: by _sapp_call_event
/demo/v/thirdparty/sokol/sokol_app.h:10903: by _sapp_x11_mouse_event
/demo/v/thirdparty/sokol/sokol_app.h:11183: by _sapp_x11_on_buttonrelease
/demo/v/thirdparty/sokol/sokol_app.h:11382: by _sapp_x11_process_event
/demo/v/thirdparty/sokol/sokol_app.h:11596: by _sapp_linux_run
/demo/v/thirdparty/sokol/sokol_app.h:11655: by sapp_run
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:22267: by sokol__sapp__run
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:23708: by gg__Context_run
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:44505: by ui__run
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:46201: by ui__Window_run
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:49447: by main__flash
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:49443: by main__main
/tmp/v_1000/VUI_demo_07.01K23N5TR0SE93ZW0P6Q1FG2CZ.tmp.c:49742: by main

Possible Workaround

Use the component in a child window, which gives the same result as stack.remove() and stack.add(). However, this is counterintuitive, as different from other widgets (buttons, labels, etc...). Not clear if the difference is intentional and part of the design or not.

	app.window.child_window(
		children: [
			ui.row(children: [component])
		]
	)
	app.window.update_layout()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions