About Store Forum Documentation Contact



Post Reply 
Overriding Wndow Close button
Author Message
Rofar Offline
Member

Post: #1
Overriding Wndow Close button
Setting Gui.image_win_close button to a different image does not seem to work. I am able to call Gui.image_win_close->clear() to make it invisible but cannot change the image.
06-29-2013 11:27 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Overriding Wndow Close button
I've just tried changing tutorial "05-Gui/13-Window IO"
Code:
bool Init()
{
   Gui.image_win_close=UID(1194910096, 1331950171, 278997914, 2918364784);
   wio.create("ext", S, S, Load, Save); // create a 'WindowIO', accepting given file extension, paths, and IO functions
   return true;
}
and it works fine.
06-30-2013 01:35 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #3
RE: Overriding Wndow Close button
I tried adding that same line of code into the tutorial and it does not work for me. The close button does not change from the standard red X button.

Is it possible to completely override the drawing of the win_bar? Among other things, I would like to have the title text centered in the bar.
(This post was last modified: 06-30-2013 05:45 PM by Rofar.)
06-30-2013 04:45 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #4
RE: Overriding Wndow Close button
Please disregard what I said about the tutorial not working. As you say, it works fine.

However, it still does not work in my project. Other things that don't seem to work are:
image_slider[0]
image_slider[1]
image_slidebar

image_arrow_up, image_arrow_down, and image_win_bar do get set correctly.
(This post was last modified: 06-30-2013 08:58 PM by Rofar.)
06-30-2013 06:24 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Overriding Wndow Close button
(06-30-2013 04:45 PM)Rofar Wrote:  Among other things, I would like to have the title text centered in the bar.
In next release you'll be able to adjust the
Gui.ts_window.align

As for other/custom drawing of the text, I recommend adding a GuiCustom child to the Window, and drawing it as the title text on top of the window.

Quote:image_slider[0]
image_slider[1]
image_slidebar
are you setting them before creating Gui Objects?
07-01-2013 12:41 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #6
RE: Overriding Wndow Close button
My first approach was to use a child object but I need the bar to move the window.

I will work up a simple test project to experiment with and if I am able to demonstrate the problem this way, I will send you the project. Maybe I will resolve the problem by doing some testing with a simple clean project.
07-01-2013 01:13 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Overriding Wndow Close button
You can create the child object with Rect of zero width and height (this way it won't get mouse focus when cursor will move on top if it)
or alternatively, you can override 'test' method of the object and just return null at the start.
07-01-2013 01:53 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #8
RE: Overriding Wndow Close button
I was able to reproduce the problem very easily. I don't think you will need my test project. I simply used the WindowIO tutorial and created a new GUI element and designed it as a simple window with a title. Then instead of creating the WindowIO window in code, just load the GUI Object. When creating the window in this way, the image_win_close setting does not affect the window.

Code:
bool Init()
{
   Gui.image_win_close = UID(1194910096, 1331950171, 278997914, 2918364784);
  
   wobj.load(UID(2516802505, 1308964728, 3741791654, 2366196587));
   Window *win = wobj.findWindow(S);
   win->button[2].visible(true);
   Gui += wobj;
   return true;
}
07-01-2013 10:49 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: Overriding Wndow Close button
Hi,

When the Window and its Buttons are loaded from file, then the images are not setup from the Gui.image* values, but from the paths that were stored in the file.

So if the window was created, with buttons set to Gui.image* then they were saved with values they were assigned.

You can do:
-override Window.load method, and adjust the images of the Buttons
07-04-2013 02:37 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #10
RE: Overriding Wndow Close button
Perfect! Works great.
07-04-2013 05:09 PM
Find all posts by this user Quote this message in a reply
Post Reply