-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFileSelectorDialog.frm
More file actions
1243 lines (1105 loc) · 31.9 KB
/
FileSelectorDialog.frm
File metadata and controls
1243 lines (1105 loc) · 31.9 KB
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
VERSION 5.00
Begin VB.Form LoadFile
AutoRedraw = -1 'True
BackColor = &H003B3B3B&
BorderStyle = 0 'None
ClientHeight = 8145
ClientLeft = 0
ClientTop = 0
ClientWidth = 3690
BeginProperty Font
Name = "Arial"
Size = 14.25
Charset = 161
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Icon = "FileSelectorDialog.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 8145
ScaleWidth = 3690
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin M2000.gList gList1
Height = 3600
Left = 135
TabIndex = 0
Top = 720
Width = 3420
_ExtentX = 6033
_ExtentY = 6350
Max = 1
Vertical = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 11.25
Charset = 161
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Enabled = -1 'True
dcolor = 65535
Backcolor = 3881787
ForeColor = 14737632
CapColor = 9797738
End
Begin M2000.gList gList2
Height = 495
Left = 135
TabIndex = 1
TabStop = 0 'False
Top = 180
Width = 3420
_ExtentX = 6033
_ExtentY = 873
Max = 1
Vertical = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 14.25
Charset = 161
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Enabled = -1 'True
Backcolor = 3881787
ForeColor = 16777215
CapColor = 16777215
End
Begin M2000.gList glist3
Height = 375
Left = 180
TabIndex = 2
Top = 7635
Width = 3420
_ExtentX = 6033
_ExtentY = 661
Max = 1
Vertical = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 11.25
Charset = 161
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Enabled = -1 'True
Backcolor = 8421504
ForeColor = 14737632
CapColor = 49344
End
End
Attribute VB_Name = "LoadFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function CopyFromLParamToRect Lib "user32" Alias "CopyRect" (lpDestRect As RECT, ByVal lpSourceRect As Long) As Long
Private noChangeColorGlist3 As Boolean
Public WithEvents mySelector As FileSelector, previewKey As Boolean
Attribute mySelector.VB_VarHelpID = -1
Private Declare Function DestroyCaret Lib "user32" () As Long
Dim height1 As Long, width1 As Long
Public TEXT1 As myTextBox
Attribute TEXT1.VB_VarHelpID = -1
Private Type myImage
Image As StdPicture
Height As Long
Width As Long
top As Long
Left As Long
End Type
Private ShearchList As String
Dim Image1 As myImage
Dim iTop As Long, iLeft As Long, iwidth As Long, iheight As Long
Dim nopreview As Boolean
Dim oldLeftMarginPixels As Long
Dim firstpath As Long
Dim setupxy As Single
Dim Lx As Long, lY As Long, dr As Boolean
Dim scrTwips As Long
Dim bordertop As Long, borderleft As Long
Dim allwidth As Long, itemWidth As Long
Dim dirlistindex As Long
Dim dirlisttop As Long
Dim ihave As Boolean
Private LastActive As String
Private Sub Form_Activate()
On Error Resume Next
If LastActive = vbNullString Then LastActive = gList1.Name
If HOOKTEST <> 0 Then UnHook HOOKTEST
If Typename(ActiveControl) = "gList" Then
Hook hWnd, ActiveControl
Else
Hook hWnd, Nothing
End If
If LastActive <> "" Then
If Controls(LastActive).enabled Then
If Controls(LastActive).Visible Then Controls(LastActive).SetFocus
End If
End If
End Sub
Private Sub Form_Deactivate()
UnHook hWnd
End Sub
Private Sub Form_Load()
height1 = 8145 * DYP / 15
width1 = 3690 * DXP / 15
'UnHook3 hWnd
loadfileiamloaded = True
scrTwips = Screen.TwipsPerPixelX
' clear data...
setupxy = 20
Set mySelector = New FileSelector
gList3.LeaveonChoose = True
gList3.VerticalCenterText = True
gList3.restrictLines = 1
gList3.PanPos = 0
firstpath = False
nopreview = False
oldLeftMarginPixels = 0
gList2.CapColor = rgb(255, 160, 0)
gList2.HeadLine = vbNullString
gList2.FloatList = True
gList2.MoveParent = True
gList3.NoPanRight = False
gList1.NoPanLeft = False
Set TEXT1 = New myTextBox
Set TEXT1.Container = gList3
nopreview = True
'fHeight = gList1.Height
Set mySelector = New FileSelector
With mySelector
Set .glistN = gList1
Set .TEXT1 = TEXT1
gList1.NoCaretShow = True
.NostateDir = True
End With
If SetUp = SetUpGR Then
With gList1
.VerticalCenterText = True
.additemFast "Ôáîéíüìçóç êáôÜ"
.menuEnabled(0) = False
.additemFast " ×ñïíïóÞìáíóç"
.additemFast " ¼íïìá"
.additemFast " Ôýðï"
.MenuItem 2, False, True, False, "time"
.MenuItem 3, False, True, False, "name"
.MenuItem 4, False, True, False, "type"
.AddSep
.additemFast "Ðáñïõóßáóç"
.menuEnabled(5) = False
.additemFast " ¸íá öÜêåëï"
.additemFast " ¸ùò 3 öáêÝëïõò"
.additemFast " ×ùñßò üñéï"
.MenuItem 7, True, True, False, "normal"
.MenuItem 8, True, True, False, "3levels"
.MenuItem 9, True, True, False, "recur"
.AddSep
.additemFast "ÓõìðåñéöïñÜ"
.menuEnabled(10) = False
.additemFast " Óðñþîå ôç ëßóôá"
.additemFast " ÐïëëáðëÞ ÅðéëïãÞ"
.additemFast " ÅðÝêôáóç ÐëÜôïõò"
.MenuItem 12, True, False, False, "push"
.MenuItem 13, True, False, False, "multi"
.MenuItem 14, True, False, False, "expand"
.AddSep
.additemFast "ÐÝôá ôéò ÁëëáãÝò"
.additemFast "ÓôáìÜôá êáé êëåßóå"
.AddSep
.additemFast "Ðëçñïöïñßåò"
.menuEnabled(18) = False
.additemFast "êýëéóå äåîéÜ ôï êÜôù"
.menuEnabled(19) = False
.additemFast "ðëáßóéï ãéá åðéëïãÞ Þ"
.menuEnabled(20) = False
.additemFast "ìå äéðëü êëéê óôç ëßóôá"
.menuEnabled(21) = False
.AddSep
.additemFast "Ãéþñãïò ÊáññÜò 2014-2025"
.menuEnabled(23) = False
oldLeftMarginPixels = .LeftMarginPixels + 10
.LeftMarginPixels = 0
PlaceSettings
ReadSettings
End With
Else
With gList1
.VerticalCenterText = True
.additemFast "Sort Type"
.menuEnabled(0) = False
.additemFast " By Time Stamp"
.additemFast " By Name"
.additemFast " By Type"
.MenuItem 2, False, True, False, "time"
.MenuItem 3, False, True, False, "name"
.MenuItem 4, False, True, False, "type"
.AddSep
.additemFast "Performance"
.menuEnabled(5) = False
.additemFast " Normal"
.additemFast " Recursive 3 levels"
.additemFast " Recursive"
.MenuItem 7, True, True, False, "normal"
.MenuItem 8, True, True, False, "3levels"
.MenuItem 9, True, True, False, "recur"
.AddSep
.additemFast "Behavior"
.menuEnabled(10) = False
.additemFast " Push to Scroll"
.additemFast " MultiSelect"
.additemFast " Expand Width"
.MenuItem 12, True, False, False, "push"
.MenuItem 13, True, False, False, "multi"
.MenuItem 14, True, False, False, "expand"
.AddSep
.additemFast "Undo Changes"
.additemFast "Abord and Exit"
.AddSep
.additemFast "Information"
.menuEnabled(18) = False
.additemFast "slide right in the textbox"
.menuEnabled(19) = False
.additemFast "down side to return file"
.menuEnabled(20) = False
.additemFast "or double click the file list"
.menuEnabled(21) = False
.AddSep
.additemFast "George Karras 2014-2025"
.menuEnabled(23) = False
oldLeftMarginPixels = .LeftMarginPixels + 10
.LeftMarginPixels = 0
PlaceSettings
ReadSettings
End With
End If
With mySelector
.NostateDir = False
lastfactor = ScaleDialogFix(SizeDialog)
If ExpandWidth Then
If LastWidth = 0 Then LastWidth = -1
Else
LastWidth = -1
End If
ScaleDialog lastfactor, DialogPreview, LastWidth
''UserFileName = .Mydir.ExtractName(UserFileName)
UserFileName = vbNullString
.FileTypesToDisplay = FileTypesShow
.Mydir.Nofiles = FolderOnly
.Mydir.TopFolder = TopFolder
If ReturnFile <> "" Then
UserFileName = .Mydir.ExtractName(ReturnFile)
.selectedFile = .Mydir.ExtractName(ReturnFile)
gList3.ShowMe
.FilePath = ExtractPath(ReturnFile, True)
If .TEXT1 <> .Mydir.ExtractName(ReturnFile) Then .TEXT1 = .Mydir.ExtractName(ReturnFile)
ReturnFile = vbNullString
Else
.FilePath = ExtractPath(TopFolder)
End If
End With
If FolderOnly Then
gList2.HeadLine = SelectFolderCaption
ElseIf SaveDialog Then
gList2.HeadLine = SaveFileCaption
Else
gList2.HeadLine = LoadFileCaption
End If
gList2.HeadlineHeight = gList2.HeightPixels
gList2.SoftEnterFocus
If selectorLastX = -1 And selectorLastY = -1 Then
Else
move selectorLastX, selectorLastY
End If
'If TEXT1 <> "" Then
TEXT1.locked = False
gList3.ListIndex = 0
gList3.SoftEnterFocus
If gList1.Value <> gList1.ListIndex Then
gList1.Spinner = True
gList1.Value = gList1.ListIndex
gList1.Spinner = False
End If
End Sub
Public Sub UNhookMe()
Set LastGlist = Nothing
UnHook hWnd
End Sub
Private Sub Form_LostFocus()
If HOOKTEST <> 0 Then
UnHook hWnd
End If
End Sub
Private Sub Form_MouseDown(Button As Integer, shift As Integer, X As Single, Y As Single)
If Button = 1 Then
If lastfactor = 0 Then lastfactor = 1
If bordertop < 150 Then
If (Y > Height - 150 And Y < Height) And (X > Width - 150 And X < Width) Then
dr = True
MousePointer = vbSizeNWSE
Lx = X
lY = Y
End If
Else
If (Y > Height - bordertop And Y < Height) And (X > Width - borderleft And X < Width) Then
dr = True
MousePointer = vbSizeNWSE
Lx = X
lY = Y
End If
End If
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, shift As Integer, X As Single, Y As Single)
Dim addX As Long, addy As Long, factor As Single, once As Boolean
If once Then Exit Sub
If Button = 0 Then dr = False
If bordertop < 150 Then
If (Y > Height - 150 And Y < Height) And (X > Width - 150 And X < Width) Then MousePointer = vbSizeNWSE Else MousePointer = 0
Else
If (Y > Height - bordertop And Y < Height) And (X > Width - borderleft And X < Width) Then MousePointer = vbSizeNWSE Else MousePointer = 0
End If
If dr Then
If Y < (Height - bordertop) Or Y > Height Then addy = (Y - lY)
If X < (Width - borderleft) Or X > Width Then addX = (X - Lx)
If Not ExpandWidth Then addX = 0
If lastfactor = 0 Then lastfactor = 1
factor = lastfactor
once = True
If Height > VirtualScreenHeight() Then addy = -(Height - VirtualScreenHeight()) + addy
If Width > VirtualScreenWidth() Then addX = -(Width - VirtualScreenWidth()) + addX
If (addy + Height) / height1 > 0.4 And ((Width + addX) / width1) > 0.4 Then
If addy <> 0 Then
If ((addy + Height) / height1) > VirtualScreenHeight() Then
addX = 0
addy = 0
Else
SizeDialog = ((addy + Height) / height1)
End If
End If
lastfactor = ScaleDialogFix(SizeDialog)
If ((Width * lastfactor / factor + addX) / Height * lastfactor / factor) < (width1 / height1) Then
addX = -Width * lastfactor / factor - 1
End If
If addX = 0 Then
If lastfactor <> factor Then ScaleDialog lastfactor, DialogPreview, Width
Lx = X
Else
Lx = X * lastfactor / factor
ScaleDialog lastfactor, DialogPreview, (Width + addX) * lastfactor / factor
End If
LastWidth = Width
gList2.HeadlineHeight = gList2.HeightPixels
gList2.PrepareToShow
mySelector.ResetHeightSelector
gList1.PrepareToShow
lY = lY * lastfactor / factor
'End If
End If
Else
Lx = X
lY = Y
End If
once = False
End Sub
Private Sub Form_MouseUp(Button As Integer, shift As Integer, X As Single, Y As Single)
If dr Then Me.MousePointer = 0
dr = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
UNhookMe
DestroyCaret
Dim I As Long, filetosave As String
If mySelector.mselChecked Then
ReturnListOfFiles = vbNullString
With mySelector
For I = 0 To .Mydir.listcount - 1
' prepare list for files
If .Mydir.ReadMark(I) Then
If .recnowchecked Then
filetosave = .Mydir.FindFolder(I) + .Mydir.list(I)
Else
filetosave = .Mydir.path + .Mydir.list(I)
End If
If ReturnListOfFiles = vbNullString Then
ReturnListOfFiles = filetosave
Else
ReturnListOfFiles = ReturnListOfFiles + "#" + filetosave
End If
End If
Next I
End With
ElseIf FolderOnly Then
If ReturnFile <> "" Then
If Not mySelector.Mydir.isdir(ReturnFile) Then MakeFolder ReturnFile
If Not mySelector.Mydir.isdir(ReturnFile) Then ReturnFile = vbNullString
End If
End If
Set Image1.Image = Nothing
Image1.Width = 0
selectorLastX = Left
selectorLastY = top
Sleep 200
loadfileiamloaded = False
End Sub
Private Sub MakeFolder(ByVal a$)
a$ = Left$(a$, Len(a$) - 1)
On Error Resume Next
MkDir a$
Sleep 1
End Sub
Private Sub gList1_CheckGotFocus()
LastActive = gList1.Name
End Sub
Private Sub gList1_CtrlPlusF1()
FlipList
End Sub
Private Sub glist1_ExposeItemMouseMove(Button As Integer, ByVal item As Long, ByVal X As Long, ByVal Y As Long)
Static doubleclick As Long
If mySelector.IamBusy Then Exit Sub
If item = -1 Then
If Button = 1 And X > gList1.WidthPixels - setupxy And Y < setupxy Then
doubleclick = doubleclick + 1
If doubleclick > 1 Then
doubleclick = 0
FlipList
End If
End If
Else
doubleclick = 0
End If
End Sub
Private Sub FlipList()
If Not gList1.HeadLine = SetUp Then
dirlisttop = gList1.ScrollFrom
dirlistindex = gList1.ListIndex
mySelector.NostateDir = True
gList1.LeftMarginPixels = oldLeftMarginPixels
gList1.HeadLine = vbNullString ' reset
gList1.HeadLine = SetUp
gList1.ScrollTo 0
gList1.ListindexPrivateUse = 1
gList1.ShowMe
Else
GetSettings
If Not ReadSettings Then
mySelector.NostateDir = False
gList1.ScrollTo dirlistindex
gList1.ListindexPrivateUse = dirlistindex
gList1.LeftMarginPixels = 0
gList1.HeadLine = vbNullString
gList1.HeadLine = " "
mySelector.ResetHeightSelector
gList1.PrepareToShow
Else
mySelector.NostateDir = False
gList1.LeftMarginPixels = 0
gList1.HeadLine = vbNullString
gList1.HeadLine = " "
mySelector.reload
mySelector.ResetHeightSelector
gList1.PrepareToShow
End If
End If
End Sub
Private Sub gList1_GotFocus()
If gList1.ListIndex = -1 Then gList1.ListIndex = gList1.ScrollFrom
End Sub
Private Sub gList1_HeaderSelected(Button As Integer)
If Button = 1 And Not mySelector.NostateDir Then
gList1.CapColor = rgb(0, 160, 0)
gList1.ShowMe2
gList1.Refresh
mySelector.reload
gList1.CapColor = rgb(106, 128, 149)
gList1.ShowMe2
End If
End Sub
Private Sub gList1_KeyDown(KeyCode As Integer, shift As Integer)
If KeyCode = vbKeyEscape Then
mySelector.AbordAll
CancelDialog = True
Unload Me
End If
End Sub
Private Sub gList1_ScrollSelected(item As Long, Y As Long)
ShearchList = vbNullString
End Sub
Private Sub gList1_selected(item As Long)
ShearchList = vbNullString
End Sub
Private Sub gList1_selected2(item As Long)
If mySelector.NostateDir = True Then
' we ar in setup
Select Case item
Case 15
PlaceSettings
gList1.ScrollTo 0
Case 16
With mySelector
.AbordAll
.selectedFile = vbNullString
End With
CancelDialog = True
Unload Me
End Select
End If
End Sub
Private Sub gList1_SyncKeyboard(item As Integer)
If item = 8 Then
If Len(ShearchList) > 0 Then
ShearchList = Mid$(ShearchList, 1, Len(ShearchList) - 1)
Else
FlipList
End If
item = 0
End If
End Sub
Private Sub gList1_SyncKeyboardUnicode(a As String)
If gList1.HeadLine = SetUp Then Exit Sub
ShearchList = ShearchList + a
Dim oldf As Long
Static f As Long
oldf = f
f = gList1.ListIndex
f = mySelector.myDir2.FindItemStartWidth(ShearchList, True, f + 1)
If f < 0 Then
f = mySelector.myDir2.FindItemStartWidth(ShearchList, True, f + 1)
End If
If f >= 0 Then
gList1.ScrollTo f - gList1.lines / 2, f + 1
''RaiseEvent PickOther(gList1.ListValue)
Else
f = oldf
ShearchList = Mid$(ShearchList, 1, Len(ShearchList) - 1)
If Len(ShearchList) = 0 Then f = -1: Exit Sub
f = mySelector.myDir2.FindItemStartWidth(ShearchList, True, f + 1)
If f >= 0 Then
gList1.ScrollTo f - gList1.lines / 2, f + 1
''RaiseEvent PickOther(gList1.ListValue)
Else
f = -1
End If
End If
End Sub
Private Sub gList1_UnregisterGlist()
On Error Resume Next
If gList1.TabStopSoft Then LastActive = gList1.Name
Set LastGlist = Nothing
If Err.Number > 0 Then gList1.NoWheel = True
End Sub
Private Sub gList2_ExposeItemMouseMove(Button As Integer, ByVal item As Long, ByVal X As Long, ByVal Y As Long)
If gList2.DoubleClickCheck(Button, item, X, Y, CLng(setupxy) / 2, CLng(setupxy) / 2, CLng(setupxy) / 2, -1) Then
mySelector.AbordAll
Unload Me
End If
End Sub
Private Sub gList1_ExposeRect(ByVal item As Long, ByVal thisrect As Long, ByVal thisHDC As Long, skip As Boolean)
If item = -1 Then
mySelector.FillThere thisHDC, thisrect, gList1.CapColor
FillThereMyVersion2 thisHDC, thisrect, &HF0F0F0
skip = True
End If
End Sub
Private Sub gList2_ExposeRect(ByVal item As Long, ByVal thisrect As Long, ByVal thisHDC As Long, skip As Boolean)
If item = -1 Then
mySelector.FillThere thisHDC, thisrect, gList2.CapColor
FillThereMyVersion thisHDC, thisrect, &H999999
skip = True
End If
End Sub
Private Sub gList2_MouseUp(X As Single, Y As Single)
If mySelector.myDir2 Is Nothing Then Exit Sub
If LastActive <> "" Then
If Controls(LastActive).enabled Then
If Controls(LastActive).Visible Then
If Not gList2.DoubleClickArea(X, Y, setupxy / 2, setupxy / 3, Abs(setupxy / 2 - 2) + 1) Then
Controls(LastActive).SetFocus
Else
mySelector.AbordAll
Unload Me
End If
End If
End If
End If
End Sub
Private Sub gList2_Selected2(item As Long)
On Error Resume Next
If LastActive = "" Then
LastActive = gList1.Name
Else
If Controls(LastActive).enabled Then
If Controls(LastActive).Visible Then Controls(LastActive).SetFocus
End If
End If
End Sub
Private Sub glist3_CheckGotFocus()
LastActive = gList3.Name
gList3.BackColor = rgb(0, 160, 0)
gList3.ShowMe2
noChangeColorGlist3 = True
End Sub
Private Sub glist3_ExposeItemMouseMove(Button As Integer, ByVal item As Long, ByVal X As Long, ByVal Y As Long)
If gList3.EditFlag Then Exit Sub
If gList3.list(0) = vbNullString Then
gList3.BackColor = &H808080
gList3.ShowMe2
Exit Sub
End If
If Button = 1 Then
gList3.LeftMarginPixels = gList3.WidthPixels - gList3.UserControlTextWidth(gList3.list(0)) / Screen.TwipsPerPixelX
gList3.BackColor = rgb(0, 160, 0)
gList3.ShowMe2
Else
gList3.LeftMarginPixels = 8
If Not noChangeColorGlist3 Then gList3.BackColor = &H808080
gList3.ShowMe2
End If
End Sub
Private Sub glist3_KeyDown(KeyCode As Integer, shift As Integer)
' This was a problem in Windows 10
'' If Not mySelector.Mydir.isReadOnly(mySelector.Mydir.Path) Then
If Not gList3.EditFlag Then
If NewFolder Then
If Not (gList1.ListIndex = -1) Then
gList1.ListIndex = -1
gList1.ShowMe2
gList3.Clear
gList3.SelStart = 1
TEXT1 = "NewFolder"
End If
gList3.LeftMarginPixels = 8
gList3.BackColor = &H808080
gList3.EditFlag = True
gList3.NoCaretShow = False
gList3.BackColor = &H0
gList3.ForeColor = &HFFFFFF
ElseIf Not FileExist Then
If Not (gList1.ListIndex = -1) Then
gList1.ListIndex = -1
gList1.ShowMe2
gList3.Clear
gList3.SelStart = 1
If UserFileName <> "" Then
TEXT1 = UserFileName
Else
TEXT1 = "NewFile"
End If
End If
gList3.LeftMarginPixels = 8
gList3.BackColor = &H808080
gList3.EditFlag = True
gList3.NoCaretShow = False
gList3.BackColor = &H0
gList3.ForeColor = &HFFFFFF
Else
If KeyCode = vbKeyReturn Then
GoTo here
ElseIf KeyCode = vbKeyUp Or vbKeyDown Then
DestroyCaret
KeyCode = 0
gList1.SetFocus
End If
End If
gList3.ShowMe2
KeyCode = 0
ElseIf KeyCode = vbKeyReturn Then
here:
DestroyCaret
If TEXT1 <> "" Then
gList3.EditFlag = False
gList3.enabled = False
glist3_PanLeftRight True
End If
KeyCode = 0
End If
'End If
End Sub
Private Sub glist3_LostFocus()
noChangeColorGlist3 = False
gList3.BackColor = &H808080
gList3.ShowMe2
End Sub
Private Sub glist3_PanLeftRight(direction As Boolean)
Dim that As New recDir, TT As Integer
If TEXT1 = vbNullString Then Exit Sub
If direction Then
If mySelector.Mydir.path = vbNullString Then
If gList2.HeadLine = SelectFolderCaption And TEXT1 <> "" And TEXT1 <> ".." Then
ReturnFile = TEXT1 + "\"
Else
ReturnFile = vbNullString
End If
mySelector.AbordAll
Unload Me
Else
If TEXT1 <> "" Then
TEXT1 = mySelector.Mydir.CleanName(TEXT1.Text)
If mySelector.Mydir.Nofiles Then
If TEXT1 = SelectFolderButton Then
ReturnFile = mySelector.GetPath
ElseIf TEXT1.glistN.EditFlag Then
ReturnFile = mySelector.GetPath + TEXT1 + "\"
ElseIf mySelector.glistN.ListIndex >= 0 Then
ReturnFile = Mid$(mySelector.Mydir.list(mySelector.glistN.ListIndex), 2) + "\"
Else
ReturnFile = mySelector.GetPath + TEXT1 + "\"
End If
Else
ReturnFile = mySelector.GetPath + gList3.list(0)
End If
mySelector.AbordAll
gList1.enabled = False
gList2.enabled = False
TEXT1.enabled = False
Unload Me
Else
Beep
End If
End If
End If
End Sub
Private Sub gList3_Selected2(item As Long)
If item = -2 Then
If gList3.PanPos <> 0 Then
glist3_PanLeftRight (True)
Exit Sub
End If
gList3.LeftMarginPixels = 8
gList3.BackColor = &H808080
gList3.ForeColor = &HE0E0E0
gList3.EditFlag = False
gList3.NoCaretShow = True
ElseIf Not mySelector.Mydir.isReadOnly(mySelector.Mydir.path) Then
If NewFolder Then
If Not (gList1.ListIndex = -1) Then
gList1.ListIndex = -1
gList1.ShowMe2
TEXT1 = "NewFolder"
End If
gList3.LeftMarginPixels = 8
gList3.BackColor = &H808080
gList3.EditFlag = True
gList3.NoCaretShow = False
gList3.BackColor = &H0
gList3.ForeColor = &HFFFFFF
ElseIf Not FileExist Then
If Not (gList1.ListIndex = -1) Then
gList1.ListIndex = -1
gList1.ShowMe2
If UserFileName <> "" Then
TEXT1 = UserFileName
Else
TEXT1 = "NewFile"
End If
End If
gList3.LeftMarginPixels = 8
gList3.BackColor = &H808080
gList3.EditFlag = True
gList3.NoCaretShow = False
gList3.BackColor = &H0
gList3.ForeColor = &HFFFFFF
End If
End If
gList3.ShowMe2
End Sub
Private Sub mySelector_DoubleClick(File As String)
ReturnFile = File
mySelector.AbordAll
Unload Me
End Sub
Private Sub mySelector_NewHeadline(newpath As String)
If firstpath = 0 Then
Else
If Not SaveDialog Then TEXT1 = vbNullString
Line (0, 0)-(ScaleWidth - dv15, ScaleHeight - dv15), Me.BackColor, BF
Set LoadApicture = LoadPicture("")
End If
firstpath = firstpath + 1
End Sub
Public Property Set LoadApicture(aImage As StdPicture)
On Error Resume Next
Dim sc As Double
Set Image1.Image = Nothing
Image1.Width = 0
If aImage Is Nothing Then Exit Property
If aImage.Width = 0 Then Exit Property
Set Image1.Image = aImage
If (aImage.Width / iwidth) < (aImage.Height / iheight) Then
sc = aImage.Height / iheight
ImageMove Image1, iLeft + (iwidth - aImage.Width / sc) / 2, iTop, aImage.Width / sc, iheight
Else
sc = aImage.Width / iwidth
ImageMove Image1, iLeft, iTop + (iheight - aImage.Height / sc) / 2, iwidth, aImage.Height / sc
End If
Image1.Height = aImage.Height
Image1.Width = aImage.Width
End Property
Private Sub mySelector_TraceFile(File As String)
Dim aPic As StdPicture, s$
If Not DialogPreview Then
TEXT1 = mySelector.Mydir.list(mySelector.glistN.ListIndex)
Refresh
Else
Dim aImage As StdPicture, sc As Single
Static ihave As Boolean
If ihave Then Exit Sub
mySelector.glistN.enabled = False
' read ratio
Line (0, 0)-(ScaleWidth - dv15, ScaleHeight - dv15), Me.BackColor, BF
Set LoadApicture = LoadPicture("")
On Error Resume Next
Err.Clear
'If FileLen(file) > 1500000 Then Image1.refresh
s$ = CFname(File)
Set aPic = LoadMyPicture(GetDosPath(s$), True, gList2.BackColor)
MyEr "", ""
If Not aPic Is Nothing Then
Set aImage = aPic
If File = vbNullString Or Err.Number > 0 Then Exit Sub
ihave = True
Line (0, 0)-(ScaleWidth - dv15, ScaleHeight - dv15), Me.BackColor, BF
Set LoadApicture = aPic
Refresh
TEXT1 = mySelector.Mydir.list(mySelector.glistN.ListIndex)
mySelector.glistN.enabled = True
ihave = False
End If
End If
Err.Clear