GUI clickable areas offset to the right?

Started by formica, Tue 25/11/2014 23:08:05

Previous topic - Next topic

formica

I'm having a bizarre problem with my inventory GUI - the hitbox? for everything is moved to the right of the displayed sprite by some amount.



For example if I click the pink block thing I would get the key, and if I click to the right of the OK button it will work as if I've clicked it. I haven't had something like this happen before, any ideas please? This is basically identical to the default inventory but I've deleted the extra buttons.

Thanks!

Vincent

I'm not sure if this hint could be helpful, but I just try to guess your issue.
This is my idea, did you check this section already ?

int InvWindow.ItemHeight; / int InvWindow.ItemWidth;

Gets/sets the height of the rows in the inventory window. You should generally set this up in game_start to the height of your largest inventory item.
The default is 22.

Example:

Code: ags

invMain.ItemWidth = 50;
invMain.ItemHeight = 30;




Crimson Wizard

Quote from: Vincent on Wed 26/11/2014 00:48:07You should generally set this up in game_start to the height of your largest inventory item.
You may also set them on properties panel when the inventory window is selected.

formica

Quote from: Vincent on Wed 26/11/2014 00:48:07
I'm not sure if this hint could be helpful, but I just try to guess your issue.
This is my idea, did you check this section already ?

int InvWindow.ItemHeight; / int InvWindow.ItemWidth;

Gets/sets the height of the rows in the inventory window. You should generally set this up in game_start to the height of your largest inventory item.
The default is 22.

Example:

Code: ags

invMain.ItemWidth = 50;
invMain.ItemHeight = 30;


Thanks for the suggestion guys, but messing with this doesn't seem to help. It's also not just inventory items but also the OK button, which is just a regular GUI button and not within the inventory area. All my other GUIs work fine, I'm not sure why this one is so mixed up.

Maybe I'll just re-make it and see if that works, it's not like its complicated :-D

AprilSkies

Also: a quick check you could do before remaking the gui: check the "hotspot" of the cursor.

www.apemarina.altervista.org

Vincent

Sorry Formica.
I didn't understand when you say :

Quote from: formica on Tue 25/11/2014 23:08:05
and if I click to the right of the OK button

Do you mean by pushing the button OK ?
Or do you mean clicking somewhere else next the button OK ?
As you probably know already, you can detain many things in this way.

Code: ags

function ButtonOK_OnClick(GUIControl *control, MouseButton button)
{
  if (button == eMouseLeft) { }

  if (button == eMouseRight) { }
} 


or

Code: ags

function gInventory_OnClick(GUI *theGui, MouseButton button)
{
    if (button == eMouseLeft) { }

    if (button == eMouseRight) { }
} 

Matti

Quote from: Vincent on Wed 26/11/2014 11:35:43
Or do you mean clicking somewhere else next the button OK ?

Yes, formica meant that you have to click to the right of everything (items, ok-button..) to work. The area you have to click is shifted.

I remember having a similar problem years ago but don't remember what the problem/solution was  :-[

I thought about the cursor hotspot too, but you said it works with other GUIs. Is the inventory GUI the only one from the new game template and you made the others by yourself? Could there be a resolution/coordinates problem? Have you tried making a new inventory?

formica

Quote from: Matti on Wed 26/11/2014 14:23:18
Quote from: Vincent on Wed 26/11/2014 11:35:43
Or do you mean clicking somewhere else next the button OK ?

Yes, formica meant that you have to click to the right of everything (items, ok-button..) to work. The area you have to click is shifted.

I remember having a similar problem years ago but don't remember what the problem/solution was  :-[

I thought about the cursor hotspot too, but you said it works with other GUIs. Is the inventory GUI the only one from the new game template and you made the others by yourself? Could there be a resolution/coordinates problem? Have you tried making a new inventory?

Yes that's exactly it, you have to click to the right of the item you want to click on. I did try the cursor hotspot but it wasn't that either, and anyway everything is shifted by more than the width of the cursor. I haven't tried a new inventory yet but I'll post back here when I do if you're interested.

Thanks for the help everyone! I really appreciate it.

SMF spam blocked by CleanTalk