Hi
I have a situation that to some may be acceptable but I don't and hope someone will assist me in this niggling problem.
I have scripted so that when the mouse is over the gStatusline (bottom of screen) the mouse changes to a pointer and when leaving the gStatusline it returns mouse.Mode=old_mode. This work fine, no problem.
GUI* theGui = GUI.GetAtScreenXY(mouse.x, mouse.y);
if (theGui == gStatusline && mouse.Mode != eModePointer)
{
old_mode=mouse.Mode;
mouse.ChangeModeGraphic (eModePointer, 2061);
mouse.Mode = eModePointer;
}
I also have the gIconbar Visible at all times at the top right of screen.
I have had to script the gIconbar so that the mouse acts like as gStatusline regarding cursor modes ie mouse changes to pointer when over gIconbar buttons.
Now, the problem is this: The mouse, when hovering over the close inventory button changes to a pointer. Once inventory is closed the mouse reverts to the inventory item if one was selected.
I know the reason is because I have this scripted for buttons:
GUIControl *gcat = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if ((gcat == null) || (gcat.AsButton == null)) mouse.UseDefaultGraphic();
else mouse.UseModeGraphic(eModePointer);
}
with also this:
if (theGui != gStatusline && mouse.Mode == eModePointer && mouse.GetModeGraphic(eModePointer) == 2061)
{
mouse.Mode=old_mode;
What I am looking for is to keep mouse active inventory graphic mode showing when going to close the inventory gui yet still maintain cursor mode for the rest of the buttons. If that makes sense?
Help appreciated.
Meanwhile I'm going to try this:
if (gInventory.Visible==true && mouse.ChangeModeGraphic(eModeUseinv,2057 ))
{
mouse.Mode = eModeUseinv;
The last piece of code has the setter instead of the getter in the if condition.
I'm still too tired to map out the logic, but since you want to change the behavior for one button, changing this:
if ((gcat == null) || (gcat.AsButton == null)) mouse.UseDefaultGraphic();
should do it.
Something like
if (gcat == null || gcat.AsButton == null || gcat.AsButton == bCloseInventory) mouse.UseDefaultGraphic();