Working with PGButton.


I´m new to Panda and I´m having some troubles with PGButton. Some help would be very useful.

I create a button with the next code:

PGButton *button;
button = new PGButton("BUTTON");
NodePath butNP = window->get_aspect_2d().attach_new_node(button);
butNP.set_pos(0 , 0 , 0);

When I run the application appears a button. But, when the mouse is on the button, the button automatically changes like it was pressed.

If I click the button once this behaviour dissapear.

What is going wrong?

Thanks in advance.

[Panda3D 1.7.2]
[Windows 7]
[MSVC 2008]

First, are you sure you are seeing the “press” effect, and not the “rollover” effect? If the button is changing like it is pressed, you will see it move down and to the right a bit, but remain the same color. That is indeed incorrect behavior. But if you are seeing the rollover effect, the button will brighten a bit, which is intended behavior.

If what you are seeing is the press effect, then it means the button thinks you are holding down the mouse button for some reason. I don’t know why. How did you create the button in the first place–was it in response to a mouse click? Maybe if you created it at the time the mouse button was clicking you get this problem?

When I paste in the above code, I don’t see a problem.


Hello David.

First of all, I am very grateful for your interest in this problem, because I don´t know what is going wrong.

I´m sure that I´m seeing the press effect.

When I create the button the press effect appears instead of the rollover effect. But when I click the button once, then all works fine.

I am creating the button from code in the main function.

But I don´t know why the button thinks I am holding down the mouse button.

Regards -ridley-

Hmm, it might be worth trying it again with the buildbot version (instead of 1.7.2), to see if this is an issue that might have been fixed since 1.7.2.


Hi again! :slight_smile:

This is what I have found, the same application (with panda 1.7.2 ) compiled under linux works well. It’s strange, really?

But, like you said, I will test the buildbot version under windows.

Thanks a lot David.