[Module] CalendarEx - Gadget (all OS)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: [Module] Calendar - Module (all OS)

Post by blueb »

Thanks for the quick fix Thorsten.



PS - Happy belated birthday (July 18th)

Code: Select all

Calendar::AddEntry(#Calendar, "Thorsten", "Birthday", "", "", Calendar::GetDate(18, 7, 2019))
:mrgreen:
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Calendar - Module (all OS)

Post by Thorsten1867 »

Update: dynamic text size (needs ModuleEx.pbi)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: [Module] Calendar - Module (all OS)

Post by Cyllceaux »

Hey there...

Line 87/88... I use them from another source.


Can't use it in ContainerEx, cause of ToolTip :(

Next thing

Code: Select all

	Calendar::AddEntry(calTermine,"CD1","CD1","","",Calendar::GetDate(2019,11,22,8),Calendar::GetDate(2019,11,22,9)); don't work
	Calendar::AddEntry(calTermine,"CD2","CD2","","",Calendar::GetDate(2019,11,22,12),Calendar::GetDate(2019,11,22,13)); don't work

	Calendar::AddEntry(calTermine,"D1","D1","","",Date(2019,11,22,8,0,0),Date(2019,11,22,9,0,0));  work
	Calendar::AddEntry(calTermine,"D2","D2","","",Date(2019,11,22,12,0,0),Date(2019,11,22,13,0,0));  work
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: [Module] Calendar - Module (all OS)

Post by Cyllceaux »

Oh... A ClearEntries would be nice :)
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Calendar - Module (all OS)

Post by Thorsten1867 »

Update: Calendar::ClearEntries()
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: [Module] Calendar - Module (all OS)

Post by Cyllceaux »

Line 87/88... I use them from another source.

Still there :(

Maybe:

Code: Select all

CompilerIf Not Defined(ToolTip, #PB_Module)
	XIncludeFile "CanvasTooltipModule.pbi"
CompilerEndIf


CompilerIf Not Defined(Date64, #PB_Module)
	XIncludeFile "Date64Module.pbi"
CompilerEndIf
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: [Module] Calendar - Module (all OS)

Post by BarryG »

How can I copy this calendar module source? There's no single copy button, and Firefox crashes if I try to select and drag the source code (to copy it) because it's too big. Can't you zip it somewhere or something? Thanks.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4747
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: [Module] Calendar - Module (all OS)

Post by Fangbeast »

BarryG wrote:How can I copy this calendar module source? There's no single copy button, and Firefox crashes if I try to select and drag the source code (to copy it) because it's too big. Can't you zip it somewhere or something? Thanks.
Try this: https://github.com/Hoeppner1867/PureBasic
Amateur Radio, D-STAR/VK3HAF
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: [Module] Calendar - Module (all OS)

Post by BarryG »

Thanks, Fangbeast. Shame that I need to download 15 MB of files just to get the single Calendar.pbi file, though. Is that the way GitHub works? If so, that sucks.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4747
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: [Module] Calendar - Module (all OS)

Post by Fangbeast »

BarryG wrote:Thanks, Fangbeast. Shame that I need to download 15 MB of files just to get the single Calendar.pbi file, though. Is that the way GitHub works? If so, that sucks.
Don't really know why 15MB is a problem in this day and age and I'd rather have ALL the updated files at once as there is so much good code there.

But you can click on the folder containing the code and open each file in a separate tab. My download manager thinks it's a html page and can't seem to bypass it so I can view/copy/paste the contents into the IDE at least.

Oh, and make sure to hit the RAW button to remove the line numbers.
Amateur Radio, D-STAR/VK3HAF
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: [Module] Calendar - Module (all OS)

Post by BarryG »

Fangbeast wrote:Don't really know why 15MB is a problem
Size is not the issue; it's the principle. I dislike how GitHub makes me download the haystack just to get the needle.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Calendar - Module (all OS)

Post by Thorsten1867 »

I have changed the download link.
You don't have to "argue" anymore. :wink:
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: [Module] Calendar - Module (all OS)

Post by Cyllceaux »

#Description$ is same as #Summary$ is same as #Location$
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] CalendarEx - Module (all OS)

Post by Thorsten1867 »

Update: Renamed to 'CalendarEx'
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
nicolaus
Enthusiast
Enthusiast
Posts: 456
Joined: Tue Aug 05, 2003 11:30 pm
Contact:

Re: [Module] CalendarEx - Gadget (all OS)

Post by nicolaus »

Hi,

very nice Module thank you very much.
Unfortunataly some thing don't work as it should be.
If I run the file CalendarExModule.pbi with the included example, a added entry will not shown if you dont have a proper end date set.

For example:

Code: Select all

CalendarEx::AddEntry(#Calendar, "Thorsten", "Birthday","", "", CalendarEx::GetDate(18, 12, 2021)
This entry will mever shown because no end date is set.

Next issue I found is a entry what gose over a few day's, this ar also will never shown in your Module Example section.

And thze last thing is the entry what is created with the follow line of code

Code: Select all

CalendarEx::AddEntry(#Calendar, "Entry 2",  "2nd appointment", "", "", CalendarEx::GetDate(18, 12, 2021, 8), CalendarEx::GetDate(18, 12, 2021, 11, 15), CalendarEx::#Duration)
With this line you will have on each 18. of a month the same apointment added and not only at the 18.12.2021

This is the full module test code form your file with only changed date in entry

Code: Select all

;- ========  Module - Example ========

CompilerIf #PB_Compiler_IsMainFile
  
  #Example =1
  
  ; Example 1: Default 
  ; Example 2: #GreyedDays
  ;Example 3: Colors
  
  ;CalendarEx::DefaultCountry("DE")
  
  Enumeration 1
    #Window
    #Calendar
    #PopUpMenu
    #ExportEvent
    #ShowEntries
  EndEnumeration
  
  Enumeration 1
    #FontGadget
    #FontMonth
    #FontWeekDays
  EndEnumeration  
  
  LoadFont(#FontMonth,    "Arial", 11, #PB_Font_Bold)
  LoadFont(#FontWeekDays, "Arial",  9, #PB_Font_Bold)
  
  NewList Entries.CalendarEx::Entries_Structure()
  
  If OpenWindow(#Window, 0, 0, 300, 200, "Example", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
    
    If CreatePopupMenu(#PopUpMenu)
      MenuItem(#ExportEvent, "Export calendar entries")
      MenuBar()
      MenuItem(#ShowEntries, "Show calendar entries")
    EndIf
    
    If CalendarEx::Gadget(#Calendar, 10, 10, 280, 180, CalendarEx::#AutoResize, #Window) ; CalendarEx::#PostEvent|CalendarEx::#FixDayOfMonth|CalendarEx::#FixMonth|CalendarEx::#FixYear
      
      CalendarEx::AttachPopupMenu(#Calendar, #PopUpMenu)
      
      CalendarEx::SetFont(#Calendar, #FontMonth, CalendarEx::#Font_Month)
      CalendarEx::SetAttribute(#Calendar, CalendarEx::#Height_Month, 28)
      
      CalendarEx::SetFont(#Calendar, #FontWeekDays, CalendarEx::#Font_Weekdays)
      CalendarEx::SetAttribute(#Calendar, CalendarEx::#Height_WeekDays, 22)
      
      CalendarEx::UpdatePopupText(#Calendar, #ExportEvent, "Export calendar entries for '" + CalendarEx::#Date$ + "'.")
      CalendarEx::UpdatePopupText(#Calendar, #ShowEntries, "Show calendar entries for '"   + CalendarEx::#Date$ + "'.")
      
      CalendarEx::SetState(#Calendar, Date())

      CompilerIf Defined(ModuleEx, #PB_Module)
       
        CalendarEx::SetAutoResizeFlags(#Calendar, CalendarEx::#Width|CalendarEx::#Height|CalendarEx::#FitText)
    	  CalendarEx::SetDynamicFont(#Calendar, "Arial", 9)
    	  CalendarEx::FitText(#Calendar, 4, 4)
    	
      CompilerEndIf
      
      ;ModuleEx::SetTheme(ModuleEx::#Theme_DarkBlue)
      
      CompilerSelect #Example
        CompilerCase 2
          CalendarEx::SetFlags(#Calendar, CalendarEx::#Gadget, CalendarEx::#GreyedDays)
        CompilerCase 3
          CalendarEx::SetColor(#Calendar, CalendarEx::#Month_FrontColor, $FFF8F0)
          CalendarEx::SetColor(#Calendar, CalendarEx::#Month_BackColor,  $701919)
          CalendarEx::SetColor(#Calendar, CalendarEx::#Week_FrontColor,  $701919)
          CalendarEx::SetColor(#Calendar, CalendarEx::#Week_BackColor,   $FFFAF6)
          CalendarEx::SetColor(#Calendar, CalendarEx::#FocusColor,       $00FC7C)
          CalendarEx::SetColor(#Calendar, CalendarEx::#Entry_BackColor,  $9595FF)
          CalendarEx::SetFlags(#Calendar, CalendarEx::#Gadget, CalendarEx::#GreyedDays)
        CompilerDefault
          
          CalendarEx::SetColorTheme(#Calendar, CalendarEx::#Theme_Blue)
          
          CalendarEx::SetFont(#Calendar, #FontWeekDays, CalendarEx::#Font_Entry)
          CalendarEx::SetFlags(#Calendar, CalendarEx::#Gadget, CalendarEx::#GreyedDays)
          
          CalendarEx::SetMask(#Calendar, CalendarEx::#ToolTipText, CalendarEx::#Summary$ + ": " + CalendarEx::#Label$)
          CalendarEx::SetMask(#Calendar, CalendarEx::#Date, "%dd.%mm.%yyyy")
          
          CalendarEx::AddEntry(#Calendar, "Thorsten", "Birthday","", "", CalendarEx::GetDate(18, 12, 2021))

          CalendarEx::AddEntry(#Calendar, "Entry 2",  "2nd appointment", "", "", CalendarEx::GetDate(18, 12, 2021, 8), CalendarEx::GetDate(18, 12, 2021, 11, 15), CalendarEx::#Duration)
          CalendarEx::AddEntry(#Calendar, "Entry 3",  "3rd appointment", "", "", CalendarEx::GetDate(18, 12, 2021, 15, 30), #PB_Default, CalendarEx::#StartTime)

          CalendarEx::AddEntry(#Calendar,      "Holidy", "Holiday: Summer", "", "", CalendarEx::GetDate(27, 12, 2021), CalendarEx::GetDate(9, 1, 2022))
          CalendarEx::SetEntryColor(#Calendar, "Holidy", CalendarEx::#FrontColor, $008000)
          CalendarEx::SetEntryColor(#Calendar, "Holidy", CalendarEx::#BackColor,  $61FFC1)
          CalendarEx::SetEntryMask(#Calendar,  "Holidy",  "Holiday: " + CalendarEx::#StartDate$ + " - " + CalendarEx::#EndDate$)
          
      CompilerEndSelect
      
      ;CalendarEx::Disable(#Calendar)
      
    EndIf
    
    Repeat
      Event = WaitWindowEvent()
      Select Event
        Case CalendarEx::#Event_Gadget ;{ Module Events
          Select EventGadget()  
            Case #Calendar
              Select EventType()
                Case CalendarEx::#EventType_Month
                  ; 
                Case CalendarEx::#EventType_Year
                  
                Case CalendarEx::#EventType_Day
                  Debug "Day: " + Str(EventData())   
                Case CalendarEx::#EventType_Focus
                  Debug "Focus: " + Str(EventData()) 
            EndSelect
          EndSelect ;}
        Case #PB_Event_Menu          ;{ PopupMenu
          Select EventMenu()
            Case  #ExportEvent
              Debug "Export calendar entries: " + FormatDate("%dd/%mm/%yyyy",  CalendarEx::EventDate(#Calendar))
              DayOfMonth.i = CalendarEx::EventDayOfMonth(#Calendar)
              CalendarEx::ExportDay(#Calendar, DayOfMonth, "iCal_Export.ics")
            Case #ShowEntries  
              Debug "Show calendar entries: "
              CalendarEx::EventEntries(#Calendar, Entries())
              ForEach Entries()
                Debug "> " + FormatDate("%dd/%mm/%yyyy",  Entries()\StartDate) + ": " +  Entries()\Summary
              Next
          EndSelect ;}
        Case #PB_Event_Gadget  
          Select EventGadget()
            Case #Calendar           ;{ only in use with EventType()  
              Select EventType()
                Case CalendarEx::#EventType_Month
                  Debug "Select: Month"
                Case CalendarEx::#EventType_Year
                  Debug "Select: Year" 
              EndSelect ;}
          EndSelect  
      EndSelect        
    Until Event = #PB_Event_CloseWindow
    
    ;CalendarEx::SaveColorTheme(#Calendar, "Color.json")
    
    CloseWindow(#Window)
  EndIf 
  
CompilerEndIf



Can you please chgeck this issues?

Thank you and best regards,
Nico
Post Reply