Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

How to ensure a tab appear as the leftmost tab in the space

When loading files is it possible to force a specific file to appear on the leftmost tab position regardless of the order in which they were loaded.
Tagged:

Comments

  • 6 Comments sorted by Votes Date Added
  • It is not possible while loading. You can do it right after, by re-docking the panel using DockControl method and specifying ATabIndex = 0.
  • I am probably doing this wrong but I am getting an access violation when I try and force it to tab position 0.
    This is the code I have used...
    p := OpenPage(s,false, hlPositron, OpenMain);// Creates a DockPanel containing a control and returns with the DockPanel.
    dsMain.DockControl(p,p.Zone,alClient,0);// This attempts to set the tab position but causes the access violation

    Could this be a timing issue, where the Control has not been created before the panel tab is re-positioned .
  • Are you sure that p.Zone is not nil?
  • You are right, its nil.
    Attached is a reduced version of the Open Page code 

    Start from the bottom of the page where I open a file and force it to tab position 0
    I call open page, which calls add page which calls create dock.  If all works OK the created dock panel back through the chain to the original calling routine.

    How is it that the doc zone is initially valid but by the time it reaches the calling function its nil.

    John Barrat
    txt
    txt
    DockIssue.txt
    3K
  • Looking at your code, I've realized that you loading files one by one (I've initially though that you want to load the whole docking layout). So, my first answer was wrong, and in this case you actually can specify tab position directly, without re-docking the panel second time.

    Try to specify zero for ATabIndex parameter of the DockControl method directly in your CreateDock method, like:

    //....
    if zn <> nil then
    DsMain.DockControl(Result, zn, alClient, 0 {<- here}, SelectPage)
    else
    Result := nil;
    //...
  • Thank you, that seems to get me to where I want to be.
Sign In or Register to comment.