Blank dates in DatePickers
Moderator: Rathinagiri
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Blank dates in DatePickers
Hi all,
I believe this is a very old and very common demand not only for HMG and for many others languages (Java, VB, CSS, etc.).
At internet we can find many ways to do it but the most it carries some hassles and other could it becomes a serious problem.
By taking an example of C:\hmg.3.4.0\SAMPLES\Controls\DatePicker\DATEPICKER\Demo.prg by adding FORMAT " " (note a space in quoted) you will get this result:
In code language... on this example you just do this:
I hope to be useful for nice looking in your screen displaying.
I believe this is a very old and very common demand not only for HMG and for many others languages (Java, VB, CSS, etc.).
At internet we can find many ways to do it but the most it carries some hassles and other could it becomes a serious problem.
By taking an example of C:\hmg.3.4.0\SAMPLES\Controls\DatePicker\DATEPICKER\Demo.prg by adding FORMAT " " (note a space in quoted) you will get this result:
In code language... on this example you just do this:
I hope to be useful for nice looking in your screen displaying.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- danielmaximiliano
- Posts: 2612
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: Blank dates in DatePickers
Gracias por el TIP Pablo, para algunos será de mucha ayuda....
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
- mustafa
- Posts: 1162
- Joined: Fri Mar 20, 2009 11:38 am
- DBs Used: DBF
- Location: Alicante - Spain
- Contact:
Re: Blank dates in DatePickers
Hola Pablo César
Muy logrado , gracias por el aporte
Mustafa
Muy logrado , gracias por el aporte
Mustafa
- serge_girard
- Posts: 3173
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Blank dates in DatePickers
Thanks Pablo, I will try to remember it when I need it!
Serge
Serge
There's nothing you can do that can't be done...
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Blank dates in DatePickers
It is nice. But, no keyboard interface available if we use this. ie., we have to compulsorily use mouse to enter data.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Blank dates in DatePickers
Gracias Pablo Cesar
- luisvasquezcl
- Posts: 1258
- Joined: Thu Jul 31, 2008 3:23 am
- Location: Chile
- Contact:
Re: Blank dates in DatePickers
Gracias Pablo por tu aporte.
Saludos cordiales,
Luis Vásquez.
Saludos cordiales,
Luis Vásquez.
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Blank dates in DatePickers
You're welcome and is good to share knowledges with good friends.
By using SetProperty(<cWindowName>, <cControlName>, "FORMAT", "dd/MM/yyyy") it will works very well.
But knowing HMG is used over the world and this format is not used the common usage in each country, we shall know how is Date Format was setted.
In Harbour we can use: cFormat := Set( _SET_DATEFORMAT ) to get current date format. But what we real need is in lpszFormat according doc in msdn ( https://msdn.microsoft.com/en-us/library/aa932380.aspx ) to correctly set it.
In hmgdoc at Controls\Dateicker you will find right use of date format. For example here in Brazil and most of latin american countries we use day/month/year but using Set( _SET_DATEFORMAT ) badly return wrong format like as "DD/MM/YYYY" after been used SET DATE BRITISH and SET CENTURY ON.
So, in this case, there's a internal HMG function to correct this discrepancy by using GetDateFormat() since HMG 3.4.1 version.
In source code words, you can add ON CHANGE event for DatePickers using like this:
ON CHANGE SetProperty ( ThisWindow.Name, This.Name, "FORMAT", GetDateFormat() );
For who wish to see HMG demo in SAMPLES (based on C:\hmg.3.4.0\SAMPLES\Controls\DatePicker\DATEPICKER\Demo.prg), see this:I have related this to Harbour's forum and It would be nice to have a solution in Harbour when is used Set( _SET_DATEFORMAT ) but we have no other option, so let's use thru GetDateFormat() at meantimes.
B.Rgds
Keeping informed.
I do not know Rathi what exactly you're trying to say with that. But I guess the same that I found when used FORMAT " " and seeing is not enough to fix data when is changed. And this occurs due the main reason there is not any format as property when inputed data. I saw it is necessary to re-apply the right format after input data in this control.Rathinagiri wrote:It is nice. But, no keyboard interface available if we use this. ie., we have to compulsorily use mouse to enter data.
By using SetProperty(<cWindowName>, <cControlName>, "FORMAT", "dd/MM/yyyy") it will works very well.
But knowing HMG is used over the world and this format is not used the common usage in each country, we shall know how is Date Format was setted.
In Harbour we can use: cFormat := Set( _SET_DATEFORMAT ) to get current date format. But what we real need is in lpszFormat according doc in msdn ( https://msdn.microsoft.com/en-us/library/aa932380.aspx ) to correctly set it.
In hmgdoc at Controls\Dateicker you will find right use of date format. For example here in Brazil and most of latin american countries we use day/month/year but using Set( _SET_DATEFORMAT ) badly return wrong format like as "DD/MM/YYYY" after been used SET DATE BRITISH and SET CENTURY ON.
So, in this case, there's a internal HMG function to correct this discrepancy by using GetDateFormat() since HMG 3.4.1 version.
In source code words, you can add ON CHANGE event for DatePickers using like this:
ON CHANGE SetProperty ( ThisWindow.Name, This.Name, "FORMAT", GetDateFormat() );
For who wish to see HMG demo in SAMPLES (based on C:\hmg.3.4.0\SAMPLES\Controls\DatePicker\DATEPICKER\Demo.prg), see this:
B.Rgds
Keeping informed.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein