Discussion:
wxDialog Move event without Caption
Alma Retes
2014-01-31 16:02:13 UTC
Permalink
Hi

I think I found a bug in wxGTK 2.8.12 (Ubuntu 12.04 LTS libwxgtk2.8-0 2.8.12.1-6ubuntu2 )
If I create a wxDialog *without* caption (non-modal version), and then try to move it with EVT_MOTION it stays centered, nothing happens.

Example code parts:

BEGIN_EVENT_TABLE(MyDialog, wxDialog)
EVT_LEFT_DOWN(MyDialog::OnLeftDown)
EVT_LEFT_UP(MyDialog::OnLeftUp)
EVT_MOTION(MyDialog::OnMouseMove)
END_EVENT_TABLE()


bool MyApp::OnInit()
{
this->dialog = new MyDialog(_("test"), wxPoint(0, 0), wxSize(748, 300));

// Center the dialog when first shown
this->dialog->Centre();

// Show it and tell the application that it's our main window
this->dialog->Show(TRUE);
this->SetTopWindow(this->dialog);
}

// Dialog constructor
MyDialog::MyDialog(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxDialog((wxDialog *)NULL, -1, title, pos, size, ~wxCAPTION)
{
}

void MyDialog::OnLeftDown(wxMouseEvent& evt)
{
CaptureMouse();
//printf("Mouse captured\n");
wxPoint pos = ClientToScreen(evt.GetPosition());
wxPoint origin = GetPosition();
int dx = pos.x - origin.x;
int dy = pos .y - origin.y;
m_delta = wxPoint(dx, dy);

// wxMessageOutputStderr err;
// err.Printf(_T("Origin: %i, %i; Delta: %i, %i\n"), origin.x, origin.y, dx, dy);
}

void MyDialog::OnLeftUp(wxMouseEvent& WXUNUSED(evt))
{
if (HasCapture())
{
ReleaseMouse();
//printf("Mouse released\n");
}
}

void MyDialog::OnMouseMove(wxMouseEvent& evt)
{
wxPoint pt = evt.GetPosition();

if (evt.Dragging() && evt.LeftIsDown())
{
wxPoint pos = ClientToScreen(pt);
this->Move( wxPoint(pos.x - m_delta.x, pos.y - m_delta.y) );

wxMessageOutputStderr err;
err.Printf(_T("Move: x= %i, y= %i\n"), pos.x - m_delta.x, pos.y - m_delta.y);
}
}

Has/had anyone similar problem?

I've tried "shaped" from samples, it works, but shaped using wxFrame not wxDialog.


thanks
Attila
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Igor Korot
2014-01-31 21:42:50 UTC
Permalink
Hi,
Can you try to reproduce it with 3.0.0 or latest trunk?

Thank you.
Post by Alma Retes
Hi
I think I found a bug in wxGTK 2.8.12 (Ubuntu 12.04 LTS libwxgtk2.8-0 2.8.12.1-6ubuntu2 )
If I create a wxDialog *without* caption (non-modal version), and then try
to move it with EVT_MOTION it stays centered, nothing happens.
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
EVT_LEFT_DOWN(MyDialog::OnLeftDown)
EVT_LEFT_UP(MyDialog::OnLeftUp)
EVT_MOTION(MyDialog::OnMouseMove)
END_EVENT_TABLE()
bool MyApp::OnInit()
{
this->dialog = new MyDialog(_("test"), wxPoint(0, 0), wxSize(748, 300));
// Center the dialog when first shown
this->dialog->Centre();
// Show it and tell the application that it's our main window
this->dialog->Show(TRUE);
this->SetTopWindow(this->dialog);
}
// Dialog constructor
MyDialog::MyDialog(const wxString& title, const wxPoint& pos, const wxSize&
size)
: wxDialog((wxDialog *)NULL, -1, title, pos, size, ~wxCAPTION)
{
}
void MyDialog::OnLeftDown(wxMouseEvent& evt)
{
CaptureMouse();
//printf("Mouse captured\n");
wxPoint pos = ClientToScreen(evt.GetPosition());
wxPoint origin = GetPosition();
int dx = pos.x - origin.x;
int dy = pos.y - origin.y;
m_delta = wxPoint(dx, dy);
// wxMessageOutputStderr err;
// err.Printf(_T("Origin: %i, %i; Delta: %i, %i\n"), origin.x, origin.y, dx, dy);
}
void MyDialog::OnLeftUp(wxMouseEvent& WXUNUSED(evt))
{
if (HasCapture())
{
ReleaseMouse();
//printf("Mouse released\n");
}
}
void MyDialog::OnMouseMove(wxMouseEvent& evt)
{
wxPoint pt = evt.GetPosition();
if (evt.Dragging() && evt.LeftIsDown())
{
wxPoint pos = ClientToScreen(pt);
this->Move( wxPoint(pos.x - m_delta.x, pos.y - m_delta.y) );
wxMessageOutputStderr err;
err.Printf(_T("Move: x= %i, y= %i\n"), pos.x - m_delta.x, pos.y - m_delta.y);
}
}
Has/had anyone similar problem?
I've tried "shaped" from samples, it works, but shaped using wxFrame not wxDialog.
thanks
Attila
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Alma Retes
2014-02-01 09:15:02 UTC
Permalink
Sure!

I've built wxGTK 3.0 on Ubuntu 12.04 with the following options.

./configure \
--prefix=/usr/ \
--enable-unicode \
--enable-intl \
--enable-url \
--with-libpng \
--with-gtk=3 \
CFLAGS="-fPIC" CXXFLAGS="-fPIC"

And I attached a minimal working example code, wich I've built using:
g++ -Wall -g -o test test.cpp `wx-config --cxxflags --libs`

Original problem remains (without wxCaption you can not move wxDialog ), and on wxGTK 3.0 one more problem occurs: It cannot Centre() MyDialog, initially displays on the upper left corner of the screen.

thanks.


Hi,
Can you try to reproduce it with 3.0.0 or latest trunk?

Thank you.

On Fri, Jan 31, 2014 at 8:02 AM, Alma Retes <***@index.hu> wrote:
> Hi
>
> I think I found a bug in wxGTK 2.8.12 (Ubuntu 12.04 LTS libwxgtk2.8-0
> 2.8 .12.1-6ubuntu2 )
> If I create a wxDialog *without* caption (non-modal version), and then try
> to move it with EVT_MOTION it stays centered, nothing happens.
>
> Example code parts:
>
> BEGIN_EVENT_TABLE(MyDialog, wxDialog)
> EVT_LEFT_DOWN(MyDialog::OnLeftDown)
> EVT_LEFT_UP(MyDialog::OnLeftUp)
> EVT_MOTION(MyDialog::OnMouseMove)
> END_EVENT_TABLE()
>
>
> bool MyApp::OnInit()
> {
> this->dialog = new MyDialog(_("test"), wxPoint(0, 0), wxSize(748, 300));
>
> // Center the dialog when first shown
> this->dialog->Centre();
>
> // Show it and tell the application that it's our main window
> this->dialog->Show(TRUE);
> this->SetTopWindow(this->dialog);
> }
>
> // Dialog constructor
> MyDialog::MyDialog(const wxString& title, const wxPoint& pos, const wxSize&
> size)
> : wxDialog((wxDialog *)NULL, -1, title, pos, size, ~wxCAPTION)
> {
> }
>
> void MyDialog::OnLeftDown(wxMouseEvent& evt)
> {
> CaptureMouse();
> //printf("Mouse captured\n");
> wxPoint pos = ClientToScreen(evt.GetPosition());
> wxPoint origin = GetPosition();
> int dx = pos.x - origin.x;
> int dy = pos.y - origin.y;
> m_delta = wxPoint(dx, dy);
>
> // wxMessageOutputStderr err;
> // err.Printf(_T("Origin: %i, %i; Delta: %i, %i\n"), origin.x, origin.y,
> dx, dy);
> }
>
> void MyDialog::OnLeftUp(wxMouseEvent& WXUNUSED(evt))
> {
> if (HasCapture())
> {
> ReleaseMouse();
> //printf("Mouse released\n");
> }
> }
>
> void MyDialog::OnMouseMove(wxMouseEvent& evt)
> {
> wxPoint pt = evt.GetPosition();
>
> if (evt.Dragging() && evt.LeftIsDown())
> {
> wxPoint pos = ClientToScreen(pt);
> this->Move( wxPoint(pos.x - m_delta .x, pos.y - m_delta.y) );
>
> wxMessageOutputStderr err;
> err.Printf(_T("Move: x= %i, y= %i\n"), pos.x - m_delta.x, pos.y -
> m_delta.y);
> }
> }
>
> Has/had anyone similar problem?
>
> I've tried "shaped" from samples, it works, but shaped using wxFrame not
> wxDialog.
>
>
> thanks
> Attila
>
> --
> Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
>
> To unsubscribe, send email to wx-users+***@googlegroups.com
> or visit http://groups.google.com/group/wx-users

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Igor Korot
2014-02-01 09:26:58 UTC
Permalink
Hi, Alma,
Post by Alma Retes
Sure!
I've built wxGTK 3.0 on Ubuntu 12.04 with the following options.
./configure \
--prefix=/usr/ \
--enable-unicode \
--enable-intl \
--enable-url \
--with-libpng \
--with-gtk=3 \
CFLAGS="-fPIC" CXXFLAGS="-fPIC"
Can you kill everything and rebuild with:

cd ~/wxWidgets-3.0.0
rm -rf *
<unpack wxWidgets-3.0.0>
mkdir buildGTK
cd buildGTK
../configure --prefix=/usr --enable-intl --enable-url --with-libpng
--with-gtk=2 CFLAGS="-fPIC" CXXFLAGS="-fPIC"

Notice that building in its own directory is the recommended way.
Since you build was residing in the source directory we have to kill everything.

Also notice that there is no need to use "--enable-unicode" - its default.

Thank you.
Post by Alma Retes
g++ -Wall -g -o test test.cpp `wx-config --cxxflags --libs`
Original problem remains (without wxCaption you can not move wxDialog ), and
on wxGTK 3.0 one more problem occurs: It cannot Centre() MyDialog, initially
displays on the upper left corner of the screen.
thanks.
Hi,
Can you try to reproduce it with 3.0.0 or latest trunk?
Thank you.
Post by Alma Retes
Hi
I think I found a bug in wxGTK 2.8.12 (Ubuntu 12.04 LTS libwxgtk2.8-0 2.8.12.1-6ubuntu2 )
If I create a wxDialog *without* caption (non-modal version), and then try
to move it with EVT_MOTION it stays centered, nothing happens.
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
EVT_LEFT_DOWN(MyDialog::OnLeftDown)
EVT_LEFT_UP(MyDialog::OnLeftUp)
EVT_MOTION(MyDialog::OnMouseMove)
END_EVENT_TABLE()
bool MyApp::OnInit()
{
this->dialog = new MyDialog(_("test"), wxPoint(0, 0), wxSize(748, 300));
// Center the dialog when first shown
this->dialog->Centre();
// Show it and tell the application that it's our main window
this->dialog->Show(TRUE);
this->SetTopWindow(this->dialog);
}
// Dialog constructor
MyDialog::MyDialog(const wxString& title, const wxPoint& pos, const wxSize&
size)
: wxDialog((wxDialog *)NULL, -1, title, pos, size, ~wxCAPTION)
{
}
void MyDialog::OnLeftDown(wxMouseEvent& evt)
{
CaptureMouse();
//printf("Mouse captured\n");
wxPoint pos = ClientToScreen(evt.GetPosition());
wxPoint origin = GetPosition();
int dx = pos.x - origin.x;
int dy = pos.y - origin.y;
m_delta = wxPoint(dx, dy);
// wxMessageOutputStderr err;
// err.Printf(_T("Origin: %i, %i; Delta: %i, %i\n"), origin.x, origin.y,
dx, dy);
}
void MyDialog::OnLeftUp(wxMouseEvent& WXUNUSED(evt))
{
if (HasCapture())
{
ReleaseMouse();
//printf("Mouse released\n");
}
}
void MyDialog::OnMouseMove(wxMouseEvent& evt)
{
wxPoint pt = evt.GetPosition();
if (evt.Dragging() && evt.LeftIsDown())
{
wxPoint pos = ClientToScreen(pt);
this->Move( wxPoint(pos.x - m_delta.x, pos.y - m_delta.y) );
wxMessageOutputStderr err;
err.Printf(_T("Move: x= %i, y= %i\n"), pos.x - m_delta.x, pos.y - m_delta.y);
}
}
Has/had anyone similar problem?
I've tried "shaped" from samples, it works, but shaped using wxFrame not wxDialog.
thanks
Attila
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Igor Korot
2014-02-01 09:27:48 UTC
Permalink
Also please post you GTK+2 version.
Post by Igor Korot
Hi, Alma,
Post by Alma Retes
Sure!
I've built wxGTK 3.0 on Ubuntu 12.04 with the following options.
./configure \
--prefix=/usr/ \
--enable-unicode \
--enable-intl \
--enable-url \
--with-libpng \
--with-gtk=3 \
CFLAGS="-fPIC" CXXFLAGS="-fPIC"
cd ~/wxWidgets-3.0.0
rm -rf *
<unpack wxWidgets-3.0.0>
mkdir buildGTK
cd buildGTK
../configure --prefix=/usr --enable-intl --enable-url --with-libpng
--with-gtk=2 CFLAGS="-fPIC" CXXFLAGS="-fPIC"
Notice that building in its own directory is the recommended way.
Since you build was residing in the source directory we have to kill everything.
Also notice that there is no need to use "--enable-unicode" - its default.
Thank you.
Post by Alma Retes
g++ -Wall -g -o test test.cpp `wx-config --cxxflags --libs`
Original problem remains (without wxCaption you can not move wxDialog ), and
on wxGTK 3.0 one more problem occurs: It cannot Centre() MyDialog, initially
displays on the upper left corner of the screen.
thanks.
Hi,
Can you try to reproduce it with 3.0.0 or latest trunk?
Thank you.
Post by Alma Retes
Hi
I think I found a bug in wxGTK 2.8.12 (Ubuntu 12.04 LTS libwxgtk2.8-0
2.8.12.1-6ubuntu2 )
If I create a wxDialog *without* caption (non-modal version), and then try
to move it with EVT_MOTION it stays centered, nothing happens.
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
EVT_LEFT_DOWN(MyDialog::OnLeftDown)
EVT_LEFT_UP(MyDialog::OnLeftUp)
EVT_MOTION(MyDialog::OnMouseMove)
END_EVENT_TABLE()
bool MyApp::OnInit()
{
this->dialog = new MyDialog(_("test"), wxPoint(0, 0), wxSize(748, 300));
// Center the dialog when first shown
this->dialog->Centre();
// Show it and tell the application that it's our main window
this->dialog->Show(TRUE);
this->SetTopWindow(this->dialog);
}
// Dialog constructor
MyDialog::MyDialog(const wxString& title, const wxPoint& pos, const wxSize&
size)
: wxDialog((wxDialog *)NULL, -1, title, pos, size, ~wxCAPTION)
{
}
void MyDialog::OnLeftDown(wxMouseEvent& evt)
{
CaptureMouse();
//printf("Mouse captured\n");
wxPoint pos = ClientToScreen(evt.GetPosition());
wxPoint origin = GetPosition();
int dx = pos.x - origin.x;
int dy = pos.y - origin.y;
m_delta = wxPoint(dx, dy);
// wxMessageOutputStderr err;
// err.Printf(_T("Origin: %i, %i; Delta: %i, %i\n"), origin.x, origin.y,
dx, dy);
}
void MyDialog::OnLeftUp(wxMouseEvent& WXUNUSED(evt))
{
if (HasCapture())
{
ReleaseMouse();
//printf("Mouse released\n");
}
}
void MyDialog::OnMouseMove(wxMouseEvent& evt)
{
wxPoint pt = evt.GetPosition();
if (evt.Dragging() && evt.LeftIsDown())
{
wxPoint pos = ClientToScreen(pt);
this->Move( wxPoint(pos.x - m_delta.x, pos.y - m_delta.y) );
wxMessageOutputStderr err;
err.Printf(_T("Move: x= %i, y= %i\n"), pos.x - m_delta.x, pos.y - m_delta.y);
}
}
Has/had anyone similar problem?
I've tried "shaped" from samples, it works, but shaped using wxFrame not wxDialog.
thanks
Attila
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Alma Retes
2014-02-01 12:07:29 UTC
Permalink
Hi Igor!

Thanks your quick response!
Building in the source directory is my fault, I will built in its own directory. :-)

But I have to build wxGTK 3.0 against libgtk *version 2*?! I've thought if I want to build wxGTK 3.0 I have to use libgtk 3.0 too.

My GTK versions are:
libgtk-3-0 3.4.2-0ubuntu0.6
libgtk2.0-0 2.24.10-0ubuntu6


-- Eredeti ÃŒzenet --
Feladó: Igor Korot &lt;***@gmail.com&gt;Címzett: wx-***@googlegroups.com &lt;wx-***@googlegroups.com&gt;ElkÌldve: 2014 . február 1. 10:27Tárgy : Re: wxDialog Move event without Caption

Also please post you GTK+2 version.

On Sat, Feb 1, 2014 at 1:26 AM, Igor Korot &lt;***@gmail.com&gt; wrote:
&gt; Hi, Alma,
&gt;
&gt; On Sat, Feb 1, 2014 at 1:15 AM, Alma Retes &lt;***@index.hu&gt; wrote:
&gt;&gt; Sure!
&gt;&gt;
&gt;&gt; I've built wxGTK 3.0 on Ubuntu 12.04 with the following options.
&gt;&gt;
&gt;&gt; ./configure \
&gt;&gt; --prefix=/usr/ \
&gt;&gt; --enable-unicode \
&gt;&gt; --enable-intl \
&gt;&gt; --enable-url \
&gt;&gt; --with-libpng \
&gt;&gt; --with-gtk=3 \
&gt;&gt; CFLAGS="-fPIC" CXXFLAGS="-fPIC"
&gt;
&gt; Can you kill everything and rebuild with:
&gt;
&gt; cd ~/wxWidgets-3.0.0
&gt; rm -rf *
&gt; &lt;unpack wxWidgets-3.0.0&gt;
&gt; mkdir buildGTK
&gt; cd buildGTK
&gt; ../configure --prefix=/usr --enable-intl --enable-url --with-libpng
&gt; --with-gtk=2 CFLAGS="-fPIC" CXXFLAGS="-fPIC"
&gt;
&gt; Notice that building in its own directory is the recommended way.
&gt; Since you build was residing in the source directory we have to kill everything.
&gt;
&gt; Also notice that there is no need to use "--enable-unicode" - its default.
&gt;
&gt; Thank you.
&gt;&gt;
&gt;&gt; And I attached a minimal working example code, wich I've built using:
&gt;&gt; g++ -Wall -g -o test test.cpp `wx-config --cxxflags --libs`
&gt;&gt;
&gt;&gt; Original problem remains (without wxCaption you can not move wxDialog ), and
&gt;&gt; on wxGTK 3.0 one more problem occurs: It cannot Centre() MyDialog, initially
&gt;&gt; displays on the upper left corner of the screen.
&gt;&gt;
&gt;&gt; thanks.
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt; Hi,
&gt;&gt; Can you try to reproduce it with 3.0.0 or latest trunk?
&gt;&gt;
&gt;&gt; Thank you.
&gt;&gt;
&gt;&gt; On Fri, Jan 31, 2014 at 8:02 AM, Alma Retes &lt;***@index.hu&gt; wrote:
&gt;&gt;&gt; Hi
&gt;&gt;&gt;
&gt;&gt;&gt; I think I found a bug in wxGTK 2.8.12 (Ubuntu 12.04 LTS libwxgtk2.8-0
&gt;&gt;&gt; 2.8.12.1-6ubuntu2 )
&gt;&gt;&gt; If I create a wxDialog *without* caption (non-modal version), and then try
&gt;&gt;&gt; to move it with EVT_MOTION it stays centered, nothing happens.
&gt;&gt;&gt;
&gt;&gt;&gt; Example code parts:
&gt;&gt;&gt;
&gt;&gt;&gt; BEGIN_EVENT_TABLE(MyDialog, wxDialog)
&gt;&gt;&gt; EVT_LEFT_DOWN(MyDialog::OnLeftDown)
&gt;&gt;&gt; EVT_LEFT_UP(MyDialog::OnLeftUp)
&gt;&gt;&gt; EVT_MOTION(MyDialog::OnMouseMove)
&gt;&gt;&gt; END_EVENT_TABLE()
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; bool MyApp::OnInit()
&gt;&gt;&gt; {
&gt;&gt;&gt; this-&gt;dialog = new MyDialog(_("test"), wxPoint(0, 0), wxSize(748, 300));
&gt;&gt;&gt;
&gt;&gt;&gt; // Center the dialog when first shown
&gt;&gt;&gt; this-&gt;dialog-&gt;Centre();
&gt;&gt;&gt;
&gt;&gt;&gt; // Show it and tell the application that it's our main window
&gt;&gt;&gt; this-&gt;dialog-&gt;Show(TRUE);
&gt;&gt;&gt; this-&gt;SetTopWindow(this-&gt;dialog);
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; // Dialog constructor
&gt;&gt;&gt; MyDialog::MyDialog(const wxString&amp; title, const wxPoint&amp; pos, const
&gt;&gt;&gt; wxSize&amp;
&gt;&gt;&gt; size)
&gt;&gt;&gt; : wxDialog((wxDialog *)NULL, -1, title, pos, size, ~wxCAPTION)
&gt;&gt;&gt; {
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; void MyDialog::OnLeftDown(wxMouseEvent&amp; evt)
&gt;&gt;&gt; {
&gt;&gt;&gt; CaptureMouse();
&gt;&gt;&gt; //printf("Mouse captured\n");
&gt;&gt;&gt; wxPoint pos = ClientToScreen(evt.GetPosition());
&gt;&gt;&gt; wxPoint origin = GetPosition();
&gt;&gt;&gt; int dx = pos.x - origin.x;
&gt;&gt;&gt; int dy = pos.y - origin.y;
&gt;&gt;&gt; m_delta = wxPoint(dx, dy);
&gt;&gt;&gt;
&gt;&gt;&gt; // wxMessageOutputStderr err;
&gt;&gt;&gt; // err.Printf(_T("Origin: %i, %i; Delta: %i, %i\n"), origin.x, origin.y,
&gt;&gt;&gt; dx, dy);
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; void MyDialog::OnLeftUp(wxMouseEvent&amp; WXUNUSED(evt))
&gt;&gt;&gt; {
&gt;&gt;&gt; if (HasCapture())
&gt;&gt;&gt; {
&gt;&gt;&gt; ReleaseMouse();
&gt;&gt;&gt; //printf("Mouse released\n");
&gt;&gt;&gt; }
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; void MyDialog::OnMouseMove(wxMouseEvent&amp; evt)
&gt;&gt;&gt; {
&gt;&gt;&gt; wxPoint pt = evt.GetPosition();
&gt;&gt;&gt;
&gt;&gt;&gt; if (evt.Dragging() &amp;&amp; evt.LeftIsDown())
&gt;&gt;&gt; {
&gt;&gt;&gt; wxPoint pos = ClientToScreen(pt);
&gt;&gt;&gt; this-&gt;Move( wxPoint(pos.x - m_delta.x, pos.y - m_delta.y) );
&gt;&gt;&gt;
&gt;&gt;&gt; wxMessageOutputStderr err;
&gt;&gt;&gt; err.Printf(_T("Move: x= %i, y= %i\n"), pos.x - m_delta.x, pos.y -
&gt;&gt;&gt; m_delta.y);
&gt;&gt;&gt; }
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; Has/had anyone similar problem?
&gt;&gt;&gt;
&gt;&gt;&gt; I've tried "shaped" from samples, it works, but shaped using wxFrame not
&gt;&gt;&gt; wxDialog.
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; thanks
&gt;&gt;&gt; Attila
&gt;&gt;&gt;
&gt;&gt;&gt; --
&gt;&gt;&gt; Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
&gt;&gt;&gt;
&gt;&gt;&gt; To unsubscribe, send email to wx-users+***@googlegroups.com
&gt;&gt;&gt; or visit http://groups.google.com/group/wx-users
&gt;&gt;
&gt;&gt; --
&gt;&gt; Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
&gt;&gt;
&gt;&gt; To unsubscribe, send email to wx-users+***@googlegroups.com
&gt;&gt; or visit http://groups.google.com/group/wx-users
&gt;&gt;
&gt;&gt; --
&gt;&gt; Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
&gt;&gt;
&gt;&gt; To unsubscribe, send email to wx-users+***@googlegroups.com
&gt;&gt; or visit http://groups.google.com/group/wx-users

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Alma Retes
2014-02-01 12:44:48 UTC
Permalink
I've built wxGTK3.0 against libgtk 2.24 on the proper way, but original problem persists.
Could anyone compile my attached test code and run it on Linux? And try to move the wxDialog with left mouse down?

thanks


Hi Igor!

Thanks your quick response!
Building in the source directory is my fault, I will built in its own directory. :-)

But I have to build wxGTK 3.0 against libgtk *version 2*?! I've thought if I want to build wxGTK 3.0 I have to use libgtk 3.0 too.

My GTK versions are:
libgtk-3-0 3.4.2-0ubuntu0.6
libgtk2.0-0 2.24.10-0ubuntu6

Also please post you GTK+2 version.

On Sat, Feb 1, 2014 at 1:26 AM, Igor Korot &lt;***@gmail.com&gt; wrote:
&gt; Hi, Alma,
&gt;
&gt; On Sat, Feb 1, 2014 at 1:15 AM, Alma Retes &lt;***@index.hu&gt; wrote:
&gt;&gt; Sure!
&gt;&gt;
&gt;&gt; I've built wxGTK 3.0 on Ubuntu 12.04 with the following options.
&gt;&gt;
&gt;&gt; ./configure \
&gt;&gt; --prefix=/usr/ \
&gt;&gt; --enable-unicode \
&gt;&gt; --enable-intl \
&gt;&gt; --enable-url \
&gt;&gt; --with-libpng \
&gt;&gt; --with-gtk=3 \
&gt;&gt; CFLAGS="-fPIC" CXXFLAGS="-fPIC"
&gt;
&gt; Can you kill everything and rebuild with:
&gt;
&gt; cd ~/wxWidgets-3.0.0
&gt; rm -rf *
&gt; &lt;unpack wxWidgets-3.0.0&gt;
&gt; mkdir buildGTK
&gt; cd buildGTK
&gt; ../configure --prefix=/usr --enable-intl --enable-url --with-libpng
&gt; --with-gtk=2 CFLAGS="-fPIC" CXXFLAGS="-fPIC"
&gt;
&gt; Notice that building in its own directory is the recommended way.
&gt; Since you build was residing in the source directory we have to kill everything.
&gt;
&gt; Also notice that there is no need to use "--enable-unicode" - its default.
&gt;
&gt; Thank you.
&gt;&gt;
&gt;&gt; And I attached a minimal working example code, wich I've built using:
&gt;&gt; g++ -Wall -g -o test test.cpp `wx-config --cxxflags --libs`
&gt;&gt;
&gt;&gt; Original problem remains (without wxCaption you can not move wxDialog ), and
&gt;&gt; on wxGTK 3.0 one more problem occurs: It cannot Centre() MyDialog, initially
&gt;&gt; displays on the upper left corner of the screen.
&gt;&gt;
&gt;&gt; thanks.
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt; Hi,
&gt;&gt; Can you try to reproduce it with 3.0.0 or latest trunk?
&gt;&gt;
&gt;&gt; Thank you.
&gt;&gt;
&gt;&gt; On Fri, Jan 31, 2014 at 8:02 AM, Alma Retes &lt;***@index.hu&gt; wrote:
&gt;&gt;&gt; Hi
&gt;&gt;&gt;
&gt;&gt;&gt; I think I found a bug in wxGTK 2.8.12 (Ubuntu 12.04 LTS libwxgtk2.8-0
&gt;&gt;&gt; 2.8.12.1-6ubuntu2 )
&gt;&gt;&gt; If I create a wxDialog *without* caption (non-modal version), and then try
&gt;&gt;&gt; to move it with EVT_MOTION it stays centered, nothing happens.
&gt;&gt;&gt;
&gt;&gt;&gt; Example code parts:
&gt;&gt;&gt;
&gt;&gt;&gt; BEGIN_EVENT_TABLE(MyDialog, wxDialog)
&gt;&gt;&gt; EVT_LEFT_DOWN(MyDialog::OnLeftDown)
&gt;&gt;&gt; EVT_LEFT_UP(MyDialog::OnLeftUp)
&gt;&gt;&gt; EVT_MOTION(MyDialog::OnMouseMove)
&gt;&gt;&gt; END_EVENT_TABLE()
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; bool MyApp::OnInit()
&gt;&gt;&gt; {
&gt;&gt;&gt; this-&gt;dialog = new MyDialog(_("test"), wxPoint(0, 0), wxSize(748, 300));
&gt;&gt;&gt;
&gt;&gt;&gt; // Center the dialog when first shown
&gt;&gt;&gt; this-&gt;dialog-&gt;Centre();
&gt;&gt;&gt;
&gt;&gt;&gt; // Show it and tell the application that it's our main window
&gt;&gt;&gt; this-&gt;dialog-&gt;Show(TRUE);
&gt;&gt;&gt; this-&gt;SetTopWindow(this-&gt;dialog);
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; // Dialog constructor
&gt;&gt;&gt; MyDialog::MyDialog(const wxString&amp; title, const wxPoint&amp; pos, const
&gt;&gt;&gt; wxSize&amp;
&gt;&gt;&gt; size)
&gt;&gt;&gt; : wxDialog((wxDialog *)NULL, -1, title, pos, size, ~wxCAPTION)
&gt;&gt;&gt; {
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; void MyDialog::OnLeftDown(wxMouseEvent&amp; evt)
&gt;&gt;&gt; {
&gt;&gt;&gt; CaptureMouse();
&gt;&gt;&gt; //printf("Mouse captured\n");
&gt;&gt;&gt; wxPoint pos = ClientToScreen(evt.GetPosition());
&gt;&gt;&gt; wxPoint origin = GetPosition();
&gt;&gt;&gt; int dx = pos.x - origin.x;
&gt;&gt;&gt; int dy = pos.y - origin.y;
&gt;&gt;&gt; m_delta = wxPoint(dx, dy);
&gt;&gt;&gt;
&gt;&gt;&gt; // wxMessageOutputStderr err;
&gt;&gt;&gt; // err.Printf(_T("Origin: %i, %i; Delta: %i, %i\n"), origin.x, origin.y,
&gt;&gt;&gt; dx, dy);
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; void MyDialog::OnLeftUp(wxMouseEvent&amp; WXUNUSED(evt))
&gt;&gt;&gt; {
&gt;&gt;&gt; if (HasCapture())
&gt;&gt;&gt; {
&gt;&gt;&gt; ReleaseMouse();
&gt;&gt;&gt; //printf("Mouse released\n");
&gt;&gt;&gt; }
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; void MyDialog::OnMouseMove(wxMouseEvent&amp; evt)
&gt;&gt;&gt; {
&gt;&gt;&gt; wxPoint pt = evt.GetPosition();
&gt;&gt;&gt;
&gt;&gt;&gt; if (evt.Dragging() &amp;&amp; evt.LeftIsDown())
&gt;&gt;&gt; {
&gt;&gt;&gt; wxPoint pos = ClientToScreen(pt);
&gt;&gt;&gt; this-&gt;Move( wxPoint(pos.x - m_delta.x, pos.y - m_delta.y) );
&gt;&gt;&gt;
&gt;&gt;&gt; wxMessageOutputStderr err;
&gt;&gt;&gt; err.Printf(_T("Move: x= %i, y= %i\n"), pos.x - m_delta.x, pos.y -
&gt;&gt;&gt; m_delta.y);
&gt;&gt;&gt; }
&gt;&gt;&gt; }
&gt;&gt;&gt;
&gt;&gt;&gt; Has/had anyone similar problem?
&gt;&gt;&gt;
&gt;&gt;&gt; I've tried "shaped" from samples, it works, but shaped using wxFrame not
&gt;&gt;&gt; wxDialog.
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; thanks
&gt;&gt;&gt; Attila
&gt;&gt;&gt;
&gt;&gt;&gt; --
&gt;&gt;&gt; Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
&gt;&gt;&gt;
&gt;&gt;&gt; To unsubscribe, send email to wx-users+***@googlegroups.com
&gt;&gt;&gt; or visit http://groups.google.com/group/wx-users
&gt;&gt;
&gt;&gt; --
&gt;&gt; Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
&gt;&gt;
&gt;&gt; To unsubscribe, send email to wx-users+***@googlegroups.com
&gt;&gt; or visit http://groups.google.com/group/wx-users
&gt;&gt;
&gt;&gt; --
&gt;&gt; Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
&gt;&gt;
&gt;&gt; To unsubscribe, send email to wx-users+***@googlegroups.com
&gt;&gt; or visit http://groups.google.com/group/wx-users

--
Please read http://www.wxwidgets .org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Igor Korot
2014-02-01 19:15:14 UTC
Permalink
Hi, Alma,
Post by Alma Retes
Hi Igor!
Thanks your quick response!
Building in the source directory is my fault, I will built in its own directory. :-)
But I have to build wxGTK 3.0 against libgtk *version 2*?! I've thought if I
want to build wxGTK 3.0 I have to use libgtk 3.0 too.
You don't have to, but you can.
Building against GTK+3.0 is still kind of "experimental"...

Thank you.
Post by Alma Retes
libgtk-3-0 3.4.2-0ubuntu0.6
libgtk2.0-0 2.24.10-0ubuntu6
-- Eredeti üzenet --
Elküldve: 2014. február 1. 10:27
Tárgy : Re: wxDialog Move event without Caption
Also please post you GTK+2 version.
Post by Igor Korot
Hi, Alma,
Post by Alma Retes
Sure!
I've built wxGTK 3.0 on Ubuntu 12.04 with the following options.
./configure \
--prefix=/usr/ \
--enable-unicode \
--enable-intl \
--enable-url \
--with-libpng \
--with-gtk=3 \
CFLAGS="-fPIC" CXXFLAGS="-fPIC"
cd ~/wxWidgets-3.0.0
rm -rf *
<unpack wxWidgets-3.0.0>
mkdir buildGTK
cd buildGTK
../configure --prefix=/usr --enable-intl --enable-url --with-libpng
--with-gtk=2 CFLAGS="-fPIC" CXXFLAGS="-fPIC"
Notice that building in its own directory is the recommended way.
Since you build was residing in the source directory we have to kill everything.
Also notice that there is no need to use "--enable-unicode" - its default.
Thank you.
Post by Alma Retes
g++ -Wall -g -o test test.cpp `wx-config --cxxflags --libs`
Original problem remains (without wxCaption you can not move wxDialog ), and
on wxGTK 3.0 one more problem occurs: It cannot Centre() MyDialog, initially
displays on the upper left corner of the screen.
thanks.
Hi,
Can you try to reproduce it with 3.0.0 or latest trunk?
Thank you.
Post by Alma Retes
Hi
I think I found a bug in wxGTK 2.8.12 (Ubuntu 12.04 LTS libwxgtk2.8-0
2.8.12.1-6ubuntu2 )
If I create a wxDialog *without* caption (non-modal version), and then try
to move it with EVT_MOTION it stays centered, nothing happens.
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
EVT_LEFT_DOWN(MyDialog::OnLeftDown)
EVT_LEFT_UP(MyDialog::OnLeftUp)
EVT_MOTION(MyDialog::OnMouseMove)
END_EVENT_TABLE()
bool MyApp::OnInit()
{
this->dialog = new MyDialog(_("test"), wxPoint(0, 0), wxSize(748, 300));
// Center the dialog when first shown
this->dialog->Centre();
// Show it and tell the application that it's our main window
this->dialog->Show(TRUE);
this->SetTopWindow(this->dialog);
}
// Dialog constructor
MyDialog::MyDialog(const wxString& title, const wxPoint& pos, const wxSize&
size)
: wxDialog((wxDialog *)NULL, -1, title, pos, size, ~wxCAPTION)
{
}
void MyDialog::OnLeftDown(wxMouseEvent& evt)
{
CaptureMouse();
//printf("Mouse captured\n");
wxPoint pos = ClientToScreen(evt.GetPosition());
wxPoint origin = GetPosition();
int dx = pos.x - origin.x;
int dy = pos.y - origin.y;
m_delta = wxPoint(dx, dy);
// wxMessageOutputStderr err;
// err.Printf(_T("Origin: %i, %i; Delta: %i, %i\n"), origin.x, origin.y,
dx, dy);
}
void MyDialog::OnLeftUp(wxMouseEvent& WXUNUSED(evt))
{
if (HasCapture())
{
ReleaseMouse();
//printf("Mouse released\n");
}
}
void MyDialog::OnMouseMove(wxMouseEvent& evt)
{
wxPoint pt = evt.GetPosition();
if (evt.Dragging() && evt.LeftIsDown())
{
wxPoint pos = ClientToScreen(pt);
this->Move( wxPoint(pos.x - m_delta.x, pos.y - m_delta.y) );
wxMessageOutputStderr err;
err.Printf(_T("Move: x= %i, y= %i\n"), pos.x - m_delta.x, pos.y - m_delta.y);
}
}
Has/had anyone similar problem?
I've tried "shaped" from samples, it works, but shaped using wxFrame not wxDialog.
thanks
Attila
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Alma Retes
2014-02-03 09:35:46 UTC
Permalink
I've found a dirty solution:
If I call Show(FALSE) and then Show(TRUE) on wxDialog after Moving event, then it moves! :-)
But flickers. :-/

I'll search through wxGTK source code to find what causing this behaviour.

Could anyone verify the non-Moving problem based on my testcode?

Tomorrow I'll try to build test code on wxMSW.

thanks!

void MyDialog::OnMouseMove(wxMouseEvent&amp; evt)
{
wxPoint pt = evt.GetPosition();

if (evt.Dragging() &amp;&amp; evt.LeftIsDown())
{
wxPoint pos = ClientToScreen(pt);
this-&gt;Move( wxPoint(pos.x - m_delta.x, pos.y - m_delta.y) );

// Virtually repaint the wxDialog at new position.
this-&gt;Show(FALSE);
this-&gt;Show(TRUE);

}
}
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Alma Retes
2014-02-03 11:39:51 UTC
Permalink
Something very strange happened!
I've built wxGTK3.0 from source against libwxgtk2.8 on my office desktop and Moving works as expected!

The only difference between home and office desktop is the kernel version.
Home: 3.5 Office: 3.8. (Same LTS 12.04 ubuntu)


I've found a dirty solution:
If I call Show(FALSE) and then Show(TRUE) on wxDialog after Moving event, then it moves! :-)
But flickers. :-/

I'll search through wxGTK source code to find what causing this behaviour.

Could anyone verify the non-Moving problem based on my testcode?

Tomorrow I'll try to build test code on wxMSW.

thanks!

void MyDialog::OnMouseMove(wxMouseEvent&amp; evt)
{
wxPoint pt = evt.GetPosition();

if (evt.Dragging() &amp;&amp; evt.LeftIsDown())
{
wxPoint pos = ClientToScreen(pt);
this-&gt;Move( wxPoint(pos.x - m_delta.x, pos.y - m_delta.y) );

// Virtually repaint the wxDialog at new position.
this-&gt;Show(FALSE);
this-&gt;Show(TRUE);

}
}
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Loading...