Skip to content

Handle Quick tab behavior when undocked in FlightData view#3683

Open
ArthurPatriot wants to merge 1 commit intoArduPilot:masterfrom
ArthurPatriot:fix/flight-data-docking
Open

Handle Quick tab behavior when undocked in FlightData view#3683
ArthurPatriot wants to merge 1 commit intoArduPilot:masterfrom
ArthurPatriot:fix/flight-data-docking

Conversation

@ArthurPatriot
Copy link
Copy Markdown
Contributor

@ArthurPatriot ArthurPatriot commented Mar 18, 2026

Fix for #3673

When the Quick tab is undocked into a popup window, navigating away from the Flight Data screen (clicking PLAN, SETUP, CONFIG, etc.) and then returning triggers FlightData.Activate(), which calls updateDisplayView() → loadTabControlActions(). That method calls tabControlactions.TabPages.Clear() and then re-adds all tabs from the original list — including tabQuick, which is currently living in the popup form. The TabPages.Add(tabQuick) call reparents tabQuick back to tabControlactions, stealing it from the popup window and leaving it empty (the "ghost" window).
Fix (2 changes in FlightData.cs)

  1. loadTabControlActions() (line 748-749): Skip tabQuick during tab restoration when tabQuickDetached is TRUE, so it remains in the popup form.
  2. updateDisplayView() (line 772): Guard the fallback "ensure at least one tab" logic with !tabQuickDetached, preventing it from forcibly adding the detached Quick tab back.

@ArthurPatriot
Copy link
Copy Markdown
Contributor Author

@meee1

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the “ghost Quick tab” issue in FlightData when the Quick tab is undocked into a popup, by preventing updateDisplayView()/loadTabControlActions() from reparenting the detached tabQuick back into the main tabControlactions.

Changes:

  • Skip restoring tabQuick into tabControlactions while it is detached (tabQuickDetached == true).
  • Prevent the “ensure at least one tab” fallback from forcibly re-adding tabQuick while detached.
Comments suppressed due to low confidence (2)

GCSViews/FlightData.cs:776

  • When tabQuickDetached is true, this guard can leave tabControlactions with zero TabPages (e.g., if the user's display configuration hides all other tabs). That state can trigger runtime exceptions elsewhere (for example, ProcessCmdKey assigns tabControlactions.SelectedIndex = 0..9 without checking bounds). Consider keeping the "at least one tab" invariant by selecting/adding the first available non-Quick tab when detached, or by otherwise ensuring TabPages.Count > 0 even in the detached state (without reparenting tabQuick).
            //we want to at least have one tabpage
            if (tabControlactions.TabPages.Count == 0 && !tabQuickDetached)
            {
                tabControlactions.TabPages.Add(tabQuick);
                tabControlactions.SelectedIndex = 0;
            }

GCSViews/FlightData.cs:761

  • With tabQuickDetached true, tabs that include tabQuick in the saved order will now hit the !added branch and log "not added to tabControlactions tabQuick" even though it was intentionally skipped. This can create misleading/debug-noisy logs whenever loadTabControlActions() runs while detached. Consider treating the Quick tab as "handled" in this case (e.g., set added = true for that tabname or adjust the log message to explicitly say it was skipped due to detachment).
                bool added = false;
                foreach (TabPage tabPage in TabListOriginal)
                {
                    // skip the Quick tab if it is currently undocked into a popup window
                    if (tabQuickDetached && tabPage == tabQuick)
                        continue;

                    if (tabPage.Name == tabname && ((TabListDisplay.ContainsKey(tabname) && TabListDisplay[tabname] == true) || !TabListDisplay.ContainsKey(tabname)))
                    {
                        tabControlactions.TabPages.Add(tabPage);
                        log.Debug("add tabControlactions " + tabPage.Name);
                        added = true;
                        break;
                    }
                }

                if(!added)
                    log.Debug("not added to tabControlactions " + tabname);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ArthurPatriot ArthurPatriot force-pushed the fix/flight-data-docking branch from ea7d711 to a91d0dd Compare March 28, 2026 19:12
@ArthurPatriot
Copy link
Copy Markdown
Contributor Author

@meee1 can be merged

@meee1
Copy link
Copy Markdown
Collaborator

meee1 commented Mar 28, 2026

I'm currently travelling. I won't be merging till after I can verify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants