[Solved] stop free the tab when press the tab [X]

BlitzMax Forums/Brucey's Modules/[Solved] stop free the tab when press the tab [X]

MOBii(Posted 2015) [#1]
When press the any [X] on the tab:

' I try catch the tab before it kill it's children panel
MOBii_TAB[q].ConnectAny(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, OnCloseWindows)
MOBii_TAB[q].ConnectAny(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED, OnCloseWindows)

Function OnCloseWindows(_event:wxEvent)
	BLLua.DoOnCloseWindows(_event)
	_event.Skip(False)	' this don't work still kill the tab and the panel after this
' I was wrong even when wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING the panel is dead
End Function
When I use the [X] button it free() the tab and the child panel,
so when I press the [X] then the mouseover: label don't exist anymore and the program "EXCEPTION_ACCESS_VIOLATION" terminate

I want to stop the tab to kill the child panel automatical (so I can kill/free the panel myself when I want)


MOBii(Posted 2015) [#2]
When _event.eventType = wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED
I still got the data so I could recreate the panel again!
I was thinking I solve the problem but when I press the [X]
it free() the tab, it free() the child panel and it free all children on the panel, hehe
so even if I recreate the panel when the panel was destroyed, the children of the panel is gone too and I can't recreate the children because I don't know them!

I need to stop the tab to call the free() when the user press the [X]


MOBii(Posted 2015) [#3]
I could remove/forbid the [X] from the tab and make the user remove tab manually! (but that is against my will)
Or Warn if the user press the [X] it kill the panel permanently.
It would be cool if I could stop the tab from calling free()..
I still hope for a miracle!


Henri(Posted 2015) [#4]
Hi,

on christmas everything is possible :-)


If you want to override the 'CloseTab' then add this to your OnClose - function:
Local ev:wxNotifyEvent = wxNotifyEvent(event)
If ev Then ev.veto()

-Henri


MOBii(Posted 2015) [#5]
I am so impressed that you actually could help!
I just Copy Paste and it worked
Happy new 2016 Henri