The International Simutrans Forum

 

Author Topic: combobox inside the tab  (Read 359 times)

0 Members and 1 Guest are viewing this topic.

Offline Ranran

  • Devotee
  • *
  • Posts: 1467
  • Languages: ja
combobox inside the tab
« on: November 11, 2020, 10:48:49 AM »
I'm sorry but, I wonder if this is a bug that comes from standard code. (´・ω・`)

Extended has used a combo box instead of a toggle button.

It doesn't seem to work properly if the combobox is inside a tab.
Older GUI engines never opened it upwards. Yes, there is something wrong with the display when it opens upwards.


Behaves like this when in the gui_aligned_container.



If not gui_aligned_container


Combo boxes with errors have in common that they are in tabs. But unfortunately no similar arrangement is seen in standard.
If I suspect I'm making a mistake, I'd appreciate it if you could give me some hints on how to resolve it.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10541
  • Languages: De,EN,JP
Re: combobox inside the tab
« Reply #1 on: November 11, 2020, 01:50:41 PM »
Comboboxes are hackish, since they require careful tracking of the focus. But without the source code I suspect the second example text is drawn in ::draw after a gui_frame_t::draw() call and not a a gui_xxx element. This mixing of drawing does not work. You have to have you custom dran element inside a gui_componenet_t or gui_container_t and overide the draw method then.

I the first example it may help to enlarge the contaienr to the actual dialog bottom (either by setting the maximize flags or adding a fill component). It might be also an error.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4854
  • Languages: EN, DE, AT
Re: combobox inside the tab
« Reply #2 on: November 11, 2020, 02:19:29 PM »
There is some clipping involved. That list is clipped. I suspect at gui/components/gui_scrollpane.cc line 264. A possible fix(hackish) would be to temporarily reset the clipping in gui_combobox_t::draw.

Offline Ranran

  • Devotee
  • *
  • Posts: 1467
  • Languages: ja
Re: combobox inside the tab
« Reply #3 on: November 14, 2020, 11:54:25 AM »
Thank you for your advice and the correction work.
It seems that a recent fix only fixed the overlapping with tab labels.


This was previously pointed out by james, but mousehole operations seem to prioritize tab scrolling when it is in an aligned container.

When a tab has a scroll bar, the combo box inside the tab cannot be scrolled with the mouse. But if the tab doesn't have a scrollbar, you can scroll it with the mouse.


Works fine with older GUI.




However, if you open it upwards, the click and mouse wheel will be disabled above the red line.
The button is shown at the bottom, but the button has priority for the action. The same is true for tab labels.