Align the "Window" right (Not the layout) Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
yytg
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu Mar 02, 2006 1:09 pm

Align the "Window" right (Not the layout)

Post by yytg »

Bs'd

I want to do so the title of the window will be in the right
Like this
Image
I saw the style WS_EX_RIGHT (In windows) so will do the job
I did like this

Code: Select all

	MyFrame *frame = new MyFrame(wxT("title"));
	frame->SetExtraStyle(frame->GetExtraStyle()|WS_EX_RIGHT);
	frame->Show(true);
And that's not working
What I need to do?

Thanks
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Align the "Window" right (Not the layout)

Post by doublemax »

yytg wrote:Bs'd

I want to do so the title of the window will be in the right
Like this
Image
I saw the style WS_EX_RIGHT (In windows) so will do the job
I did like this

Code: Select all

	MyFrame *frame = new MyFrame(wxT("title"));
	frame->SetExtraStyle(frame->GetExtraStyle()|WS_EX_RIGHT);
	frame->Show(true);
And that's not working
What I need to do?

Thanks
wxWindow::SetExtraStyle() uses wxWidgets-specific flags, i don't think you can pass MSWindows flags there. Try this (untested):

Code: Select all

HWND hwnd=(HWND)frame->GetHandle();
long oldstyle=::GetWindowLong(hwnd, GWL_EXSTYLE);
(void)::SetWindowLong(hwnd, GWL_EXSTYLE, oldstyle|WS_EX_RIGHT );
Avi
Super wx Problem Solver
Super wx Problem Solver
Posts: 398
Joined: Mon Aug 30, 2004 9:27 pm
Location: Tel-Aviv, Israel

Post by Avi »

Doublemax, I tested it here and it works. yytg, you can use it to solve your problem.
yytg
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu Mar 02, 2006 1:09 pm

Post by yytg »

Bs"d

Thanks I accepted the post
Post Reply