Working with PGButton.

Return to C++ coding using Panda3D

Working with PGButton.

Postby -ridley- » Tue Sep 27, 2011 4:01 am

Hello!

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:

Code: Select all
PGButton *button;
button = new PGButton("BUTTON");
button->setup("Text",0.02);   
NodePath butNP = window->get_aspect_2d().attach_new_node(button);
butNP.set_scale(0.1,0.1,0.1);
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]
-ridley-
 
Posts: 7
Joined: Tue Aug 30, 2011 9:01 am

Postby drwr » Tue Sep 27, 2011 9:15 am

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.

David
drwr
 
Posts: 11253
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby -ridley- » Tue Sep 27, 2011 10:40 am

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-
-ridley-
 
Posts: 7
Joined: Tue Aug 30, 2011 9:01 am

Postby drwr » Tue Sep 27, 2011 11:09 am

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.

David
drwr
 
Posts: 11253
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby -ridley- » Tue Sep 27, 2011 2:54 pm

Hi again! :)

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.
-ridley-
 
Posts: 7
Joined: Tue Aug 30, 2011 9:01 am


Return to C++ coding using Panda3D

Who is online

Users browsing this forum: No registered users and 0 guests