Usually the way to prevent closing in User Interface scripts (and standard Windows) is to use this method:
http://www.thinbasic.com/community/s...0172#post70172
I do not know in TBGL Windows.
Is it possible to avoid closing the TBGL-Window via the System-Window-Close-Button ("X", up-right, red mostly if you point it)
I want to ask my user, if he wants to save on exit ("Yes|No|Cancel")
- but in case he closes the window using the system-close-button, i can only offer "Yes|No" currently
(in some "lost-on-screen, small" msgbox that can be easily overseen because it has no parent...)
since the window is closed and resources (as Fonts & Textures) are released already.
Can i trap this?
From visual basic i know there will be raised an event
simplified example:
can we bind something as this:Sub myWindow_Close(ByRef Cancel As Boolean) ' if the user sets: Cancel = TRUE ' within this sub then ' window won't close End Sub
???TBGL_BindWindowEvent( hWnd, %TBGL_OnWindowClose, "myWindow_Close")
Last edited by ReneMiner; 30-11-2015 at 14:34.
I think there are missing some Forum-sections as beta-testing and support
Usually the way to prevent closing in User Interface scripts (and standard Windows) is to use this method:
http://www.thinbasic.com/community/s...0172#post70172
I do not know in TBGL Windows.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Hi Rene,
I think the easiest approach would be to eliminate the close box, if you don't want it.
Instead of:
...use just:%TBGL_WS_WINDOWED | %TBGL_WS_CLOSEBOX | %TBGL_WS_DONTKEEPASPECTRATIO
Another alternative would be embedding the TBGL into ThinBASIC dialog - then you can handle all events you need.%TBGL_WS_WINDOWED | %TBGL_WS_DONTKEEPASPECTRATIO
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Binding the close event is technically possible. I am just scratching my head whether to go this route or not.
I would not like to end up duplicating the UI stuff we already have in... UI module. Let me think about it!
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
TBGL works windowed too - not limited to fullscreen only.
So we should be able to react if the render-surface is about to disappear and to make sure the user really wants this before all resources are destroyed - or should we just rigorous create them again?
I would not like have to port all stuff to a canvas - to rewrite all the input and to enlarge the final bundle about the size of UI-module for just this - since it's my intention not have to Uses "UI" nor Callbacks and the reason to create own controls only using TBGL_Rect & TBGL_PrintFont2d. Later I will add rendering quads and some simple to use texture-handling (mostly loading of many different file-formats) for some textured controls. Then the re-creation could become a little more effort.
Still there's no window but just the small, easy to oversee msgbox that keeps the script running.
I try to avoid to Declare external Subs & Functions as much as possible- so I'm already really happy about TBGL_PushLogicOp.
But in case there were a possibility to use some win32-function that allows to cancel the window closing then i would prefer it over Uses "UI".
I think there are missing some Forum-sections as beta-testing and support
I think Petr was referring not to transform into a Canvass (too much work) but to have a TBGL control over a standard UI Window (TBGL_BindCanvas) in order to let the Window to handle non TBGL events in a callback.
The rest would be handled as usual in TBGL.
An example in C:\thinBasic\SampleScripts\TBGL\EntityBased\TBGL_Control_Targeting_GettingInfo.tbasic
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Eros got it exactly as I mentioned - on the other side I understand Rene's avoidance of multi-module scripts.
I will have a look during weekend, I think I should be able to achieve what is needed
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Bookmarks