Opened 4 years ago

Last modified 4 years ago

#17160 confirmed defect

SetSize with default height on wxTextCtrl while hidden after parameter change results in zero height with wxGTK3

Reported by: swt2c Owned by:
Priority: normal Milestone:
Component: wxGTK Version: 3.0.2
Keywords: Cc:
Blocked By: Blocking:
Patch: no


If you create a wxTextCtrl, then change the foreground color, background color, or height, hide it, then set the height to -1, then show it, the resulting height is now zero. This doesn't seem to happen with GTK2 so it seems to be a GTK3 only issue.

Full test case attached.

Attachments (1)

textctrl.cpp download (1004 bytes) - added by swt2c 4 years ago.

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by swt2c

comment:1 Changed 4 years ago by pcor

  • Status changed from new to confirmed

Getting the best size for a hidden widget does not work with GTK3, because gtk_widget_get_preferred_size() returns 0x0. I don't think there is much we can reasonably do about that. You may be able to work around it by either not calling SetSize() on a hidden widget, or making sure the cached best size is valid (by calling GetBestSize()) before hiding it. I will look into not invalidating the best size for a color change, but it definitely needs to happen for a font change.

Note: See TracTickets for help on using tickets.