Read the option tab titles when the sheet opens, not when it is built - #150
Merged
Conversation
The option pages are constructed with the main frame, which on a first run happens before the language dialog, so LANG_T(-1) is still 0 and the PSP_USETITLE branch never runs. Every other string on a page is set at display time, so the sheet came up with translated content under English tabs, and only a restart fixed it. CMainTab::DoModal() now re-reads the eleven titles first, which covers all three call sites. SetWindowText() copies into the page's own m_strCaption, so the hash-table string a language change frees is not stashed (#56). Signed-off-by: Xavier Roche <xroche@gmail.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
Setting each page's caption ahead of CPropertySheet::DoModal() stopped the sheet from opening at all: a French walk reached the main window, clicked Define options, and no sheet appeared. CPropertyPage::SetWindowText() is not usable on a page whose window does not exist yet. The tab control owns the text once the sheet is up, so OnInitDialog() sets it there instead. Pages are matched with GetPageIndex() rather than by tab order, so DefineDefaultProxy(), which leaves all but one page out, still works. Signed-off-by: Xavier Roche <xroche@gmail.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
Relabelling the tab control from OnInitDialog came too late. comctl32 sizes the strip from the captions in effect when the sheet is created, which on a first run are the English .rc ones, so longer labels wrapped into a row the sheet had no room for. A Romanian walk showed six tabs of eleven, with five pages unreachable: worse than the English titles it replaced. Each page now exposes SetLangTitle(), which is the block its constructor already ran, and CMainTab::DoModal() calls all eleven before the base creates the sheet. The constructor calls the same method, so the two copies that used to drift are one. English still keeps its .rc caption, as before: the catalog would otherwise retitle one tab MIME Types over MIME types for every English user. Signed-off-by: Xavier Roche <xroche@gmail.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a first run the option pages are constructed with the main frame, before the language dialog.
LANG_T(-1)is 0 then, so each page keeps its.rccaption. Every other string on a page is set at display time, so the sheet came up with translated content under English tabs, and only a restart fixed it.Each page now exposes
SetLangTitle(), the block its constructor already ran, andCMainTab::DoModal()calls all eleven before the base creates the sheet. That order matters: comctl32 sizes the tab strip from the captions in effect at creation, so relabelling afterwards loses a row. An earlier attempt in this branch relabelled afterwards, and a Romanian walk came back with six tabs of eleven and five pages unreachable.Verified against this build with the walk's
--language. Romanian lays out three rows carrying all eleven tabs, French two rows, and the English walk is unchanged. Romanian also clips a long static label on the Limits page, which predates this and is left alone.English keeps its
.rccaption, because the catalog would otherwise retitle one tab MIME Types over MIME types for every English user.Closes #149.