Page 2 of 2
Re: Datepicker / calendargadget
Posted: Wed May 25, 2011 6:50 pm
by WilliamL
jasper,
I guess my question is how he converted the pict to data. I suppose, if the original was a .png then, the data has to have that library (UsePNGImageDecoder) to show the picture.
Very clever of happer66.
Re: Datepicker / calendargadget
Posted: Thu May 26, 2011 2:56 pm
by Shardik
WilliamL wrote:I guess my question is how he converted the pict to data.
William,
there exist numerous examples in this forum for converting binary files (like images)
into Data lines, which can be included into your source code.
One example from srod generates Data lines in Byte format:
http://www.purebasic.fr/english/viewtop ... 84&start=8
A second example from STARGĂ…TE (German forum) generates Data lines in Quad
format and saves them into the clipboard so that you can paste them directly into
your source code (although I didn't try it on the Mac yet

):
http://www.purebasic.fr/german/viewtopi ... 31&start=3
Re: Datepicker / calendargadget
Posted: Thu May 26, 2011 4:57 pm
by WilliamL
Thanks Shardik,
Code: Select all
;This small utility creates a data section in raw binary format out of an external file.
;Useful for embedding small images directly within a source program etc,
;No error checking. by SRod
#linelength=40
inputfile$="back.ico"
outputfile$="data.pbi"
;Main program.
If CreateFile(1, outputfile$)
WriteStringN(1, ";"+inputfile$)
WriteStringN(1,"")
WriteStringN(1,"DataSection")
If ReadFile(2, inputfile$)
line$=" Data.b "
While Eof(2) = 0
count+1
byte.c=ReadByte(2)
line$+Str(byte)
If count=#linelength
WriteStringN(1, line$)
line$=" Data.b "
count=0
Else
line$+", "
EndIf
Wend
If line$<> " Data.b "
WriteStringN(1, Left(line$, Len(line$)-2))
EndIf
CloseFile(2)
WriteStringN(1,"EndDataSection")
CloseFile(1)
Else
MessageRequester("Error!", "Problem opening input file!")
EndIf
Else
MessageRequester("Error!", "Problem creating output file!")
EndIf
I should have thought to do a search for the information of how to convert a picture file into data. I tried it srods example and it worked! I'm adding this example to my pb files. (Maybe he could change the subject line to make a search easier?)
Thanks srod too (back in '07)

Re: Datepicker / calendargadget
Posted: Fri Sep 28, 2012 7:01 am
by SeregaZ
have this date gadget some options? when you open this date-window too difficult switch year. no one can guess click on year-text for to see change arrows. i mean for more userfriendly this date gadget need to easy understanding buttons:

Re: Datepicker / calendargadget
Posted: Fri Sep 28, 2012 5:33 pm
by WilliamL
I'm not sure what you are asking but you could try this Calendar
code but it is not a date picker but just a month calendar of one year. That is all I needed at the time but I suppose it could be modified to change years too.

Re: Datepicker / calendargadget
Posted: Fri Sep 28, 2012 6:27 pm
by SeregaZ
i am talking about more userfriendly date gadget for easy switching by years-buttons. your code is to big for use in one small project. maybe next time i will do this. thanks.