Page 1 of 1

More function for calendergadget()

Posted: Thu Oct 14, 2004 3:10 pm
by dontmailme
The calendargadget() is a great improvement to PB and is much easier to do that the API way......

But, I can't see how to embolden dates, or set colours on them.. either the foreground or background.....

Am I right that this function is not yet available for this gadget ? If so, will this be added?

In the meantime, can I use API calls to add this function to the calendargadget() or is it easier (not for me 8O ) for now to use the API for all calendar function?

Thanks :)

Posted: Sat Oct 16, 2004 12:17 am
by freak
Hum, SetGadgetItemState() could be used for that... let me have a look...

However, the same as said in the other tread applies here too:
I don't have an internet connection right now, which makes development
a little hard.

Maybe Fred will add it?

Timo

Posted: Sat Oct 16, 2004 10:29 pm
by dontmailme
Great!

It would be nice to have the functions without using the API :)

Re: More function for calendergadget()

Posted: Mon Oct 18, 2004 10:31 am
by gnozal
dontmailme wrote:.... I can't see how to embolden dates, or set colours on them.. either the foreground or background.....
It's sad there is no color support for _any_ gadget in Purebasic :cry:
Or am I missing something ?

Posted: Wed Oct 20, 2004 10:47 pm
by freak
Ok, i have added it. A little too late for the beta2, but it will be in the final.
SetGadgetItemState(#CalendarGadget, Date, 1) will set a date to bold.

As for the colors. There is currently no color support for any of the PB gadgets.
It makes no sense to add it to one gadget only.
Coloring gadgets is not planned in the near future.

Timo

Posted: Thu Oct 21, 2004 7:33 am
by gnozal
freak wrote: Coloring gadgets is not planned in the near future.
Timo
OK, so I have to continue with API calls :(

Posted: Fri Oct 22, 2004 7:36 pm
by dontmailme
freak wrote:Ok, i have added it. A little too late for the beta2, but it will be in the final.
SetGadgetItemState(#CalendarGadget, Date, 1) will set a date to bold.

As for the colors. There is currently no color support for any of the PB gadgets.
It makes no sense to add it to one gadget only.
Coloring gadgets is not planned in the near future.

Timo
Great!

Are you saying that the text colour cannot be changed then ? Why is this ?
and how would I do this from the API with the CalendarGadget ?

Thanks again!

Posted: Fri Oct 22, 2004 9:52 pm
by freak
Go read some api documentation (msdn or the PlatformSDK)
It's all there and fairly easy. (I don't have one here right now, otherwise i'd look it up for you.)

Timo

Watch out...

Posted: Thu Oct 28, 2004 5:23 am
by StarHawk
Watch out when using API calls for color if you expect your software to run on all Windows 98, Windows ME, Windows 2000, Windows XP, computers (especially if it uses SetWindowCallback to redraw a task switched Window).

It cost me $$ and lots of angry clients when I added color to a Window with API commands I grabbed from the forums. I can't remember which operating system it was, but it caused errors. Worse, because of Thinstall, the errors were not being caught properly and it caused some clients computers to crash (that Thinstall is a phreakin Universe within itself).

Of course the easy work around was just to load in an image, say a jpeg the color blue, and put it in an image gadget the size of the Window and everything worked great on everyones computers. It took a whole 3 minutes to program versus the API method which took 2 hours of tinkering and was unstable on certain Windows computers (I have a hunch some of the Windows systems that were having problems were on old hardware and were "minimal installations" of the operating system).

I think adding color is a great feature request for PureBasic. Of course color being supported natively in solid assembly code that would run on any computer and not based on system specific API calls like some of the code by users in these forums (which don't get me wrong, I'm not knocking the awesome contributions of some of the API code in these forums just informing those who think API coding is the answer to all of their desires that PureBasic natively lacks if their producing a commercial grade program meant to run on all Windows computers). I'm guessing this is a large undertaking and probably why the programming God Freak said it's not planned in the near future.

Exactly the problem.

Posted: Thu Oct 28, 2004 9:03 am
by Fangbeast
This issue is further compounded by the fact that as each operating system has evolved, newer API's necessarily don't work on older OS's so if you do use them, look up the MSDN documents that will tell you which version of the OS the API you are going to use works on. Then you can tell the end user what minimum specification (OS and other) that your product will work on nd there wull be no misunderstanding.

Takes a lot of time (I know!!) but saves trouble in the long run.

right

Posted: Thu Oct 28, 2004 8:42 pm
by StarHawk
Right. That's good advice. Worse, I found the MSDN information to have large holes in it and ambiguity about certain API commands. Sort of like Microsoft was pissed that developers kicked their butt in court, and so under hostile "your head is in a lock grip", we'll make certain information available to developers in a drag our feet, grudging sort of way. Maybe I'm being too hard on MS, but I think their MSDN, DLL, API, etc.. literature could be presented in a better, more clear, and organized way.

Posted: Mon Jul 18, 2005 9:01 am
by PB
> SetGadgetItemState(#CalendarGadget, Date, 1) will set a date to bold.

This is great, but one of the functions of my app is to let the user delete all
calendar appointments... which means I need to make them all unbold again.
Is there a way to unbold all dates in the CalendarGadget in one pass, or do
I need to set the state of every date of the year(s) to unbold? Eww! :(

(Or, I guess I could destroy and re-create the CalendarGadget again with the
same gadget number and X/Y/W/H attributes... but that's silly).

Posted: Tue Jul 19, 2005 12:30 pm
by PB
Okay, I just realised that #PB_Calendar_Normal will reset the entire calendar
back to normal dates, not just one date... but the docs make it look as though
it sets one specific date as opposed to the whole calendar:

From http://www.purebasic.com/documentation/ ... state.html :

CalendarGadget(): #PB_Calendar_Bold to make a date appear bold, #PB_Calendar_Normal otherwise.

How could I set a specific date back to normal then? Here's some code that
demonstrates the problem: it makes yesterday, today and tomorrow bold,
then waits 2 seconds, then is supposed to set tomorrow back to normal...
but it makes the entire calendar normal instead, even though I specified
tomorrow's date:

Code: Select all

If OpenWindow(0,200,200,220,200,#PB_Window_SystemMenu,"test")
  If CreateGadgetList(WindowID())
    CalendarGadget(0,10,10,200,180)
    y=Year(Date()) : m=Month(Date()) : d=Day(Date())
    SetGadgetItemState(0,Date(y,m,d-1,0,0,0),#PB_Calendar_Bold) ; Yesterday bold.
    SetGadgetItemState(0,Date(y,m,d,0,0,0),#PB_Calendar_Bold) ; Today bold.
    SetGadgetItemState(0,Date(y,m,d+1,0,0,0),#PB_Calendar_Bold) ; Tomorrow bold.
    a=GetTickCount_() : Repeat : Sleep_(1) : WindowEvent() : Until GetTickCount_()>a+2000
    SetGadgetItemState(0,Date(y,m,d+1,0,0,0),#PB_Calendar_Normal) ; Tomorrow normal?
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
  EndIf
EndIf