Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Charles Woodhill | |
Old Version | Published before Godot 3 was released. |
when i create a control (c++)
then some of the properties are ignored.
in my case its a texture button, and set_scale():
TextureButton* tbut1 = memnew(TextureButton());
newHBox->add_child(tbut1);
//tbut1->set_expand(false);
//tbut1->set_stretch_mode(TextureButton::STRETCH_SCALE);
//tbut1->set_clip_contents(true);
// also sets size to size of texture (1024x1024 in my case)
// ignoring STRETCH_SCALE
tbut1->set_normal_texture(testTex1);
// not needed, since sizeof texture much bigger (in this example)
//tbut1->set_custom_minimum_size(Size2(20, 20));
//for some reason texButton completely ignores size,
//even with STRETCH_SCALE
tbut1->set_size(Size2(20, 20));
tbut1->update(); //ignored since (pending_update = true;)
tbut1->set_scale(Vector2(0.02, 0.02)); // it is ignored...
tbut1->update(); //ignored since (pending_update = true;)
tbut1->set_scale(Vector2(0.02, 0.02)); is ignored at “creation time”
but when i call it (for test purpose) in the onClicked Handler, its gets scaled.
maybe has something todo with the (pending_update = true;)
what am i missing?
EDIT: changed header description to a better meaning
I think you should create instance by TextureButton* tbut1 = memnew(TextureButton);
not TextureButton* tbut1 = memnew(TextureButton());
volzhs | 2017-03-19 10:57
ofc thats true, tnx for hint
Charles Woodhill | 2017-03-21 11:59