-
Notifications
You must be signed in to change notification settings - Fork 0
/
Elog.au3
1919 lines (1560 loc) · 70.1 KB
/
Elog.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_Icon=radio.ico
#AutoIt3Wrapper_Outfile=..\..\elog.Exe
#AutoIt3Wrapper_Res_Comment=Alpha
#AutoIt3Wrapper_Res_Description=Software for HAM Radio Users
#AutoIt3Wrapper_Res_Fileversion=1.5.4.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_ProductName=Elog
#AutoIt3Wrapper_Res_ProductVersion=1.5.4.1
#AutoIt3Wrapper_Res_CompanyName=GFMsoft
#AutoIt3Wrapper_Res_LegalCopyright=Ferdinand Marx - www.GFMSOFT.de
#AutoIt3Wrapper_Res_LegalTradeMarks=Ferdinand Marx - www.GFMSOFT.de
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; 01.07.2021 - Copyright © by Ferdinand Marx - www.GFMsoft.de / www.13OT4288.com - marx@gfmsoft.de
TraySetState(2)
AutoItSetOption("MustDeclareVars", 1)
;Internal Dokumentation
;~ ##############################################
;Projectstart - 01.07.21 - Target: Easy to use software for HAM-Radio users - Log a QSO easy
;26.07.2021
;Deletefunction created
;Reloadfunction created
;27.07.2021
;Editform complete
;There is a problem with _arraydisplay - This call collides with WM_noity
;Make sure to switch off wm_notify when testing with arrays
;28.07.2021
;Exportfunction is complete - all data can be exported into a csv
;29.07.2021
;Importfunction completed for CLUSTERDX
;Importfunctions for HDX.net and 11dx.net are planned
;30.07.2021
;Colors for edit and main GUI changed
;BG-Pic for editor created
;~ 03.08.2021
;Searchfunction completed
;~ 18.08.2021
;Changed docu to English
;Translated some varnames to english
;Program Version to 1.4.1.2
;Cleaned up the code
;Tested on different hardware and found some problems - all problems are solved
;~ 21.08.2021
;Added convert from locator to longitude and latitude
;Added distance calculation between to coordinates
;Added options.ini and functionality of saving its own locator
;Added options GUI
;~ 27.08.2021
;Added language options
;minor changes to code due some errors
;we had some problems with distance calculations when no remote locator was given
;that problem is solved and 0 km is displayed when the remote locator is empty or incorrect
;Another test is necessary before going into Alpha and releasing on Github
;Planned release is around 10 SEP of 2021
;When an earlier release is possible then go for it
;~ 30.08.2021
; Converted more of the code to a bilangual setting
; All errors and other prompts are now repsonding to the language settings
#Region Includes
;~ ##############################################
;~ _____ _ _ #
;~ |_ _| | | | | #
;~ | | _ __ ___| |_ _ __| | ___ ___ #
;~ | | | '_ \ / __| | | | |/ _` |/ _ \/ __| #
;~ _| |_| | | | (__| | |_| | (_| | __/\__ \ #
;~ |_____|_| |_|\___|_|\__,_|\__,_|\___||___/ #
;~ ##############################################
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <GuiListView.au3>
#EndRegion Includes
#Region ;Main declare of vars
;~ ##############################################
;~ __ __ #
;~ \ \ / / #
;~ \ \ / /_ _ _ __ ___ #
;~ \ \/ / _` | '__/ __| #
;~ \ / (_| | | \__ \ #
;~ \/ \__,_|_| |___/ #
;~ ##############################################
Global $version, $sql_status, $maincounter, $dbh, $ID, $Index_listload, $lastid, $cleardate, $cleartime
Global $searchtermfunc, $editcall, $nMsg, $ownlocator, $qthdistance, $dbsearchterm, $dbsearchdata, $searchquery, $olddbsearchterm
Global $editform, $edit_button1, $edit_button2, $edit_datum, $edit_zeit, $edit_Rufzeichen, $edit_Skip
Global $edit_RX, $edit_TX, $edit_Frequenz, $edit_Operatorname, $edit_Locator, $edit_QTH, $edit_Notiz, $edit_Combo1
Global $edit_label1, $edit_label2, $edit_label3, $edit_label4, $edit_label5, $edit_label6, $edit_label7, $edit_label8, $edit_label13
Global $edit_label9, $edit_label10, $edit_label11, $edit_label12, $edit_pic
Global $QSO, $List1, $Button1, $Button2, $Button3, $Button4, $Button5
Global $Datum, $Zeit, $Rufzeichen, $skip, $RX, $TX, $FREQ, $mode, $Name, $locator, $QTH, $notiz, $label1, $label2
Global $label7, $label8, $label9, $label10, $label11, $label12, $label13, $label14, $label3, $label4, $label5, $label6
Global $searchform, $searchform_Label1, $searchform_Button1, $searchform_Button2, $searchform_Input1, $latitude, $longtitude
Global $settingsform, $settingsform_Input1, $settingsform_Label1, $settingsform_Button1, $settingsform_Button2
Global $r, $settingsform_combo1, $settingsform_Label2, $global_language, $mathpi
#EndRegion ;Main declare of vars
;setting specific values into some vars
$r = 6371000 ;Radius of earth - usually i had this in the func - defined at every call - but this is obviously a const so it goes to global
$cleardate = 0
$cleartime = 0
$lastid = 0
$Index_listload = 0
$maincounter = 0
$sql_status = 0
$version = "1.5.5.1"
$dbsearchterm = ""
$searchtermfunc = ""
$global_language=""
$mathpi = 3.14159
;~ Program init and register WM_Notify event
init()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
;set language
$global_language=IniRead(@ScriptDir&"\settings.ini","Settings","Language","")
if $global_language <> "EN" and $global_language <> "DE" Then
$global_language="DE"
EndIf
;MainGUI
#Region ### START Koda GUI section for Maingui ###
if $global_language = "DE" Then
$QSO = GUICreate("Elog - " & $version, 1025, 645, -1, -1)
GUISetIcon("radio.ico", 0, $QSO)
GUISetBkColor(0x757575, $QSO)
$List1 = GUICtrlCreateListView("ID | Datum | Zeit | Rufzeichen | Skip | RX | TX | FRQ | Mode | Name | Locator | QTH | Notiz", 8, 152, 1009, 474)
$Button1 = GUICtrlCreateButton("Speichern", 818, 24, 110, 49)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
$Button2 = GUICtrlCreateButton("Löschen", 818, 88, 110, 49)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
$Button3 = GUICtrlCreateButton("Optionen", 940 + 11, 60 + 28, 50, 23)
$Button4 = GUICtrlCreateButton("Export", 940 + 11, 95 + 19, 50, 23)
$Button5 = GUICtrlCreateButton("Suche", 940 + 11, 50, 50, 23)
$Datum = GUICtrlCreateInput("", 8, 26, 129, 21)
$Zeit = GUICtrlCreateInput("", 160, 26, 129, 21)
$Rufzeichen = GUICtrlCreateInput("", 8, 71, 129, 21)
$skip = GUICtrlCreateInput("", 160, 71, 129, 21)
$RX = GUICtrlCreateInput("", 312, 71, 73, 21)
$TX = GUICtrlCreateInput("", 400, 71, 73, 21)
$FREQ = GUICtrlCreateInput("", 496, 71, 153, 21)
$mode = GUICtrlCreateCombo("Mode", 672, 71, 121, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "CW|AM|FM|USB|LSB")
$Name = GUICtrlCreateInput("", 8, 117, 129, 21)
$locator = GUICtrlCreateInput("", 160, 117, 129, 21)
$QTH = GUICtrlCreateInput("", 312, 117, 161, 21)
$notiz = GUICtrlCreateInput("", 496, 117, 297, 21)
$label1 = GUICtrlCreateLabel("Datum:", 8, 8, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label2 = GUICtrlCreateLabel("Zeit:", 160, 8, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label4 = GUICtrlCreateLabel("Rufzeichen:", 8, 53, 100, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label5 = GUICtrlCreateLabel("Skip:", 160, 51, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label6 = GUICtrlCreateLabel("RX:", 312, 51, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label7 = GUICtrlCreateLabel("TX:", 400, 51, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label8 = GUICtrlCreateLabel("Frequenz:", 496, 51, 80, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label9 = GUICtrlCreateLabel("Mode:", 672, 51, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label10 = GUICtrlCreateLabel("Operatorname:", 8, 99, 110, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label11 = GUICtrlCreateLabel("Locator:", 160, 99, 80, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label12 = GUICtrlCreateLabel("QTH:", 312, 99, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label13 = GUICtrlCreateLabel("Notiz:", 496, 99, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label14 = GUICtrlCreateLabel("www.GFMsoft.de - Ferdinand Marx - www.13OT4288.com", 10, 628, 500)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
Else
$QSO = GUICreate("Elog - " & $version, 1025, 645, -1, -1)
GUISetIcon("radio.ico", 0, $QSO)
GUISetBkColor(0x757575, $QSO)
$List1 = GUICtrlCreateListView("ID | Date | Time | Callsign | Skip | RX | TX | FRQ | Mode | Name | Locator | QTH | Note", 8, 152, 1009, 474)
$Button1 = GUICtrlCreateButton("Save", 818, 24, 110, 49)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
$Button2 = GUICtrlCreateButton("Delete", 818, 88, 110, 49)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
$Button3 = GUICtrlCreateButton("Options", 940 + 11, 60 + 28, 50, 23)
$Button4 = GUICtrlCreateButton("Export", 940 + 11, 95 + 19, 50, 23)
$Button5 = GUICtrlCreateButton("Search", 940 + 11, 50, 50, 23)
$Datum = GUICtrlCreateInput("", 8, 26, 129, 21)
$Zeit = GUICtrlCreateInput("", 160, 26, 129, 21)
$Rufzeichen = GUICtrlCreateInput("", 8, 71, 129, 21)
$skip = GUICtrlCreateInput("", 160, 71, 129, 21)
$RX = GUICtrlCreateInput("", 312, 71, 73, 21)
$TX = GUICtrlCreateInput("", 400, 71, 73, 21)
$FREQ = GUICtrlCreateInput("", 496, 71, 153, 21)
$mode = GUICtrlCreateCombo("Mode", 672, 71, 121, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "CW|AM|FM|USB|LSB")
$Name = GUICtrlCreateInput("", 8, 117, 129, 21)
$locator = GUICtrlCreateInput("", 160, 117, 129, 21)
$QTH = GUICtrlCreateInput("", 312, 117, 161, 21)
$notiz = GUICtrlCreateInput("", 496, 117, 297, 21)
$label1 = GUICtrlCreateLabel("Date:", 8, 8, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label2 = GUICtrlCreateLabel("Time:", 160, 8, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label4 = GUICtrlCreateLabel("Callsign:", 8, 53, 100, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label5 = GUICtrlCreateLabel("Skip:", 160, 51, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label6 = GUICtrlCreateLabel("RX:", 312, 51, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label7 = GUICtrlCreateLabel("TX:", 400, 51, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label8 = GUICtrlCreateLabel("Freq:", 496, 51, 80, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label9 = GUICtrlCreateLabel("Mode:", 672, 51, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label10 = GUICtrlCreateLabel("Operatorname:", 8, 99, 110, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label11 = GUICtrlCreateLabel("Locator:", 160, 99, 80, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label12 = GUICtrlCreateLabel("QTH:", 312, 99, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label13 = GUICtrlCreateLabel("Note:", 496, 99, 50, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$label14 = GUICtrlCreateLabel("www.GFMsoft.de - Ferdinand Marx - www.13OT4288.com", 10, 628, 500)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
EndIf
#EndRegion ### END Koda GUI section ###
;EditorGUI
#Region ### START Koda GUI section for EditorGUI ###
if $global_language = "DE" Then
$editform = GUICreate("Elog - Editor", 908 - 10, 437 - 60, -1, -1)
GUISetIcon("radio.ico", 0, $editform)
$edit_pic = GUICtrlCreatePic(@ScriptDir & "\bg2.jpg", 0, -50, 908, 437)
GUICtrlSetState($edit_pic, $GUI_DISABLE)
$edit_button1 = GUICtrlCreateButton("Speichern", 758 - 110, 300, 100, 40)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_button2 = GUICtrlCreateButton("Zurück", 758, 300, 100, 40)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_datum = GUICtrlCreateInput("", 40, 40, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_zeit = GUICtrlCreateInput("", 208, 40, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Rufzeichen = GUICtrlCreateInput("", 40, 120, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Skip = GUICtrlCreateInput("", 208, 120, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_RX = GUICtrlCreateInput("", 376, 120, 65, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_TX = GUICtrlCreateInput("", 456, 120, 65, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Frequenz = GUICtrlCreateInput("", 544, 120, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Operatorname = GUICtrlCreateInput("", 40, 192, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Locator = GUICtrlCreateInput("", 208, 192, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_label13 = GUICtrlCreateLabel("Distance: ", 208, 168 + 50, 150, 24)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_QTH = GUICtrlCreateInput("", 376, 192, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Notiz = GUICtrlCreateInput("", 544, 192, 313, 27)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
$edit_Combo1 = GUICtrlCreateCombo("", 704, 120, 153, 35, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "AM|FM|USB|LSB|CW")
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_label1 = GUICtrlCreateLabel("Datum", 40, 16, 52, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label2 = GUICtrlCreateLabel("Zeit", 208, 16, 31, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label3 = GUICtrlCreateLabel("Rufzeichen", 40, 96, 100, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label4 = GUICtrlCreateLabel("Skip", 208, 96, 39, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label5 = GUICtrlCreateLabel("RX", 376, 96, 27, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label6 = GUICtrlCreateLabel("TX", 456, 96, 24, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label7 = GUICtrlCreateLabel("Frequenz", 544, 96, 76, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label9 = GUICtrlCreateLabel("Operatorname", 40, 168, 125, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label10 = GUICtrlCreateLabel("Locator", 208, 168, 62, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label11 = GUICtrlCreateLabel("QTH", 376, 168, 41, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label12 = GUICtrlCreateLabel("Notiz", 544, 168, 44, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label8 = GUICtrlCreateLabel("Mode", 704, 96, 48, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Else
$editform = GUICreate("Elog - Editor", 908 - 10, 437 - 60, -1, -1)
GUISetIcon("radio.ico", 0, $editform)
$edit_pic = GUICtrlCreatePic(@ScriptDir & "\bg2.jpg", 0, -50, 908, 437)
GUICtrlSetState($edit_pic, $GUI_DISABLE)
$edit_button1 = GUICtrlCreateButton("Save", 758 - 110, 300, 100, 40)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_button2 = GUICtrlCreateButton("Back", 758, 300, 100, 40)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_datum = GUICtrlCreateInput("", 40, 40, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_zeit = GUICtrlCreateInput("", 208, 40, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Rufzeichen = GUICtrlCreateInput("", 40, 120, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Skip = GUICtrlCreateInput("", 208, 120, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_RX = GUICtrlCreateInput("", 376, 120, 65, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_TX = GUICtrlCreateInput("", 456, 120, 65, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Frequenz = GUICtrlCreateInput("", 544, 120, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Operatorname = GUICtrlCreateInput("", 40, 192, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Locator = GUICtrlCreateInput("", 208, 192, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_label13 = GUICtrlCreateLabel("Distance: ", 208, 168 + 50, 150, 24)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_QTH = GUICtrlCreateInput("", 376, 192, 145, 27)
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_Notiz = GUICtrlCreateInput("", 544, 192, 313, 27)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
$edit_Combo1 = GUICtrlCreateCombo("", 704, 120, 153, 35, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "AM|FM|USB|LSB|CW")
GUICtrlSetFont(-1, 13, 400, 0, "Arial")
$edit_label1 = GUICtrlCreateLabel("Date", 40, 16, 52, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label2 = GUICtrlCreateLabel("Time", 208, 16, 50, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label3 = GUICtrlCreateLabel("Callsign", 40, 96, 100, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label4 = GUICtrlCreateLabel("Skip", 208, 96, 39, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label5 = GUICtrlCreateLabel("RX", 376, 96, 27, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label6 = GUICtrlCreateLabel("TX", 456, 96, 24, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label7 = GUICtrlCreateLabel("Freq", 544, 96, 76, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label9 = GUICtrlCreateLabel("Operatorname", 40, 168, 125, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label10 = GUICtrlCreateLabel("Locator", 208, 168, 62, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label11 = GUICtrlCreateLabel("QTH", 376, 168, 41, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label12 = GUICtrlCreateLabel("Note", 544, 168, 44, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$edit_label8 = GUICtrlCreateLabel("Mode", 704, 96, 48, 24)
GUICtrlSetFont(-1, 13, 700, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
EndIf
GUISetState(@SW_HIDE, $editform)
#EndRegion ### END Koda GUI section ###
;SearchGUI
#Region ### START Koda GUI section for SearchGUI ###
if $global_language = "DE" Then
$searchform = GUICreate("Elog - Suchen...", 310, 125, -1, -1)
GUISetIcon("radio.ico", 0, $searchform)
GUISetBkColor(0x757575, $searchform)
$searchform_Input1 = GUICtrlCreateInput("", 24, 48 - 7, 249, 21)
$searchform_Label1 = GUICtrlCreateLabel("Suche:", 24, 24 - 7, 100, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$searchform_Label1 = GUICtrlCreateLabel("Bitte nur Rufzeichen eingeben.", 24, 68 - 7, 130, 17)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
$searchform_Button1 = GUICtrlCreateButton("Suchen", 24, 88 - 7, 113, 33)
$searchform_Button2 = GUICtrlCreateButton("Abbrechen", 160, 88 - 7, 113, 33)
Else
$searchform = GUICreate("Elog - Search...", 310, 125, -1, -1)
GUISetIcon("radio.ico", 0, $searchform)
GUISetBkColor(0x757575, $searchform)
$searchform_Input1 = GUICtrlCreateInput("", 24, 48 - 7, 249, 21)
$searchform_Label1 = GUICtrlCreateLabel("Search:", 24, 24 - 7, 100, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$searchform_Label1 = GUICtrlCreateLabel("Only callsigns!", 24, 68 - 7, 130, 17)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
$searchform_Button1 = GUICtrlCreateButton("Search", 24, 88 - 7, 113, 33)
$searchform_Button2 = GUICtrlCreateButton("Abort", 160, 88 - 7, 113, 33)
EndIf
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###
;SettingsGUI
#Region ### START Koda GUI section for SettingsGUI ###
if $global_language = "DE" Then
$settingsform = GUICreate("Elog - Settings", 310, 225, -1, -1)
GUISetIcon("radio.ico", 0, $settingsform)
GUISetBkColor(0x757575, $settingsform)
$settingsform_Input1 = GUICtrlCreateInput("", 24, 48 - 7, 249, 21)
$settingsform_Label1 = GUICtrlCreateLabel("Dein Locator:", 24, 24 - 7, 100, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$settingsform_Label1 = GUICtrlCreateLabel("Bitte Locator mit 6 Zeichen", 24, 68 - 7, 130, 17)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
$settingsform_Button1 = GUICtrlCreateButton("Speichern", 24, 175, 113, 33)
$settingsform_Button2 = GUICtrlCreateButton("Abbrechen", 160, 175 , 113, 33)
$settingsform_Label2 = GUICtrlCreateLabel("Sprache:", 24, 85, 100, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$settingsform_combo1 = GUICtrlCreateCombo("Language",24,110)
GUICtrlSetData($settingsform_combo1,"_______|German|English")
Else
$settingsform = GUICreate("Elog - Settings", 310, 225, -1, -1)
GUISetIcon("radio.ico", 0, $settingsform)
GUISetBkColor(0x757575, $settingsform)
$settingsform_Input1 = GUICtrlCreateInput("", 24, 48 - 7, 249, 21)
$settingsform_Label1 = GUICtrlCreateLabel("Your locator:", 24, 24 - 7, 100, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$settingsform_Label1 = GUICtrlCreateLabel("Only 6 characters long!", 24, 68 - 7, 130, 17)
GUICtrlSetFont(-1, 7, 400, 0, "Arial")
$settingsform_Button1 = GUICtrlCreateButton("Save", 24, 175, 113, 33)
$settingsform_Button2 = GUICtrlCreateButton("Abort", 160, 175 , 113, 33)
$settingsform_Label2 = GUICtrlCreateLabel("Language:", 24, 85, 100, 17)
GUICtrlSetFont(-1, 11, 700, 0, "Arial")
$settingsform_combo1 = GUICtrlCreateCombo("Language",24,110)
GUICtrlSetData($settingsform_combo1,"_______|German|English")
EndIf
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###
;Program initialisation
init_load()
;Showgui after init
GUISetState(@SW_SHOW,$QSO)
;Mainloop
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
If WinActive($editform) = True Or WinActive($searchform) = True Or WinActive($settingsform) = True Then
GUISetState(@SW_HIDE, $editform)
GUISetState(@SW_HIDE, $searchform)
GUISetState(@SW_HIDE, $settingsform)
GUISetState(@SW_SHOW, $QSO)
Else
Exit
EndIf
;Save
Case $Button1
speichern()
;Delete highlighted entry
Case $Button2
loeschen()
;Optionen aufrufen
Case $Button3
GUICtrlSetData($settingsform_Input1, $ownlocator)
GUISetState(@SW_HIDE, $QSO)
GUISetState(@SW_SHOW, $settingsform)
;Save on EDITFORM
Case $edit_button1
edit_save()
;Back on Editform
Case $edit_button2
GUISetState(@SW_HIDE, $editform)
GUISetState(@SW_SHOW, $QSO)
;Export
Case $Button4
export()
;Start searchform
Case $Button5
GUISetState(@SW_HIDE, $QSO)
GUISetState(@SW_SHOW, $searchform)
;Start search
Case $searchform_Button1
$searchtermfunc = GUICtrlRead($searchform_Input1)
search($searchtermfunc)
;Close Searchform
Case $searchform_Button2
GUISetState(@SW_HIDE, $searchform)
GUISetState(@SW_SHOW, $QSO)
;Save on Settingsform
Case $settingsform_Button1
if GUICtrlRead($settingsform_Input1) <> IniRead(@ScriptDir&"\settings.ini","Settings","locator","") Then
If MsgBox(4, "Überschreiben? - Overwrite?", "Möchten Sie wirklich überschreiben?"&@CRLF&"Do you really want to overwrite the locator?") = 6 Then
If StringLen(GUICtrlRead($settingsform_Input1)) = 6 And GUICtrlRead($settingsform_Input1) <> " " Then
IniWrite(@ScriptDir & "\settings.ini", "Settings", "ownlocator", GUICtrlRead($settingsform_Input1))
Else
If GUICtrlRead($settingsform_Input1) = " " Then
MsgBox(16, "Falsche Eingabe! - Wrong input!", "Sie sollten auch Daten eingeben..."&@CRLF&"You should enter some data!")
Else
MsgBox(16, "Falsche Eingabe! - Wrong input!", "Der Locator muss aus 6 Zeichen bestehen!"&@CRLF&"The locator must have 6 characters! Not more - not less!")
EndIf
EndIf
Else
GUICtrlSetData($settingsform_Input1, $ownlocator)
EndIf
EndIf
if GUICtrlRead($settingsform_combo1) <> IniRead(@ScriptDir&"\settings.ini","Settings","Language","") Then
If MsgBox(4, "Überschreiben?", "Möchten Sie wirklich eine neue Sprache einstellen?"&@CRLF&"Do you really want to set a new language?") = 6 Then
if GUICtrlRead($settingsform_combo1) = "English" Then
IniWrite(@ScriptDir&"\settings.ini","Settings","Language","EN")
Else
IniWrite(@ScriptDir&"\settings.ini","Settings","Language","DE")
EndIf
EndIf
EndIf
GUISetState(@SW_HIDE, $settingsform)
GUISetState(@SW_SHOW, $QSO)
;Abort on settingsform
Case $settingsform_Button2
GUISetState(@SW_HIDE, $settingsform)
GUISetState(@SW_SHOW, $QSO)
EndSwitch
;Callsign inputbox monitoring
;If a callsign is given by user start realtime search in DB
If _IsFocused($QSO, $Rufzeichen) And GUICtrlRead($Rufzeichen) <> $olddbsearchterm Then
If GUICtrlRead($Rufzeichen) <> "" Then
$olddbsearchterm = GUICtrlRead($Rufzeichen)
$dbsearchterm = GUICtrlRead($Rufzeichen)
_SQLite_Startup()
$dbh = _SQLite_Open(@ScriptDir & "\Daten\Datenbank.db")
If @error = True Then
MsgBox(16, "SQL-Error - realtime search!", "Code: " & @error & @CRLF & "Extended: " & @extended)
EndIf
_SQLite_Query($dbh, "select * from daten where rufzeichen like '" & $dbsearchterm & "'", $searchquery)
While _SQLite_FetchData($searchquery, $dbsearchdata) = $SQLITE_OK
GUICtrlSetData($skip, $dbsearchdata[4])
GUICtrlSetData($Name, $dbsearchdata[9])
GUICtrlSetData($locator, $dbsearchdata[10])
GUICtrlSetData($QTH, $dbsearchdata[11])
WEnd
_SQLite_QueryFinalize($searchquery)
EndIf
_SQLite_Close($dbh)
_SQLite_Shutdown()
EndIf
;Autocomplete DATE and TIME when focussed
;####################################################################################
If _IsFocused($QSO, $Datum) And $cleardate = 0 Then
GUICtrlSetData($Datum, @MDAY & "." & @MON & "." & @YEAR)
$cleardate = 1
EndIf
If _IsFocused($QSO, $Zeit) And $cleartime = 0 Then
GUICtrlSetData($Zeit, @HOUR & ":" & @MIN)
$cleartime = 1
EndIf
;####################################################################################
WEnd ;--> Mainlooop end
;Functions
;Program-initialisation
Func init()
Local $dbcheck
;Check if bgpic for editform existent - if not then install
If FileExists(@ScriptDir & "\bg2.jpg") = False Then
FileInstall("bg2.jpg", "bg2.jpg")
EndIf
;Check if radio.ico existent - if not then install
If FileExists(@ScriptDir & "\radio.ico") = False Then
FileInstall("radio.ico", "radio.ico")
EndIf
;Check if sqlite.dll existent - if not then install
If FileExists(@ScriptDir & "\sqlite3.dll") = False Then
FileInstall("sqlite3.dll", "sqlite3.dll")
EndIf
;If sqlite3.dll still not in @scriptdir then exit
;Prompt critical error
If FileExists(@ScriptDir & "\sqlite3.dll") = False Then
MsgBox(64, "Fehler - SQLITe3.dll", "sqlite3.dll liegt nicht im Programmverzeichnis! - Bitte runterladen und ins Programmverzeichnis legen!")
MsgBox(64, "Error - SQLITe3.dll", "sqlite3.dll cant be found in >"&@ScriptDir&"< - Please download the sqlite3.dll manually and place it there!")
Exit
EndIf
;Load SQL-Engine
$sql_status = _SQLite_Startup("sqlite3.dll", 1)
If @error = True Then
MsgBox(16,"SQL-Engine ERROR","Error while loading the SQL-Engine!"&@CRLF&"This is a critical error!")
Exit
EndIf
;Check database path - create pathstructure if not existent
If FileExists(@ScriptDir & "\daten") = False Then
DirCreate(@ScriptDir & "\daten")
EndIf
If FileExists(@ScriptDir & "\Daten\Datenbank.db") = False Then
$dbh = _SQLite_Open(@ScriptDir & "\Daten\Datenbank.db")
If @error = True Then
MsgBox(16, "Fehler - SQLDatabase", "Code: " & @error & @CRLF & "Extended: " & @extended)
Exit
EndIf
$dbcheck = _SQLite_Exec($dbh, "CREATE Table Daten (ID,datum,zeit,rufzeichen,skip,rx,tx,frequenz,mode,operatorname,locator,qth,notiz,delmark);")
If $dbcheck = $SQLITE_OK Then
;Hier test wert ausgabe möglich
;Here is some room for some foo - checks - or more foo
Else
MsgBox(16, "Fehler - SQL", "Table Daten konnten nicht geschrieben werden!" & @CRLF & "Fehlermeldung: " & @error)
MsgBox(16, "Error- SQL", "Database is unwriteable - This error is critical!" & @CRLF & "Error: " & @error)
Exit
EndIf
EndIf
_SQLite_Close($dbh)
_SQLite_Shutdown()
;Check for own locator in settings.ini - if not existent init everything
If FileExists(@ScriptDir & "\settings.ini") = False Then
IniWrite(@ScriptDir & "\settings.ini", "Settings", "ownlocator", "")
Sleep(500)
$ownlocator = InputBox("Enter your locator", "Please enter your locator (6 characters)!", "")
If StringLen($ownlocator) <> 6 Or $ownlocator = " " Then
MsgBox(16, "Your entry was not correct!", "Your Locator is set to 0 - distances can't be calculated!" & @CRLF & "You can change your locator under settings.")
Else
IniWrite(@ScriptDir & "\settings.ini", "Settings", "ownlocator", $ownlocator)
EndIf
Else
;Load ownlocator from settings.ini for later calculations
$ownlocator = IniRead(@ScriptDir & "\settings.ini", "Settings", "ownlocator", "")
EndIf
;check if os is in en language - if not then set language to german
if IniRead(@ScriptDir&"\settings.ini","Settings","Language","") = "" Then
if @OSLang = 0409 Then
IniWrite(@ScriptDir&"\settings.ini","Settings","Language","EN")
Else
IniWrite(@ScriptDir&"\settings.ini","Settings","Language","DE")
EndIf
Else
if IniRead(@ScriptDir&"\settings.ini","Settings","Language","") = "EN" Then
$global_language="EN"
GUICtrlSetData($settingsform_combo1,"English")
ConsoleWrite("LAN SET TO EN"&@CRLF)
Else
$global_language="DE"
GUICtrlSetData($settingsform_combo1,"AAA","LOLOLOL")
ConsoleWrite("LAN SET TO DE"&@CRLF)
EndIf
EndIf
EndFunc ;==>init
;This function loads all data from the database into the listbox - CALL THIS FUNC ONLY ONCE FROM INIT
Func init_load()
;Declare vars
Local $query, $dbdata, $i, $temparray
;set expected and needed values
$i = 1
$Index_listload = 0
;Delete all items in Listview for cleaning purposes
_GUICtrlListView_DeleteAllItems($List1)
;Load sqlengine und start reading the database - also putting the incoming data into the Listview
_SQLite_Startup()
$dbh = _SQLite_Open(@ScriptDir & "\Daten\Datenbank.db")
If @error = True Then
MsgBox(16, "Fehler - SQLDatenbank", "Fehlerocode: " & @error & @CRLF & "Extended: " & @extended)
Return 0
EndIf
_SQLite_Query($dbh, "select * from Daten", $query)
While _SQLite_FetchData($query, $dbdata) = $SQLITE_OK
;Upcoming code was for debugging - leave it - maybe we need it when we develop additions
;~ _ArrayDisplay($dbdata)
;~ (ID,Datum,Zeit,rufzeichen,skip,rx,tx,frequenz,mode,operatorname,locator,qth,notiz,delmark);")
; So kommen die Daten zurück
;~ Row|Col 0
;~ [0]|ID
;~ [1]|DATUM
;~ [2]|ZEIT
;~ [3]|RUFZEICHEN
;~ [4]|SKIP
;~ [5]|RX
;~ [6]|TX
;~ [7]|FREQUENZ
;~ [8]|MODE
;~ [9]|OPERATORNAME
;~ [10]|LOCATOR
;~ [11]|QTH
;~ [12]|NOTIZ
;~ [13]|delmark
;Put data from database into listview
If $dbdata[13] = "False" Then
_GUICtrlListView_AddItem($List1, $dbdata[0], $Index_listload)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[1], 1, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[2], 2, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[3], 3, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[4], 4, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[5], 5, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[6], 6, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[7], 7, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[8], 8, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[9], 9, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[10], 10, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[11], 11, 1)
_GUICtrlListView_AddSubItem($List1, $Index_listload, $dbdata[12], 12, 1)
;Count the internal counter 1 up! - Dont you dare to touch my while loop!
$Index_listload = $Index_listload + 1
EndIf
WEnd
;Finishing the SQ query and closing the database - closing the SQLITe.dll afterwards
_SQLite_QueryFinalize($query)
_SQLite_Close($dbh)
_SQLite_Shutdown()
;Refreshing the width of the listview
;if width of column 1,4,5,9,10,11,12 under 80px its sets it to 80px
_GUICtrlListView_SetColumnWidth($List1, 1, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth($List1, 4, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth($List1, 5, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth($List1, 9, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth($List1, 10, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth($List1, 11, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth($List1, 12, $LVSCW_AUTOSIZE)
if _GUICtrlListView_GetColumnWidth($List1,1) < 80 Then
_GUICtrlListView_SetColumnWidth($List1, 1, 80)
EndIf
if _GUICtrlListView_GetColumnWidth($List1,4) < 80 Then
_GUICtrlListView_SetColumnWidth($List1, 4, 80)
EndIf
if _GUICtrlListView_GetColumnWidth($List1,5) < 80 Then
_GUICtrlListView_SetColumnWidth($List1, 5, 50)
EndIf
if _GUICtrlListView_GetColumnWidth($List1,9) < 80 Then
_GUICtrlListView_SetColumnWidth($List1, 9, 80)
EndIf
if _GUICtrlListView_GetColumnWidth($List1,10) < 80 Then
_GUICtrlListView_SetColumnWidth($List1, 10, 80)
EndIf
if _GUICtrlListView_GetColumnWidth($List1,11) < 80 Then
_GUICtrlListView_SetColumnWidth($List1, 11, 80)
EndIf
if _GUICtrlListView_GetColumnWidth($List1,12) < 80 Then
_GUICtrlListView_SetColumnWidth($List1, 12, 180)
EndIf
EndFunc ;==>init_load
;This function is for testing only.
;Delete this function when testing is finished
Func testeintrag()
Local $dbcheck
_SQLite_Startup()
$dbh = _SQLite_Open(@ScriptDir & "\Daten\Datenbank.db")
If @error = True Then
MsgBox(16, "Fehler - SQLDatenbank", "Fehlerocode: " & @error & @CRLF & "Extended: " & @extended)
Return 0
EndIf
;Variablen für Testeintrag füllen
$ID = 1
$Datum = "04.02.2021"
$Zeit = "12:15"
$Rufzeichen = "13OT4288"
$skip = "UKO"
$RX = "5/5"
$TX = "5/9"
$FREQ = "27.505"
$mode = "USB"
$Name = "jean paul"
$locator = "JOPL5"
$QTH = "Berlin"
$notiz = "Sehr cooler Testkontakt mit Jean Paul. Er hat auch alles verstanden. Erster Kontakt mit der Außenwelt seit Jahren!"
$dbcheck = _SQLite_Exec($dbh, "insert into Daten(ID,Datum,Zeit,rufzeichen,skip,rx,tx,frequenz,mode,operatorname,locator,qth,notiz,delmark) values ('" & $ID & "','" & $Datum & "','" & $Zeit & "','" & $Rufzeichen & "','" & $skip & "','" & $RX & "','" & $TX & "','" & $FREQ & "','" & $mode & "','" & $Name & "','" & $locator & "','" & $QTH & "','" & $notiz & "','False');")
;~ (ID,Datum,Zeit,rufzeichen,skip,rx,tx,frequenz,mode,operatorname,locator,qth,notiz,delmark)
;~ ('" & $lastid & "','" & GUICtrlRead($Form5_Date1) & "','" & GUICtrlRead($Form5_Combo1) & "','" & GUICtrlRead($Form5_Input1) & "','" & GUICtrlRead($Form5_Input2) & "','" & GUICtrlRead($Form5_Input3) & "','" & GUICtrlRead($Form5_Input4) & "','" & GUICtrlRead($Form5_Edit1) & "','" & $gender & "','" & GUICtrlRead($Form5_Input5) & "','False');")
EndFunc ;==>testeintrag
;This function saves a new entry in database
Func speichern()
;declare vars
Local $query, $dbdata, $fehlergrenze, $dbcheck
Local $id_data, $Datum_data, $zeit_data, $Rufzeichen_data, $skip_data, $rx_data, $tx_data
Local $FREQ_data, $Mode_data, $Name_data, $Locator_data, $QTH_data, $Notiz_data
;set values
$fehlergrenze = 0
$query = ""
$dbdata = ""
;Some testing and preventing erros
if $global_language = "DE" Then
If GUICtrlRead($Datum) = "" Then
MsgBox(64, "Datum eingeben", "Bitte geben Sie ein Datum ein.")
Return 0
EndIf
If GUICtrlRead($Zeit) = "" Then
MsgBox(64, "Zeit eingeben", "Bitte geben Sie eine Uhrzeit an.")
Return 0
EndIf
If GUICtrlRead($Rufzeichen) = "" Then
MsgBox(64, "Rufzeichen angeben", "Bitte geben Sie das Rufzeichen Ihres Gesprächspartners an.")
Return 0
EndIf
If GUICtrlRead($FREQ) = "" Then
MsgBox(64, "Frequenz angeben", "Bitte geben Sie eine Frequenz an.")
Return 0
EndIf
If GUICtrlRead($mode) = "" Or GUICtrlRead($mode) = "Mode" Then
MsgBox(64, "Modus angeben", "Bitte geben Sie einen Modus (AM/FM/SSB) an.")
ConsoleWrite("Modus: " & GUICtrlRead($mode) & @CRLF)
Return 0
EndIf
Else
If GUICtrlRead($Datum) = "" Then
MsgBox(64, "Please set a date", "Please type in a correct date.")
Return 0
EndIf
If GUICtrlRead($Zeit) = "" Then
MsgBox(64, "Please set a time", "Please type in a correct time.")
Return 0
EndIf
If GUICtrlRead($Rufzeichen) = "" Then
MsgBox(64, "Please set a callsign", "Please type in a correct callsign of your QSO-Partner.")
Return 0
EndIf
If GUICtrlRead($FREQ) = "" Then
MsgBox(64, "Please set a Frequency", "Please type in a correct frequency.")
Return 0
EndIf
If GUICtrlRead($mode) = "" Or GUICtrlRead($mode) = "Mode" Then
MsgBox(64, "Set mode!", "Please set a correct mode (AM/FM/SSB).")
ConsoleWrite("Modus: " & GUICtrlRead($mode) & @CRLF)
Return 0
EndIf
EndIf
;GET LAST ID
_SQLite_Startup()
$dbh = _SQLite_Open(@ScriptDir & "\Daten\Datenbank.db")
If @error = True Then
MsgBox(16, "Error - GET LAST ID!", "Code: " & @error & @CRLF & "Extended: " & @extended)
Return
EndIf
_SQLite_Query($dbh, "select count(*) from daten", $query)
While _SQLite_FetchData($query, $dbdata) = $SQLITE_OK
$lastid = $dbdata[0]
WEnd
_SQLite_QueryFinalize($query)
;Gather data
;Write data into database
$id_data = $lastid + 1
$Datum_data = GUICtrlRead($Datum)
$zeit_data = GUICtrlRead($Zeit)
$Rufzeichen_data = GUICtrlRead($Rufzeichen)
$skip_data = GUICtrlRead($skip)
$rx_data = GUICtrlRead($RX)
$tx_data = GUICtrlRead($TX)
$FREQ_data = GUICtrlRead($FREQ)
$Mode_data = GUICtrlRead($mode)
$Name_data = GUICtrlRead($Name)
$Locator_data = GUICtrlRead($locator)
$QTH_data = GUICtrlRead($QTH)
$Notiz_data = GUICtrlRead($notiz)
$dbcheck = _SQLite_Exec($dbh, "insert into Daten(ID,Datum,Zeit,rufzeichen,skip,rx,tx,frequenz,mode,operatorname,locator,qth,notiz,delmark) values ('" & $id_data & "','" & $Datum_data & "','" & $zeit_data & "','" & $Rufzeichen_data & "','" & $skip_data & "','" & $rx_data & "','" & $tx_data & "','" & $FREQ_data & "','" & $Mode_data & "','" & $Name_data & "','" & $Locator_data & "','" & $QTH_data & "','" & $Notiz_data & "','False');")