The International Simutrans Forum

 

Author Topic: Something fishy with borderless items.  (Read 487 times)

0 Members and 1 Guest are viewing this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10541
  • Languages: De,EN,JP
Something fishy with borderless items.
« on: December 07, 2020, 02:27:48 PM »
Let's take the convoi details as example. Currently the convoi_detail_t element gets an extra margin, compared to the buttons before, which are after an add_table call.

So if I set the margins of the outer container container_details to zero, the buttons are indeed at zero. Even thought he buttons are inside a table.
However, even if I add explictely an extra component, the padding will not added. Even if I set the margins for that extrat table by hand.

So it seems calling set?margin on a gui_aligned_contianer DOES NOT set the maregins of said container. Rather is sets the margin for a objects in it. So it is very hard to achieve a uniform formatiing in sub_object (liek gui_scheduel or gui_vehicleinfo_t) which are indside such things, because they get extra padding.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4854
  • Languages: EN, DE, AT
Re: Something fishy with borderless items.
« Reply #1 on: December 07, 2020, 03:32:04 PM »
Nested tables will get zero margin by default, see gui_aligned_container_t::add_component. I do not know why the details container gets some extra margin. Will look into this tonight.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4854
  • Languages: EN, DE, AT
Re: Something fishy with borderless items.
« Reply #2 on: December 07, 2020, 08:01:37 PM »
I do not understand your request. The elements in the convoy-detail tab are perfectly aligned to the left. All elements (besides the tab panel heads) have the same margin on the left.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10541
  • Languages: De,EN,JP
Re: Something fishy with borderless items.
« Reply #3 on: December 08, 2020, 12:49:57 PM »
If I set the last element to be without borders, all elements have zero borders. However, it does no occur right now any more.

Thank you, you explanation was quite helpful.

So for marginless componenets (which are those which display a scrollbar, the inside tables need an explicit call to add_tabel(,)->sset_margin( scr_size(D_MARGIN_LEFT,0), scr_size(D_MARGIN_RIGHT,0) ); to have the same border than the elements in the scroll pane.