Re: wxGCDC disturbs wxBufferedPaintDC with right to left (RTL) layout (Issue #19344)

29 views
Skip to first unread message

Rossano Paris

unread,
Jan 15, 2024, 7:04:14 AM1/15/24
to wx-...@googlegroups.com, wxtrac, Author

Excuse me, does anyone knows whether this issue has been solved or not?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/19344/1892039933@github.com>

VZ

unread,
Jan 16, 2024, 10:10:22 AM1/16/24
to wx-...@googlegroups.com, wxtrac, Author

As this is still open, it looks like it isn't -- but it should be easy to check by testing the code above. Have you done it and seen that it works now?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/19344/1893941432@github.com>

Rossano Paris

unread,
Jan 16, 2024, 10:42:59 AM1/16/24
to wx-...@googlegroups.com, wxtrac, Author

... no it doesn't

I mean, in an application of mine I'm using wxBufferedPaintDC as method to paint custom controls.
The code works as expected for LTR languages.
But for languages where RTL is needed, all painting actions for custom controls don't draw them in the right way.
After a quick debug it seems something related to coordinates system, even though the coordinates values are correct.

Perhaps I'm wrong, but I don't take any special action in order to draw controls in case of RTL languages.
In other words, I would expect to draw controls without calculated differently their coordinates.
Am I wrong, or am I missing something ?

... anyway, I need to plan another debugging session in orther to be more precise


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/19344/1894005618@github.com>

AliKet

unread,
Mar 30, 2026, 6:23:18 PM (4 days ago) Mar 30
to wx-...@googlegroups.com, wxtrac, Author
AliKet left a comment (wxWidgets/wxWidgets#19344)

As the original patch doesn't show what's the output of the drawing when using wxGCDC,
I used this patch instead for testing (#26328 fixes the issue):

diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp
index 5f32257c6b..44dc5c5cd6 100644
--- a/samples/minimal/minimal.cpp
+++ b/samples/minimal/minimal.cpp
@@ -63,6 +63,7 @@ public:
     // event handlers (these functions should _not_ be virtual)
     void OnQuit(wxCommandEvent& event);
     void OnAbout(wxCommandEvent& event);
+    void OnPaint(wxPaintEvent& event);
 
 private:
     // any class wishing to process wxWidgets events must use this macro
@@ -95,6 +96,7 @@ enum
 wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
     EVT_MENU(Minimal_About, MyFrame::OnAbout)
+    EVT_PAINT(MyFrame::OnPaint)
 wxEND_EVENT_TABLE()
 
 // Create a new application object: this macro will allow wxWidgets to create
@@ -175,6 +177,7 @@ MyFrame::MyFrame(const wxString& title)
     CreateStatusBar(2);
     SetStatusText("Welcome to wxWidgets!");
 #endif // wxUSE_STATUSBAR
+    SetLayoutDirection(wxLayout_RightToLeft);
 }
 
 
@@ -201,3 +204,26 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
                  wxOK | wxICON_INFORMATION,
                  this);
 }
+
+#include "wx/dcbuffer.h"
+#include "wx/dcgraph.h"
+
+void MyFrame::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+    wxBufferedPaintDC dc(this);
+//    wxPaintDC dc(this);
+
+    dc.SetBackground(*wxWHITE_BRUSH);
+    dc.Clear();
+    wxASSERT(dc.GetLayoutDirection() == wxLayout_RightToLeft );
+
+    if ( true /*use graphics context*/ )
+    {
+        wxGCDC gdc(dc);
+        gdc.DrawText("ABCD", 0, 0);
+    }
+    else
+    {
+        dc.DrawText("ABCD", 0, 0);
+    }
+}


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/19344/4158526103@github.com>

Reply all
Reply to author
Forward
0 new messages