[Gtk-sharp-list] Calendar customizations
Jorge De Gante Tellez
jdegante@linuxware.com.mx
24 Mar 2003 11:55:09 -0600
Hi everybody
In regards to the message that Gonzalo wrote, I got a question:
How can I set the date of a Gnome.DateEdit widget?
I got a record in a database (mysql) with a field of type DATE and I
want to show that record for editing with that date.
In the code included I realized how to obtain the date from the control,
now as you see I need the reverse operation.
Thanks in advance.
El s=E1b, 22-03-2003 a las 11:30, Gonzalo Paniagua Javier escribi=F3:
> Hi!
>=20
> I've added a GetDate overload that returns a DateTime.
>=20
> Also Lee asked me to make DisplayOptions a property instead of a method.
>=20
> Here are the patches.
>=20
> Ok to commit?
>=20
> -Gonzalo
>=20
> ----
>=20
> Index: api/gtk-api.xml
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvs/public/gtk-sharp/api/gtk-api.xml,v
> retrieving revision 1.26
> diff -u -r1.26 gtk-api.xml
> --- api/gtk-api.xml 22 Feb 2003 04:34:55 -0000 1.26
> +++ api/gtk-api.xml 22 Mar 2003 17:30:01 -0000
> @@ -1816,7 +1816,7 @@
> <method name=3D"ClearMarks" cname=3D"gtk_calendar_clear_marks">
> <return-type type=3D"void"/>
> </method>
> - <method name=3D"DisplayOptions" cname=3D"gtk_calendar_display_opti=
ons">
> + <method name=3D"DisplayOptions" cname=3D"gtk_calendar_display_opti=
ons" hidden=3D"1">
> <return-type type=3D"void"/>
> <parameters>
> <parameter type=3D"GtkCalendarDisplayOptions" name=3D"flags"/>
> Index: sample/CalendarApp.cs
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvs/public/gtk-sharp/sample/CalendarApp.cs,v
> retrieving revision 1.1
> diff -u -r1.1 CalendarApp.cs
> --- sample/CalendarApp.cs 22 Mar 2003 16:37:03 -0000 1.1
> +++ sample/CalendarApp.cs 22 Mar 2003 17:30:03 -0000
> @@ -16,7 +16,9 @@
> public static Calendar CreateCalendar ()
> {
> Calendar cal =3D new Calendar();
> - cal.DisplayOptions (CalendarDisplayOptions.ShowHeading | CalendarDisp=
layOptions.ShowDayNames | CalendarDisplayOptions.ShowWeekNumbers);
> + cal.DisplayOptions =3D CalendarDisplayOptions.ShowHeading |
> + CalendarDisplayOptions.ShowDayNames |
> + CalendarDisplayOptions.ShowWeekNumbers;
> return cal;
> }
> =20
> @@ -37,11 +39,7 @@
> static void DaySelected (object obj, EventArgs args)
> {
> Calendar activatedCalendar =3D (Calendar) obj;
> - uint year, month, day;
> - activatedCalendar.GetDate(out year, out month, out day);
> - // The month is zero-based, so tweak it before output
> - Console.WriteLine ("Selected date: {0}/{1}/{2}",
> - year, month+1, day);
> + Console.WriteLine (activatedCalendar.GetDate ().ToString ("yyyy/MM/dd=
"));
> }
> =20
> static void Window_Delete (object obj, DeleteEventArgs args)
> Index: sources/Gtk.metadata
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvs/public/gtk-sharp/sources/Gtk.metadata,v
> retrieving revision 1.44
> diff -u -r1.44 Gtk.metadata
> --- sources/Gtk.metadata 21 Feb 2003 03:44:42 -0000 1.44
> +++ sources/Gtk.metadata 22 Mar 2003 17:30:04 -0000
> @@ -1528,6 +1528,17 @@
> </attribute>
> </data>
> </rule>
> +<rule>
> + <class name=3D"GtkCalendar">
> + <method>DisplayOptions</method>
> + </class>
> + <data>
> + <attribute target=3D"method">
> + <name>hidden</name>
> + <value>1</value>
> + </attribute>
> + </data>
> +</rule>
> =20
> <!-- overloads -->
> <rule>
> ----
>=20
> // Gtk.TreeSelection.Custom - Gtk TreeSelection calss customizations
> //
> // Author:
> // Gonzalo Paniagua Javier (gonzalo@ximian.com)
> //
> // (c) 2003 Ximian, Inc. (http://www.ximian.com)
> //
> // This code is inserted after the automatically generated code.
>=20
>=20
> /// <summary> GetSelected Method </summary>
> /// <remarks> To be completed </remarks>
>=20
> public DateTime GetDate ()
> {
> uint year, month, day;
> GetDate (out year, out month, out day);
> return new DateTime ((int) year, (int) month + 1, (int) day);
> }
>=20
> [DllImport("libgtk-win32-2.0-0.dll")]
> static extern void gtk_calendar_display_options (IntPtr raw, int flags)=
;
>=20
> public Gtk.CalendarDisplayOptions DisplayOptions {
> set {
> gtk_calendar_display_options (Handle, (int) value);
> }
> }
--=20
Jorge De Gante Tellez
jdegante@linuxware.com.mx
LinuxWare S.A. de C.V.
http://www.linuxware.com.mx
Tel. 26-03-15-15 26-03-15-16 26-03-15-17=20
Fax 26-03-15-18