Appointment manager

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Appointment manager

Post by Fangbeast »

The below is the current link to my family web pages. I have made fixes to loads of stupid mistakes, the alarm module was the worst.

http://members.westnet.com.au/bangfeast ... Muncher.7z

Just briefly:

1. All active appointments are set in bold to the calendargadget at program startup.
2. StickyWindow and ToolTip button images are now correct
3. An about window was added.
4. Shortcut keys were changed, check the source code.
5. Shortcut key text is added to the balloon tooltips.
6. PostEvent is used in several places to replace clumsy gadget event firing. Elegant.
7. The alarm module has duplicate checks for deleted and inactive appointments removed and now also sports the same icons as the main list. I know I duplicated some structures but didn't know how else to do it. So many things were fixed there.


I need help with two routines because I am not strong in logic. The first routine sets the correct icon based on the hour of the day/night. I know this isn't right. HourCheck.i contains a value between 0 and 23, is there a better way to work this?

Code: Select all

  HourCheck.i = Val(StringField(Appointment\appTime, 1, ":"))
    Select HourCheck.i
    Case 0 To 12
      ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightMorning)
    Case 12 To 18
      ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNoon)
    Case 18 To 24
      ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNight)
  EndSelect
The second routine is worse, I have not thhought it through properly. I should be checking agains tthe appointment date as well I think.

Oh well, the program works for now. Few bugs left and am 'fleshing out the status messages too.

Code: Select all

    AppointmentAlarm.i  = ParseDate("%dd/%mm/%yyyy", Appointment\appAlarm)  ; Turn text date into date integer
    CurrentDate.i       = ParseDate("%dd/%mm/%yyyy", Program\CurrentDate)   ; Turn text date into date integer
    
    If AppointmentAlarm.i < CurrentDate.i       ; If alarm date is less than today's date
      ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 3, Icon\AlarmRed)
    ElseIf  AppointmentAlarm.i = CurrentDate.i ; If alarm date equals today's date
      ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 3, Icon\AlarmGreen)
    ElseIf  AppointmentAlarm.i > CurrentDate.i ; If alarm date is greater than today's date
      ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 3, Icon\AlarmBlue)
    Else
      ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 3, Icon\AlarmBlank)
    EndIf
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Appointment manager

Post by Fangbeast »

Stupid question but, does anyone want me to keep on working on this program? I've made some changes and added a few things, fixed bugs etc (added some more bugs).
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: Appointment manager

Post by electrochrisso »

Keep on coding Fang, I had better take a look at yours and see how it compares to the Events Calendar program I made up a couple of years back, and I am still using it, I think it has gone through the beta test long enough now, so I might release it soon (source included) for the PB community to look at, find bugs etc. :)
PureBasic! Purely the best 8)
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Appointment manager

Post by Fangbeast »

Okay, will do. Yours is probably a lot better (I know my limitations). I've added a separate, more advanced find window and will add a setup window and then update the family web site with it.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: Appointment manager

Post by yrreti »

Hi Fangbeast

Got to run, but here is a quick idea for the following code of which is not found in your new code yet, of
a way to accomplish what you want to do.

Code: Select all

;   HourCheck.i = Val(StringField(Appointment\appTime, 1, ":"))
;     Select HourCheck.i
;     Case 0 To 12
;       ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightMorning)
;     Case 12 To 18
;       ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNoon)
;     Case 18 To 24
;       ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNight)
;   EndSelect

Code: Select all

;Just use the hours and minutes together as in these examples that follow that show 
;how changed HourCheck$ values will be selected.
HourCheck$="11:59" 
HourCheck$=ReplaceString(HourCheck$,":","",1)
HourCheck.i = Val(HourCheck$)
Debug Str(HourCheck.i)
    Select HourCheck.i
    Case 0 To 1159,2400
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightMorning)"
    Case 1200 To 1759
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNoon)"
    Case 1800 To 2359
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNight)"
EndSelect

HourCheck$="12:00" 
HourCheck$=ReplaceString(HourCheck$,":","",1)
HourCheck.i = Val(HourCheck$)
Debug Str(HourCheck.i)
    Select HourCheck.i
    Case 0 To 1159,2400
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightMorning)"
    Case 1200 To 1759
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNoon)"
    Case 1800 To 2359
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNight)"
EndSelect

HourCheck$="17:59" 
HourCheck$=ReplaceString(HourCheck$,":","",1)
HourCheck.i = Val(HourCheck$)
Debug Str(HourCheck.i)
    Select HourCheck.i
    Case 0 To 1159,2400
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightMorning)"
    Case 1200 To 1759
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNoon)"
    Case 1800 To 2359
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNight)"
EndSelect

HourCheck$="18:00" 
HourCheck$=ReplaceString(HourCheck$,":","",1)
HourCheck.i = Val(HourCheck$)
Debug Str(HourCheck.i)
    Select HourCheck.i
    Case 0 To 1159,2400
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightMorning)"
    Case 1200 To 1759
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNoon)"
    Case 1800 To 2359
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNight)"
EndSelect

HourCheck$="23:59" 
HourCheck$=ReplaceString(HourCheck$,":","",1)
HourCheck.i = Val(HourCheck$)
Debug Str(HourCheck.i)
    Select HourCheck.i
    Case 0 To 1159,2400
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightMorning)"
    Case 1200 To 1759
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNoon)"
    Case 1800 To 2359
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNight)"
EndSelect

HourCheck$="24:00" 
HourCheck$=ReplaceString(HourCheck$,":","",1)
HourCheck.i = Val(HourCheck$)
Debug Str(HourCheck.i)
    Select HourCheck.i
    Case 0 To 1159,2400
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightMorning)"
    Case 1200 To 1759
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNoon)"
    Case 1800 To 2359
Debug"ChangeIcon(#Gadget_AppointmentMuncher_Appointments, LineNumber.i, 2, Icon\LightNight)"
  EndSelect
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Appointment manager

Post by Fangbeast »

Hmm, much better, thank you! Working on a setup form at the moment and cursing my old brain.

**UPDATE**

Added a setup module
Toggle tooltips, stickywindow, titlebar clock and snap to border
Added buttons for Toggle tooltips, stickywindow, titlebar clock
Added a better sql search module
Move literal strings to constants for possible multilanguage (Control strings are left as English)
Added an 'about' window
Load and save setup options for persistence
Cleaned up code and reordered things more logically.

Think I fixed most bugs, works well for me. Will upload late tomorrow but first, Sir Charles the cat needs to go to the vet again (Sigh)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: Appointment manager

Post by electrochrisso »

Hey Fang, I had a bit of a play with your Appointment manager, I think it is pretty funky, mine is quite plain looking compared to yours, I also like the way you lay out your code, very neat and tidy.
Keep up the good work. :)
PureBasic! Purely the best 8)
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Re: Appointment manager

Post by jack »

looking forward to the update :)
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Appointment manager

Post by Fangbeast »

Hey Fang, I had a bit of a play with your Appointment manager, I think it is pretty funky
Did you say 'Funky' or 'Fungussy'??? (GRIN). My family and friends all hate my colour schemes but they are designed for my eyes.
I also like the way you lay out your code, very neat and tidy.


That's the result of having bad eyesight due to years of untested diabetes. I now have a 27 inch monitor but it still took me three days to chase down a bug where I had substituded a comma for a full stop!!!.

I think I need a 50 inch monitor so I hac clearly see the duifference between the two.
Keep up the good work. :)
Thanks, I appreciate that.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Appointment manager

Post by Fangbeast »

jack wrote:looking forward to the update :)
Hello Jack, I've updated the latest perversion, link is the same as in the first post.'

Thanks to Yrreti for the date logic (I got it wrong).

Please all bash it soundly and tell me where I have stuffed up and hidden those pesky bugs if you have time?

If you check the main source code, you will see that there is a hidden advanced SQL search (Well, more advanced than the simple search string on the front page of the program) module, a procedure to permanently remove deleted items and a small setup screen for things I needed.

I have the nagging feeling that I still have forgotten something.

Hopefully, I might be able to figure out how to incoporate recurring events in the future (Although I don't personally need them) and finish the print and help modules.

Not sure if I should make a seperate help file or build it in via an editorgadget as it's not a commercial endevour. I.e, not professional to warrant one.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Re: Appointment manager

Post by jack »

Hi Fangbeast,
just downloaded your latest version, but I just got home from work so I will give a workout tomorrow, happy weekend.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Appointment manager

Post by Fangbeast »

Just cleaned up more things and added a list of the keyboard shortcuts to the keyboard icon under the event groups selection. That's because I keep forgetting my own shortcuts!
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Appointment manager

Post by Fangbeast »

Jack (and others), I am just adding silly things that I need now and silly changes here and there to see what I can get away with so am wondering if you want the latest version anyway.

If so, let me know and I'll upload it.

Everything looks nice and flat on the front form now (happy with that). Replaced the ListIconHeader with stringgadgets because no matter whats tyle I used, the heading would not stop having borders or act like a button.

And the header stringgadgets update as you hover over the list and return to headings when you are not over the list.

Other things too, can't remember them all

**UPDATE** Added export and import and fixed a load of stupid bugs. More comments, icons fixed and other stuff. Anyone want it?
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: Appointment manager

Post by yrreti »

Hi Fangbeast

I've been on a trip for the last 2 1/2 weeks and didn't get to check the forum too much.
I would be interested in getting your latest changes. This program of yours has some potential,
and your GUI is really nice. Very useful for my needs, as well as learning from your code too.

Thanks much

yrreti
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Appointment manager

Post by Fangbeast »

I've been on a trip for the last 2 1/2 weeks and didn't get to check the forum too much.
But, but, but..wasn't there room in the boot for me?? I need a holiday!
I would be interested in getting your latest changes.
After having learned my lesson not to spread my own posts everywhere (Well, most of the time), I now update the link in the first post so you can always get it from there. Old brain you know.
This program of yours has some potential,
Potentially smelly?
and your GUI is really nice.
Not according to my mean daughter:):)
Very useful for my needs, as well as learning from your code too.
Us assembly monkeys thank you. Took me a while to realise that I'd put in more bugs as well as functions and drove me mad fixing them.

Onde day, I'l get around to printing.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Post Reply