f



Multiple copies in the clipboard when copying

Hi wxWidgets enthusiasts !

I am developping a terminal for gnuplot (famous 2D-3D data plotting
program) with wxWidgets (and by the way the real graphic part is done by
cairo and pango).

I have an issue with the clipboard. I have a toolbar icon which triggers
a simple method to set the plot bitmap in the clipboard. It works, but
it works too well ! Indeed, when controlling what the clipboard contains
via Klipper under KDE, I can see that I receive in fact many copies of
the same bitmap, two at the first time I open Klipper, and this number
increases as I open Klipper (4 four when I reclick on Klipper icon
immediately after the first click, etc. without clicking again on my
toolbar icon). Klipper itself doesn't seem to be the cause, as I don't
see problems with it when I copy from other programs.

Here is the code :

In the event table :
    EVT_TOOL( Toolbar_CopyToClipboard, wxtFrame::OnCopy )

and :

    void wxtFrame::OnCopy( wxCommandEvent& WXUNUSED( event ) )
    {
        wxTheClipboard->UsePrimarySelection(false);
        /* SetData clears the clipboard */
        wxTheClipboard->Clear();
        if ( wxTheClipboard->Open() ) {
            wxTheClipboard->SetData(new
wxBitmapDataObject(*(panel->cairo_bitmap)));
            wxTheClipboard->Close();
        }
        wxTheClipboard->Flush();
    }


where panel->cairo_bitmap holds a pointer to a wxBitmap.


Can somebody give some help about it ?

Thank you very much !

Regards,

Timoth�e Lecomte

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
timothee
1/13/2006 2:34:59 PM
comp.soft-sys.wxwindows 21076 articles. 0 followers. Post Follow

6 Replies
1912 Views

Similar Articles

[PageSpeed] 57

Howdy,

You can set a wxDateTime object to the current time with:

wxDateTime td;
td.Now();

but how do I set a wxDateTime object to a given day month and year

int day = 1;
int month = 1;
int year = 2006;

wxDateTime td;
td.SetYear( year );
td.SetMonth( month );
td.SetDay( day );

does not work, but after a lot of research I cannot figure out how to
set a wxDateTime object to a specific day, month, and year.

Sorry for the stupid question.

woody@acornnmr.com



---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
xp
1/13/2006 7:06:11 PM
On 01/13/2006 7:06 PM, Woody Conover wrote:

[cut]

> wxDateTime td;
> td.SetYear( year );
> td.SetMonth( month );
> td.SetDay( day );
> 
> does not work, but after a lot of research I cannot figure out how to
> set a wxDateTime object to a specific day, month, and year.

You must've missed something in your research -- one of the constructors 
and one of the overloaded "Set" member functions let you set the date 
from given day, month, year and (if you so wish) hour, minute, second 
and millisecond.

-- 
Wlodek Szafran
0
Wlodek
1/13/2006 7:31:54 PM
Howdy,

I see the function: 
wxDateTime& Set(wxDateTime_t day, Month month = Inv_Month, int year =
Inv_Year, wxDateTime_t hour = 0, wxDateTime_t minute = 0, wxDateTime_t
second = 0, wxDateTime_t millisec = 0)

but I have been unable to use it. I can feed it the year as an int, but
I cannot figure out how to feed it the month or day. Ints don't work,
and wxDateTime::Month month does not either.

How do you call the Set() function with three ints for year, month and
day?

Woody



> -----Original Message-----
> From: Wlodek Szafran [mailto:wlodek.szafran@_SPA.M_S.INK_hwcn.org]
> Sent: Friday, January 13, 2006 11:32 AM
> To: wx-users@lists.wxwidgets.org
> Subject: Re: wxDateTime
> 
> 
> On 01/13/2006 7:06 PM, Woody Conover wrote:
> 
> [cut]
> 
> > wxDateTime td;
> > td.SetYear( year );
> > td.SetMonth( month );
> > td.SetDay( day );
> >
> > does not work, but after a lot of research I cannot figure out how
to
> > set a wxDateTime object to a specific day, month, and year.
> 
> You must've missed something in your research -- one of the
constructors
> and one of the overloaded "Set" member functions let you set the date
> from given day, month, year and (if you so wish) hour, minute, second
> and millisecond.
> 
> --
> Wlodek Szafran


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
xp
1/13/2006 8:39:34 PM
WC> I see the function: 
WC> wxDateTime& Set(wxDateTime_t day, Month month = Inv_Month, int year =
WC> Inv_Year, wxDateTime_t hour = 0, wxDateTime_t minute = 0, wxDateTime_t
WC> second = 0, wxDateTime_t millisec = 0)

WC> but I have been unable to use it. I can feed it the year as an int, but
WC> I cannot figure out how to feed it the month or day. Ints don't work,
WC> and wxDateTime::Month month does not either.

WC> How do you call the Set() function with three ints for year, month and
WC> day?

wxDateTime datetest(1, wxDateTime::Apr, 2006);
or
datetest.Set(24, wxDateTime::Dez, 2006);

Regards,
Eric



---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
doublemax
1/13/2006 8:53:36 PM
On 01/13/2006 8:39 PM, Woody Conover wrote:
> Howdy,
> 
> I see the function: 
> wxDateTime& Set(wxDateTime_t day, Month month = Inv_Month, int year =
> Inv_Year, wxDateTime_t hour = 0, wxDateTime_t minute = 0, wxDateTime_t
> second = 0, wxDateTime_t millisec = 0)
> 
> but I have been unable to use it. I can feed it the year as an int, but
> I cannot figure out how to feed it the month or day. Ints don't work,
> and wxDateTime::Month month does not either.
> 
> How do you call the Set() function with three ints for year, month and
> day?

Well, it's better to have the values in variables of appropriate type to 
begin with, but if that's not possible, then you'll have to cast as needed:

   int day = 13;
   int month = 1;
   int year = 2006;

   wxDateTime dt1(static_cast<wxDateTime::wxDateTime_t> (day),
                  static_cast<wxDateTime::Month> (month),
                  year);

   wxDateTime dt2;
   dt2.Set(static_cast<wxDateTime::wxDateTime_t> (day),
           static_cast<wxDateTime::Month> (month),
           year);

-- 
Wlodek Szafran
0
Wlodek
1/13/2006 10:58:44 PM
Just to make the list useful and the readers informed, I have found the
problem and wrote a patch for wxGTK (#1424755 in sf.net patches).

Best regards,

Timoth�e



Timoth�e Lecomte wrote:

>(...)
>I have an issue with the clipboard. I have a toolbar icon which triggers
>a simple method to set the plot bitmap in the clipboard. It works, but
>it works too well ! Indeed, when controlling what the clipboard contains
>via Klipper under KDE, I can see that I receive in fact many copies of
>the same bitmap (...)
>



---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
timothee
2/5/2006 8:27:05 PM
Reply: