How do I change Graphics window title after...
BlitzMax Forums/BlitzMax Beginners Area/How do I change Graphics window title after...
| ||
...it's created? Changing AppTitle$ doesn't work and I want to display FPS in title bar. |
| ||
There was an earlier thread on this topic - which should help you. http://www.blitzbasic.com/Community/posts.php?topic=104470#1266085 |
| ||
This should be useful too, obtaining the hWnd of the graphics window from the graphics object: http://www.blitzbasic.com/Community/posts.php?topic=104073#1258487 |
| ||
Thanks, both of you! But how about multiplatform way so I can easily port it to Linux and OSX as well? |
| ||
Look in the MaxGUI source code. When you use the MaxGUI SetGadgetText function on a window gadget, it changes the window caption ("caption" is another name for the title text). Then you look for the native functions it uses to do that. Here's how it does this for the Cocoa driver, for example: https://github.com/BlitzMaxModules/maxgui.mod/blob/master/cocoamaxgui.mod/cocoa.macos.m#L3551 |
| ||
Thanks. Though I'm not sure how to translate C code into BlitzMax one. Anyway, I think it'd be best if Graphics window would synchronize its title with AppTitle$, at graphics window's refresh rate. Maybe in BMax-NG? |
| ||
Well, AppTitle should work even with standard Bmax http://www.blitzmax.com/Community/post.php?topic=105215&post=1280446 |
| ||
He wants to change the window caption 'after' it is created, which you can't do with AppTitle. This is the simplest form of reproducing the problem: AppTitle = "Bla" Graphics( 400, 300 ) AppTitle = "Bli" 'Doesn't do anything. Waitkey() EndThe MaxGUI SetGadgetText function on window gadgets does what he wants, but someone will need to grab the code from the source and make it usable standalone. I don't have the time. |
| ||
Damn, I was sure it's behaviour was changed in time! With Confirm/Notify etc it works because everytime a new window is created and then destroyed, and you change a Global var with AppTitle. ps: just looked in the source code, it's seems a so complicated thing to do a so simple task! |