MonthCalendar

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

MonthCalendar

Post by Pablo César »

I haven't really ever looked into a calendar as such being so close at the moment...

I wish to make a routine that I can select the holidays of the month. To the MonthCalendar it has to be Multiselectable. That is, enabling change the background color of each day of the month with a particular color giving the look of being holiday.
Screen.PNG
Screen.PNG (4.38 KiB) Viewed 4912 times
Has anyone gone through this before? Any suggestions how to do the routine identification of holidays?

I know that saving in a database always be obtaining the holidays, but do not know how to display the MonthCalendar with possible days marked in another color.

I think first, we hit a MonthCalendar to allow the MCS_MULTISELECT and so surely I'll need a little help from friend Claudio.

I found this on the internet, which can give us an idea:

Code: Select all

#MCS_MULTISELECT=$2
#MCS_DAYSTATE=$1
If OpenWindow(0, 0, 0, 220, 200, "CalendarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  If CreateGadgetList(WindowID(0))
    cal=CreateWindowEx_(0,"SysMonthCal32","",#WS_BORDER|#WS_CHILD | #WS_VISIBLE | #MCS_MULTISELECT,10,10,200,180, WindowID(0),10,GetModuleHandle_(0),0)
    Debug GetDlgCtrlID_(cal)
    SendMessage_(cal, #MCM_SETMAXSELCOUNT, 31,0)
    Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
EndIf
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mustafa
Posts: 1160
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: MonthCalendar

Post by mustafa »

Hola Pablo Cesar:
Mira este sample, http://hmgforum.com/viewtopic.php?f=9&t=1059" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;
si te fijas el MonthCalendar
esta en color pero veo que solo funciona en Xp
en Windows Vista no sale el color ?
te dejo resumido el codigo fuente
haber si puedes arreglarlo.
Un saludo
Mustafa

Hi Pablo Cesar:
Look at this sample, http://hmgforum.com/viewtopic.php?f=9&t=1059" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;
if you look the MonthCalendar
this color but I see that only works in Xp
Windows Vista does not come out the color?
I leave the source code summary
have if you can fix it.
regards
Mustafa
Attachments
color_calendar.zip
(1.09 KiB) Downloaded 255 times
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

MonthCalendar

Post by Pablo César »

Hola Mustafa, gracias por tu atención.
mustafa wrote: el MonthCalendar esta en color pero veo que solo funciona en Xp
en Windows Vista no sale el color
Si bien que estoy haciendo pruebas en XP, pero lo que busco es poder seleccionar vários dias, como demuestra la figura que habia puesto:
MonthCalendar.gif
MonthCalendar.gif (14.46 KiB) Viewed 4863 times
La cuestion de cambiar colores, poderia ser dejado de lado para otra oportunidad. Lo que me interesa que se pueda cambiar los BackColor de los dias selecionados.

En el archivo C:\hmg.3.1.5\SOURCE\c_monthcal.c, pude implementar el MCS_MULTISELECT, que acceptaria, pero seleciona de forma consecutiva. Es decir: del dia incial hasta el dia final. Si bien que todavia demuestra alguna imperfeccion de exibicion de los dias selecionados.
MonthCalendar_MultiSelect.gif
MonthCalendar_MultiSelect.gif (23.89 KiB) Viewed 4850 times
Creo que iré buscar hace algo manualmente... :(
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

MonthCalendar

Post by Pablo César »

I've got this:
This is not possible. There is no built-in way of customizing the way that individual days or dates are displayed on the MonthCalendar control.

You could owner-draw the control, but that's way too much work to justify. This will make you responsible for drawing the entire control yourself. Note that if you choose to go this route, the MonthCalendar control does not raise the Paint event because the base control sets the UserPaint bit to "False". You will have to subclass the control and override its OnPrint method instead.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
tave2009
Posts: 61
Joined: Tue Jul 14, 2009 3:33 am
Location: San Francisco, Córdoba, Argentina.

Re: MonthCalendar

Post by tave2009 »

Hola Pablo César:
En esta página tenes algunas claves de como hacer una selección de unos días (solamente una semana): :D

http://www.functionx.com/win32/controls ... lendar.htm" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;"

claro, es C++, y Yo no soy muy hábil en la programación del "C" :lol:

Saludos.
Nada se pierde. Todo se transforma. (Lavoussier)
Nothing is lost. Everything changes.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

MonthCalendar

Post by Pablo César »

Hola Walter, gracias por tu indicación e interés ! :)

Yo ya habia leído a respecto. Tal es asi que algo conseguí. Pero si te fijas, verá que la seleccion la hace en sequencia y yo busco hacerlo de forma aleatórica.

Por lo que parece no hay posibilidad de hacer através de la API. Por lo tanto tendré que hacer algo manualmente, como el qu hice para el ejemplo VirtualKeyboard, con labels en frma de rejillas cambiando colores. :cry:

Si alguien tiene algo listo y que quiera compartirlo, contribuiré con mejoras... creo que asi salimos ganando todos que precisen de lo mismo.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
martingz
Posts: 395
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Re: MonthCalendar

Post by martingz »

Pablo Cesar hace tiempo necesite algo asi y lo resolvi con el control grid, si te sirve, te envio con gusto el codigo

saludos



Google Translation

Pablo Cesar does need some time and so I resolved to grid control, if it helps, I gladly sent the code
Attachments
grid colores.jpg
grid colores.jpg (127.62 KiB) Viewed 4799 times
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

MonthCalendar

Post by Pablo César »

Muchas gracias Martin por tu interés en el asunto y tu valiosa idea de hacerlo atravéz del Grid. Através del imagen que disponibilizaste, me has dado una excelente idea de hacerlo con todos los meses del año.

Seremos todos gratos si hay una posibilidad de compartir parte de ese código aqui en el forum, agregando valor de conocimiento para todos.

Desde ya, muchisimas gracias por tu apoyo,

Un gran abrazo y estima
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
martingz
Posts: 395
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Re: MonthCalendar

Post by martingz »

Pablo envio el archivo zip, tablas incluidas, disculpa el codigo tan mal hecho, pero fue un proyecto que se inicio, pero no se termino


saludos
Attachments
permisos.zip
(2.9 MiB) Downloaded 332 times
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

MonthCalendar

Post by Pablo César »

Hola Martin, disculpame que no haya respondido antes.

Muchas gracias Martin por compartir con nosotros. Prometo que iré revisar ese módulo y dejarlo de forma genérica para que pueda ser aprovechado por los demas.

Muchas gracias.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply