More function for calendergadget()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
dontmailme
Enthusiast
Enthusiast
Posts: 537
Joined: Wed Oct 29, 2003 10:35 am

More function for calendergadget()

Post 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 :)
Paid up PB User !
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
dontmailme
Enthusiast
Enthusiast
Posts: 537
Joined: Wed Oct 29, 2003 10:35 am

Post by dontmailme »

Great!

It would be nice to have the functions without using the API :)
Paid up PB User !
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: More function for calendergadget()

Post 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 ?
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

freak wrote: Coloring gadgets is not planned in the near future.
Timo
OK, so I have to continue with API calls :(
dontmailme
Enthusiast
Enthusiast
Posts: 537
Joined: Wed Oct 29, 2003 10:35 am

Post 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!
Paid up PB User !
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
StarHawk
User
User
Posts: 55
Joined: Sun Nov 02, 2003 7:27 am

Watch out...

Post 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.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Exactly the problem.

Post 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.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
StarHawk
User
User
Posts: 55
Joined: Sun Nov 02, 2003 7:27 am

right

Post 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.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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).
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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 
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply