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.
Datepicker / calendargadget
Re: Datepicker / calendargadget
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
Re: Datepicker / calendargadget
William,WilliamL wrote:I guess my question is how he converted the pict to data.
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
Thanks Shardik,
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)
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
Thanks srod too (back in '07)

Last edited by WilliamL on Fri Sep 28, 2012 7:44 pm, edited 1 time in total.
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
-
- Enthusiast
- Posts: 628
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Datepicker / calendargadget
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
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.


MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
-
- Enthusiast
- Posts: 628
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Datepicker / calendargadget
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.