gen2brain / iup-go

Cross-platform UI library with native controls

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hide Handle in CLOSE_CB

lthon09 opened this issue · comments

I've implemented a traybar item, now I want the window to not close when the close button on the titlebar gets clicked. This is what I've tried:

func closeHandler(_ iup.Ihandle) int {
	iup.Hide(iup.GetHandle("window"))

	return iup.IGNORE
}

window.SetCallback("CLOSE_CB", iup.CloseFunc(closeHandler))

However, calling Hide() seems to close the window, if I remove that line, it works fine. I've tried setting the handle's VISIBLE attribute as well and it doesn't give a different result.

Any ideas? Thanks in advance!

I figured out calling Hide() closes the window, no idea if it's possible to hide it without closing it.

@lthon09 Please, search the IUP mailing list or ask questions there, issues are, well, for issues.

Okay, thanks.

For anyone reading through this, I've now only discovered that the last dialog must be visible in order for the mainloop to continue.

To achieve this, you can set the LOCKLOOP global attribute before hiding the window, as stated here: https://www.tecgraf.puc-rio.br/iup/en/attrib/iup_globals.html#lockloop