Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizing window and moving button to higher x position than the original window width #26

Closed
EJTH opened this issue Oct 9, 2015 · 4 comments

Comments

@EJTH
Copy link

EJTH commented Oct 9, 2015

When a button is moved outside of the original window width it stops working (No hover effect, clicks doesnt register)

Here is a sketch to illustrate it:

import controlP5.*;

ControlP5 cp5;
Button button;

void setup() {
  size(400,600);
  surface.setResizable(true);

  cp5 = new ControlP5(this);

  button = cp5.addButton("testbtn")
     .setPosition(width-110,10)
     .setSize(100,20);

}

void testbtn(){
  println("clicked");
}

void draw() {
  button.setPosition(width-110,10);
}

Drag the window to a new size at least 100px wider than the original.

Result:
Button doesnt work

Expected result:
Button should be clickable, but it is not

@EJTH
Copy link
Author

EJTH commented Oct 15, 2015

Calling setGraphics after resize fixes the issue.

cp5.setGraphics(this,0,0);

@euphy
Copy link

euphy commented Oct 25, 2015

Well, I never would have guessed that - thank you very much for updating this issue!

@ghost
Copy link

ghost commented Sep 12, 2018

Thank you ! You're a god!

@sojamo
Copy link
Owner

sojamo commented Sep 21, 2018

Calling setGraphics after resize fixes the issue.

cp5.setGraphics(this,0,0);

solution by @EJTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants