HeaderPane
Main
Hide
Share Link
Print

RightToLeft

Defines whether a control is laid out from right to left.

C

BOOL WINAPI SftDate_GetRightToLeft(HWND hwndCtl);
void WINAPI SftDate_SetRightToLeft(HWND hwndCtl, BOOL fRightToLeft);

C++

BOOL CSftDate::GetRightToLeft() const;
BOOL CSftCalendar::GetRightToLeft() const;
void CSftDate::SetRightToLeft(BOOL fRightToLeft);
void CSftCalendar::SetRightToLeft(BOOL fRightToLeft);

Parameters

hwndCtl

The window handle of the date field control (SftDate) or the month calendar control (SftCalendar).

fRightToLeft

TRUE to lay out the control from right to left, FALSE for left to right.

Returns

GetRightToLeft returns TRUE if the control is laid out from right to left, otherwise FALSE.

Comments

The GetRightToLeft and SetRightToLeft functions define and retrieve the reading order of a control. By default a control is laid out from left to right.

From right to left, a date field control shows its check box, text and buttons mirrored and its dropdown aligns with its right edge by default (SetDropDownAlignment); a month calendar control mirrors its days, title and navigation buttons, as does a date field control's dropdown calendar.

The reading order is independent of the culture (SetCulture). An application usually lays out a control from right to left for a locale whose reading layout is right to left (GetLocaleInfoEx with LOCALE_IREADINGLAYOUT returns 1), such as Arabic or Hebrew.

A control created with the WS_EX_LAYOUTRTL or WS_EX_RTLREADING extended window style starts out laid out from right to left.

Examples

C View entire sample code

    switch (id) {
    case IDC_CULTURE: {
        DWORD rtl = 0;
        GetLocaleInfoEx(g_cultures[sel].lpszLocale ? g_cultures[sel].lpszLocale : LOCALE_NAME_USER_DEFAULT,
            LOCALE_IREADINGLAYOUT | LOCALE_RETURN_NUMBER, (LPWSTR) &rtl, sizeof(rtl) / sizeof(WCHAR));
        for (i = 0; i < CONTROLS; ++i) {
            SftDate_SetCulture_W(c[i], g_cultures[sel].lpszLocale, g_cultures[sel].calendar);
            SftDate_SetRightToLeft(c[i], rtl == 1);
        }
        ShowSelection(hwndDlg);
        break;
     }
    case IDC_DARKMODE:
        for (i = 0; i < CONTROLS; ++i) {
            SftDate_SetDarkMode(c[i], sel);
            SetColorScheme(c[i], IsDlgButtonChecked(hwndDlg, IDC_COLORS) == BST_CHECKED);

C++ View entire sample code

    switch (id) {
    case IDC_CULTURE: {
        DWORD rtl = 0;
        GetLocaleInfoEx(g_cultures[sel].lpszLocale ? g_cultures[sel].lpszLocale : LOCALE_NAME_USER_DEFAULT,
            LOCALE_IREADINGLAYOUT | LOCALE_RETURN_NUMBER, (LPWSTR) &rtl, sizeof(rtl) / sizeof(WCHAR));
        for (int i = 0; i < CONTROLS; ++i) {
            Control(i).SetCulture(g_cultures[sel].lpszLocale, g_cultures[sel].calendar);
            Control(i).SetRightToLeft(rtl == 1);
        }
        ShowSelection();
        break;
     }
    case IDC_DARKMODE:
        for (int i = 0; i < CONTROLS; ++i) {
            Control(i).SetDarkMode(sel);
            SetColorScheme(Control(i), IsDlgButtonChecked(IDC_COLORS) == BST_CHECKED);

See Also C/C++ API | Categories | Notifications


Last Updated 11/26/2026 - (email)
© 2026 Softel vdm, Inc.