[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reordering components in HPanel fails


Le 16/07/2024 à 15:00, Stéphane Aulery a écrit :
Le 16/07/2024 à 14:34, T Lee Davidson a écrit :
On 7/16/24 08:21, T Lee Davidson wrote:
On 7/16/24 08:06, Stéphane Aulery wrote:
So, the order is the order of insertion ?


It would be better to have an explicit Order property instead of fiddling with the IDE.

I expected that at least the container tree editor could change the order since it has the buttons to reorder. Is this a bug or missing feature?

I recall having an similar issue (actually a misunderstanding of expected behavior) a while back. Back far enough that I don't remember the minute details at the moment. I'll have to see if I can find the thread on the mailing list archive. In the meantime...

The order used is the order in the IDE graphical designer. For a container having the Arrangement property set to other than "None", the components cannot be reordered via the Hierarchy tree.

You could try enlarging the container temporarily to give more room to reorder the controls. Then set it back to the size you want.

Here is the link to the informative response from Benoît:
https://lists.gambas-basic.org/pipermail/user/2024-January/081309.html

Benoît said they follow the values of X property. However, it seemed to me that this was not the case. I'll check later.

And what would happen if X is the same everywhere and only Y varies?

I was wrong, it's not an HPanel but a Panel. I think it doesn't change anything because the Arrangement property is on Vertical.

In the left column all elements have the same value for property X (7).

excution.png, form.png and FMain.form show that controls inside Panel3 are ordered by their order in FMain.form.


I also tried to set the X of LabelSearchOptions to 5 and the X LabelSearchText to 9, to check if X values change the ordering inside the panel in execution. It's still not better.

When reading the code which arranges the controls in the container I find nothing which changes their order according to X. It just loops over the controls with different effects depending on the mode, expand, padding...

https://gitlab.com/gambas/gambas/-/blob/master/gb.qt4/share/gb.form.arrangement.h?ref_type=heads#L134


Finally I did as you told me by adding a line of code with Raise calls. This has an effect on sorting as expected (see form_with_raise.png).

THe call to Raise is here

https://gitlab.com/lkppo/gambas/-/blob/master/gb.qt4/src/CWidget.cpp?ref_type=heads#L1216

which calls arrange_parent(),

https://gitlab.com/lkppo/gambas/-/blob/master/gb.qt4/src/CWidget.cpp?ref_type=heads#L595

and then calls CCONTAINER_arrange(),

https://gitlab.com/lkppo/gambas/-/blob/master/gb.qt4/src/CContainer.cpp?ref_type=heads#L348

This function changes the level (by an edge effect?) of the control and refreshes the geometry.

I'm far from understanding everything but it seems to me that X never intervenes. The display follows the order in which the controls were saved in FMain.form, and calling Raise forces that order.

--
Stéphane Aulery

Attachment: execution.png
Description: PNG image

Attachment: form.png
Description: PNG image

# Gambas Form File 3.0

{ Form Form
  MoveScaled(0,0,142,64)
  Icon = Picture["Images/AstroGrep_256x256.png"]
  Arrangement = Arrange.Fill
  { MenuFile Menu
    Text = ("File")
    { MenuNewWindow Menu
      Text = ("New Window")
      Shortcut = "N"
    }
    { Menu1 Menu
    }
    { MenuSelectSearchPath Menu
      Text = ("Select Search Path") & "..."
      Picture = Picture["Images/folder-open.png"]
      Shortcut = "O"
    }
    { Menu2 Menu
    }
    { MenuSaveResults Menu
      Text = ("Save Results") & "..."
      Enabled = False
      Shortcut = "S"
    }
    { MenuPrintResults Menu
      Text = ("Print Results") & "..."
      Enabled = False
      Shortcut = "P"
    }
    { Menu3 Menu
    }
    { MenuExit Menu
      Text = ("Exit")
      Shortcut = "Q"
    }
    { MenuExitAll Menu
      Text = ("Exit All")
    }
  }
  { MenuEdit Menu
    Text = ("Edit")
    { MenuSelectAllFiles Menu
      Text = ("Select All Files")
      Enabled = False
    }
    { MenuOpenSelectedFiles Menu
      Text = ("Open Selected Files")
      Enabled = False
    }
  }
  { MenuView Menu
    Text = ("View")
    { MenuStatusMessages Menu
      Text = ("Status Messages")
      Enabled = False
    }
    { MenuExclusionMessages Menu
      Text = ("Exclusion Messages")
      Enabled = False
    }
    { MenuErrorMessages Menu
      Text = ("Error Messages")
      Enabled = False
    }
    { MenuAllMessages Menu
      Text = ("All Messages")
      Enabled = False
    }
    { Menu4 Menu
    }
    { MenuZoom Menu
      Text = ("Zoom")
      { MenuZoomIn Menu
        Text = ("Zoom In (Ctrl + Mouse Wheel Up)")
        Shortcut = "Ctrl++"
      }
      { MenuZoomOut Menu
        Text = ("Zoom Out (Ctrl + Mouse Wheel Down)")
        Shortcut = "Ctrl+-"
      }
      { MenuRestoreDefaultZoom Menu
        Text = ("Restore Default Zoom")
        Shortcut = "Ctrl+/"
      }
    }
    { MenuLinesNumbers Menu
      Text = ("Lines Numbers")
      Picture = Picture["Resources/line_numbers.png"]
      Toggle = True
      Checked = True
    }
    { MenuWordWrap Menu
      Text = ("Word Wrap")
      Picture = Picture["Resources/word_wrap.png"]
    }
    { MenuRemoveLeadingWhiteSpace Menu
      Text = ("Remove Leading White Space")
      Picture = Picture["Resources/text_indent_remove.png"]
    }
    { MenuEntireFile Menu
      Text = ("Entire File")
      Picture = Picture["Resources/text_resize.png"]
    }
    { MenuShowAllCharacters Menu
      Text = ("Show All Characters")
      Picture = Picture["Resources/pilcrow.png"]
    }
    { Menu5 Menu
    }
    { MenuAllResults Menu
      Text = ("All Results")
      Picture = Picture["Resources/preview_results.png"]
    }
  }
  { MenuTools Menu
    Text = ("Tools")
    { MenuClearMostRecentlyUsedLists Menu
      Text = ("Clear Most Recently Used Lists")
    }
    { Menu6 Menu
      { MenuSearchPath Menu
        Text = ("Search Path")
      }
      { MenuFileTypes Menu
        Text = ("File Types")
      }
      { MenuSearchText Menu
        Text = ("Search Text")
      }
      { Menu7 Menu
      }
      { MenuAll Menu
        Text = ("All")
      }
    }
    { MenuSaveSearchOptions Menu
      Text = ("Save Search Options")
    }
    { MenuOptions Menu
      Text = ("Options")
      Picture = Picture["Resources/cog.png"]
      Shortcut = "F9"
    }
  }
  { MenuHelp Menu
    Text = ("Help")
    { MenuViewHelp Menu
      Text = ("View Help")
      Shortcut = "F1"
    }
    { MenuRegularExpressions Menu
      Text = ("Regular Expressions")
    }
    { MenuLogFile Menu
      Text = ("Log File")
    }
    { Menu8 Menu
    }
    { MenuCheckForUpdates Menu
      Text = ("Check For Updates") & "..."
    }
    { Menu9 Menu
    }
    { MenuDonate Menu
      Text = ("Donate")
    }
    { MenuAboutAstroGrep Menu
      Text = ("About AstroGrep")
      Picture = Picture["Images/AstroGrep_256x256.png"]
    }
  }
  { Panel1 Panel
    MoveScaled(0,0,142.8571,60.8571)
    { Splitter1 Splitter
      MoveScaled(0,0,142,60)
      { Panel3 Panel
        MoveScaled(0,0,35,60)
        Arrangement = Arrange.Vertical
        { ComboBoxSearchPath ComboBox
          MoveScaled(1,8,33,4)
        }
        { ComboBoxFileTypes ComboBox
          MoveScaled(1,16,33,4)
        }
        { LabelAstroGrepSearch Label
          MoveScaled(1,0,33,6)
          Font = Font["+3"]
          Foreground = Color.Orange
          Text = ("AstroGrep Search")
        }
        { ComboBoxSearchText ComboBox
          MoveScaled(1,24,33,4)
        }
        { LabelSearchOptions Label
          MoveScaled(1,31,33,6)
          Font = Font["+3"]
          Foreground = Color.Orange
          Text = ("Search Options")
        }
        { LabelSearchPath Label
          MoveScaled(1,5,33,3)
          Text = ("Search Path")
        }
        { LabelFileTypes Label
          MoveScaled(1,13,33,3)
          Text = ("File Types")
        }
        { LabelSearchText Label
          MoveScaled(1,21,33,3)
          Text = ("Search Text")
        }
      }
      { Panel2 Panel
        MoveScaled(35,0,107.8571,60.8571)
        { Splitter2 Splitter
          MoveScaled(0,0,107,60)
          Expand = True
          Arrangement = Arrange.Vertical
          { Panel4 Panel
            MoveScaled(0,0,107,32)
            Arrangement = Arrange.Fill
            { ColumnView1 ColumnView
              MoveScaled(0,0,107,32)
            }
          }
          { VBox2 VBox
            MoveScaled(0,32,107,28)
            Expand = True
            AutoResize = True
            { TextEditor1 TextEditor
              MoveScaled(0,0,107,28)
              ReadOnly = True
              ShowLineNumber = True
            }
          }
        }
      }
    }
  }
}

Attachment: form_with_raise.png
Description: PNG image


Follow-Ups:
Re: Reordering components in HPanel failsBB <adamnt42@xxxxxxxxx>
Re: Reordering components in HPanel failsT Lee Davidson <t.lee.davidson@xxxxxxxxx>
References:
Reordering components in HPanel failsStéphane Aulery <lkppo@xxxxxxx>
Re: Reordering components in HPanel failsBruce Steers <bsteers4@xxxxxxxxx>
Re: Reordering components in HPanel failsBruce Steers <bsteers4@xxxxxxxxx>
Re: Reordering components in HPanel failsStéphane Aulery <lkppo@xxxxxxx>
Re: Reordering components in HPanel failsT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: Reordering components in HPanel failsT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: Reordering components in HPanel failsStéphane Aulery <lkppo@xxxxxxx>