1 (edited by sparrow 2023-07-27 18:15:18)

Topic: CustomCalendar

Hi,


Custom calendar on the example of account movement.


Month ahead / back.
Select / unselect a date.
Highlight the desired dates in the script. Highlighting works in themes.
Show/hide calendar.
Several main languages for the days of the week.
Everything where the cursor changes can be clicked.
Some elements have hints.


Perhaps it will be interesting for your projects.

Post's attachments

Attachment icon CB5.zip 414.46 kb, 147 downloads since 2023-07-27 

Re: CustomCalendar

Hi Sparrow,


Great stuff........
Thank you very much for sharing...
Keep'm coming.......

Adam
God... please help me become the person my dog thinks I am.

Re: CustomCalendar

Thanks Destiny.


I have separated the main code and the calendar code. Now the main script is not so scary. )))
Separated the query for forming dates and the query for coloring.
The procedures for coloring and working with the table filter remained in the main code.


All calendar elements are created automatically, there is only an empty panel on the form.
You can change some settings in the calendar code variables.
In particular the grid size to adjust the calendar size, color change, panel name and table name.
Added a description of the procedures.

Post's attachments

Attachment icon CustCalend2.zip 422.24 kb, 174 downloads since 2023-07-29 

4 (edited by k245 2023-07-31 13:05:18)

Re: CustomCalendar

Hello!

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=9743&download=0

I did something similar, but as part of a workflow project. If anyone is interested, a description of the project and a link to the project itself is here: https://docs.google.com/document/d/1-GE … dcxnc/edit

Article in Russian (2021), if anyone is interested, I can translate the article and remaster the project.

Post's attachments

Attachment icon изображение_2023-07-31_155443245.png 82.78 kb, 24 downloads since 2023-07-31 

Визуальное программирование: блог и телеграм-канал.

5 (edited by sparrow 2023-08-31 18:55:47)

Re: CustomCalendar

I tried using markers in the built-in calendar and this is what came out of it.
A small description in the script.

Post's attachments

Attachment icon Calendar.zip 430.01 kb, 96 downloads since 2023-08-31 

Re: CustomCalendar

Beautiful work. Is there a way to modify it to show in the calendar a sign (like a red underline) when choosin a record  in the tablegrid in α specific date ??

Re: CustomCalendar

As far as I understood you, are you interested in the reverse
process from the table to the calendar? 
Fundamentally possible. 
I'll try to prepare an example. 
Once already draws, then you can draw.

8 (edited by v_pozidis 2023-09-01 19:45:29)

Re: CustomCalendar

No forgive my English. I like the same procedure, but only if the there is a record in the in the tablegrid. please feel free to modify my attached example

Post's attachments

Attachment icon Myexample.zip 325.36 kb, 83 downloads since 2023-09-01 

Re: CustomCalendar

Here is my example.

Post's attachments

Attachment icon Cal tblgr.zip 424.41 kb, 98 downloads since 2023-09-01 

10 (edited by v_pozidis 2023-09-01 21:37:46)

Re: CustomCalendar

What I mean is if I have only an edit box and not the two currency records. How can it work ???

Re: CustomCalendar

If I understand you correctly, there are only two fields in your database (date and text).


Hope you read the USER QUERY SECTION comment in the script.
In this section, you can write your own query to interact with your table in the database.

// ---------------------------------------- USER QUERY SECTION ----------------------------------------
// --- You can write a query to your table.
// --- The output field names (alias) MUST BE "acdate" and "n".
// --- "acdate" - Date fields without time
// --- "n" - operation ( 0 - none, 1 - income, 2 - outcome, 3 - inc/outc ) This use for tablegrid colorize
// --- This subquery results is join with the generated dates to colorize the calendar by events.
// ----------------------------------------------------------------------------------------------------
  QueryUsrTbl := '(SELECT '+
    'DATE(Dt) AS acdate, '+
    'CASE WHEN SUM(Inc)>0 AND SUM(Out)=0 THEN 1 WHEN SUM(Inc)=0 AND SUM(Out)>0 THEN 2 ELSE 3 END AS n '+
    'FROM Account '+
    'WHERE Inc <> 0 OR Out <> 0 GROUP BY 1 ORDER BY 1)';

For example, I changed the query. Now he works with the field "Dt" (date) and the field "Out" (expense).
At the output of the query, all dates where the expense field is not empty.
Underlined in red only.

  QueryUsrTbl := '(SELECT '+
    'DATE(Dt) AS acdate, '+
    '2 AS n '+
    'FROM Account '+
    'WHERE Out <> '''' GROUP BY 1 ORDER BY 1)';

Re: CustomCalendar

Hi k245,


It'd be great if you could translate the application...
I have translated the article using Google which is good enough for me. However, no success with translating of the application.


k245 wrote:

Hello!

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=9743&amp;download=0

I did something similar, but as part of a workflow project. If anyone is interested, a description of the project and a link to the project itself is here: https://docs.google.com/document/d/1-GE … dcxnc/edit

Article in Russian (2021), if anyone is interested, I can translate the article and remaster the project.

Adam
God... please help me become the person my dog thinks I am.

Re: CustomCalendar

Мне нравится. но я пока в скриптах ноль. Когда я в таблицу попробовал добавить еще поле, то на выходе получил ошибку в 216 строке

linN := linN + tmpStep;

. Получается свои поля я добавить уже не могу?

Re: CustomCalendar

Any of the examples allows you to add fields to a database table without
changing the script and queries, or change the table to your own.
The second option requires some knowledge of the scripting language
and the SQL language.
Some database fields are required (eg date).

Re: CustomCalendar

Good health. I have such a question about the calendar. It turns out that he has a kind of rigid binding to the date. that is, in this form I am creating another table in which I want to highlight past dates from another DateTimePicker in color. And so. My script does not want to work with this date, swears at the error, but everything is fine with the date that is linked to the calendar. Is it treated somehow?