[SOLVED] Mouseover Object Bug or very odd behviour

0 favourites
  • 11 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi all.

    I have 10 instances of buttons. 1 button object.

    I have set Mouse -> Cursor is over Button - Mouse Set Cursor to Hand.

    When i run the game, it is set to a Hand everywhere EXCEPT over the buttons.

    Is this a known bug? And how do i fix it.

    Incidentally, if i invert the action, so Red X Cursor is over Button ... the same thing happens. I get a hand everywhere except when over the buttons as i would expect.

  • Hi all.

    I have 10 instances of buttons. 1 button object.

    I have set Mouse -> Cursor is over Button - Mouse Set Cursor to Hand.

    When i run the game, it is set to a Hand everywhere EXCEPT over the buttons.

    Is this a known bug? And how do i fix it.

    Incidentally, if i invert the action, so Red X Cursor is over Button ... the same thing happens. I get a hand everywhere except when over the buttons as i would expect.

    Doubt it is a bug. Show your Events or .capx.

  • OOH!

    One I can answer!

    I had this problem too, and there is probably a better solution, but I got around it by using an "every tick" command constantly setting the cursor back to "Normal" (it stayed changed when over the button).

    There has to be a better way, but that got me going and the page was extremely simple so there was no noticeable slowdown.

    I hope a better answer comes along so I can implement it - but meanwhile, that worked for me when I had the identical issue.

  • zenox98

    What events? This is a top level event and nothing else touches the mouse over situation!

    Sockratease every tick ? But the the mouse over object should be an event so why do I have to check every tick.

    If it changed and stayed changed elsewhere ok, but it is specifically over the buttons that it is not the hand.

    I can't post links yet so how can I add my cap file?

  • Sockratease every tick ? But the the mouse over object should be an event so why do I have to check every tick.

    If it changed and stayed changed elsewhere ok, but it is specifically over the buttons that it is not the hand.

    As I said, it doesn't seem to make sense, but it worked. So I went with it.

    The only reason I can think of is that there is a "on mouseover" type command changing things, but no "on mouseout" command to change it back.

    That also makes no sense, but I never claimed to understand why it fixed the issue for me, only that it did and I was satisfied since there was no noticeable hit on performance. Call it a brute force solution if you like. I'm too new to Construct 2 to say anything more...

  • Sockratease Yes, thanks for the suggestion, but unforunately it doesn't work for me.

    If it makes a difference the buttons are on a layer that is initially invisible and then made visible on an event.

  • Does it stay hidden, or come back later?

    Probably obvious, but if it stays hidden, try destroying it instead of hiding it.

    Sorry that didn't work for you.

    Mine changed layouts rather than get hidden, but that should not effect much.

    Have you tried dropbox to host your capx file?

    You may not be able to post a live link, but I think I read you can post a text link to your examples.

    Good luck with it!

  • It's a simple counting game for kids. A random number of animals appear (1 per second) then when this round's number has finished spawning, the button pad appears and the user clicks the button for the number of animals shown. It's about choosing the right text number.

    So the layer that the pad background and buttons are on appears and disappears about 10 times.

    I tried a Google drive Link but the editor removed the link part... I guess I could spell it out , removing the http part.

    Thanks anyway.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • https://drive.google.com/file/d/1cMA343MoZanJ7l9-SSxq5CquSHS44k4E/view?usp=sharing

    I hope the above link shows.

    This is my capx, i have tried to find why the cursor doesn't change but i am hoping someone here will be able to spot the problem.

    Thanks,

  • I think what's happening is that Button object in C2 has its own cursor style and it overrides the cursor you set with "Mouse->Set cursor" event.

    You need to use CSS to set cursor style:

    #MyButton:hover {
      cursor: pointer;
    }
    [/code:3n9a7gmn]
    
    You can also change button appearance with CSS.
    See this demo:
    [url=https://www.dropbox.com/s/2hzzgt5n2kebj3i/ButtonStyled_244.capx?dl=0]https://www.dropbox.com/s/2hzzgt5n2kebj ... .capx?dl=0[/url]
    
    Tutorial:
    [url=https://www.scirra.com/tutorials/1283/css-your-buttons-and-textboxes]https://www.scirra.com/tutorials/1283/c ... -textboxes[/url]
  • dop2000

    Thank you, that does make sense, but i would have had no idea how to get the css into my capx project.

    Also for anyone else looking at this, in CSS an ID has to be unique so in this case setting an ID on the object set the same ID on all the buttons.

    The css needed for this is

    input[type=button]{
    cursor: pointer;
    }
    [/code:3ulxqewo]
    
    This will set it for all buttons.
    
    Also just in case people are not familiar with CSS the tutorial above uses a file called style.css but it can be called anything, so long as it matches the load command from the event sheet. Style.css is a very common name for css files and its best to avoid one that may conflict.
    
    @zenox98  I consider this a bug as Construct 2 is controlling the CSS of the buttons and the JS of setting the mouseover which seems to conflict , thus preventing that action on a button object.
    
    It would be useful if this page
    [url]https://www.scirra.com/manual/111/button[/url]
    mentioned more about CSS or that C2 has its own cursor styles.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)