А если воспользоваться готовым решением?
| PureBasic | 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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
| ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : PropertyGridGadget
; File Name : PropertyGridGadget.pb
; File version: 1.1.3
; Programming : OK
; Programmed by : Guimauve
; Date : 09-10-2012
; Last Update : 03-12-2012
; PureBasic code : 5.00
; Platform : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Programming notes :
;
; 1. This PropertyGrigGadget is based on the original work
; done by Danilo (PureBasic English Forum).
;
; 2. The CheckBoxGadget and the OptionGadget (Added) don't
; have a Description Gadget and Item Gadget. They are
; created has a Description gadget.
;
; 3. It possible to select Section and Item by Index number.
; Remember, Section Index number start at 0 and Item Index
; number start at 0 for each Section.
;
; 4. The Item creation outside a Section is no longer
; possible. (See "What is planned" about this point.)
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; What is planned (No date about when this will be added) :
;
; 1. PopupMenu to Open/Collapse/Lock/Unlock all Section.
;
; 2. A possibility to add 3-4 gadgets has item. (For the moment
; only 2 gadgets are possible.)
;
; 3. A better way to handle event and maybe Run User procedures
; on specific Gadgets events.
;
; 4. A possibility to add user Data to all items.
;
; 5. Restore the possibility to add Items without Section.
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Change for V1.0.1 :
;
; Removed : ClearPropertyGridGadgetSections()
; Added : DisablePropertyGridSubItem() --> "Private" Macro
; Added : ClearPropertyGridGadgetSection()
; Added : ClearPropertyGridGadget()
; Added : DisablePropertyGridGadgetSection()
; Added : AddPropertyGridTextGadget()
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Change for V1.1.0 :
;
; New field in structure : PropertyGridSubItem
; Modified : Private_RelocatePropertyGridSubItem()
; Modified : Private_RelocatePropertyGridItem()
; New parameter : AddPropertyGridStringGadget()
; New parameter : AddPropertyGridButtonGadget()
; New parameter : AddPropertyGridComboBoxGadget()
; New parameter : AddPropertyGridSpinGadget()
; New parameter : AddPropertyGridTrackBarGadget()
; New parameter : AddPropertyGridProgressBarGadget()
; Added : AddPropertyGridListIconGadget() --> Thanks to Andre
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Change for V1.1.1 :
;
; Modified : AddPropertyGridStringGadget() --> Return ItemHandle
; Modified : AddPropertyGridButtonGadget() --> Return ItemHandle
; Modified : AddPropertyGridCheckBoxGadget() --> Return DescriptionHandle
; Modified : AddPropertyGridOptionGadget() --> Return DescriptionHandle
; Modified : AddPropertyGridTextGadget() --> Return DescriptionHandle
; Modified : AddPropertyGridComboBoxGadget() --> Return ItemHandle
; Modified : AddPropertyGridSpinGadget() --> Return ItemHandle
; Modified : AddPropertyGridTrackBarGadget() --> Return ItemHandle
; Modified : AddPropertyGridProgressBarGadget() --> Return ItemHandle
; Modified : AddPropertyGridListIconGadget() --> Return DescriptionHandle or ItemHandle
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Change for V1.1.2 :
;
; New field in structure : PropertyGridSubItem
; Modification : The CheckBox, Option, Text and ListIcon without
; description now use all of the SubItem width space
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Change for V1.1.3 :
;
; Enhancement : The Use of "EnableExplicit" is now supported
; Modified : AddPropertyGridSection() now return the Open/Close button handle
; Added : GetPropertyGridSectionOpenCloseHandle() to get the Open/Close button handle
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
EnableExplicit
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
#PropertyGrid_SectionFont = "Arial"
#PropertyGrid_DefaultItemHeight = 20
#PropertyGrid_SectionFontSize = 10
CompilerCase #PB_OS_Linux
#PropertyGrid_SectionFont = "Mint Spirit"
#PropertyGrid_DefaultItemHeight = 30
#PropertyGrid_SectionFontSize = 10
CompilerCase #PB_OS_MacOS
#PropertyGrid_SectionFont = "Arial"
#PropertyGrid_DefaultItemHeight = 25
#PropertyGrid_SectionFontSize = 14
CompilerDefault ; future
#PropertyGrid_SectionFont = "Arial"
#PropertyGrid_DefaultItemHeight = 20
#PropertyGrid_SectionFontSize = 12
CompilerEndSelect
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Dйclaration de la Structure <<<<<
Structure PropertyGridSubItem
DescriptionGadget.i
DescriptionGadgetHeight.i
ItemGadget.i
ItemGadgetHeight.i
EndStructure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les observateurs <<<<<
Macro GetPropertyGridSubItemDescriptionGadget(PropertyGridSubItemA)
PropertyGridSubItemA\DescriptionGadget
EndMacro
Macro GetPropertyGridSubItemDescriptionGadgetHeight(PropertyGridSubItemA)
PropertyGridSubItemA\DescriptionGadgetHeight
EndMacro
Macro GetPropertyGridSubItemItemGadget(PropertyGridSubItemA)
PropertyGridSubItemA\ItemGadget
EndMacro
Macro GetPropertyGridSubItemItemGadgetHeight(PropertyGridSubItemA)
PropertyGridSubItemA\ItemGadgetHeight
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les mutateurs <<<<<
Macro SetPropertyGridSubItemDescriptionGadget(PropertyGridSubItemA, P_DescriptionGadget)
GetPropertyGridSubItemDescriptionGadget(PropertyGridSubItemA) = P_DescriptionGadget
EndMacro
Macro SetPropertyGridSubItemDescriptionGadgetHeight(PropertyGridSubItemA, P_DescriptionGadgetHeight)
GetPropertyGridSubItemDescriptionGadgetHeight(PropertyGridSubItemA) = P_DescriptionGadgetHeight
EndMacro
Macro SetPropertyGridSubItemItemGadget(PropertyGridSubItemA, P_ItemGadget)
GetPropertyGridSubItemItemGadget(PropertyGridSubItemA) = P_ItemGadget
EndMacro
Macro SetPropertyGridSubItemItemGadgetHeight(PropertyGridSubItemA, P_ItemGadgetHeight)
GetPropertyGridSubItemItemGadgetHeight(PropertyGridSubItemA) = P_ItemGadgetHeight
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< L'opйrateur Reset <<<<<
Macro ResetPropertyGridSubItem(PropertyGridSubItemA)
If IsGadget(GetPropertyGridSubItemDescriptionGadget(PropertyGridSubItemA))
FreeGadget(GetPropertyGridSubItemDescriptionGadget(PropertyGridSubItemA))
SetPropertyGridSubItemDescriptionGadget(PropertyGridSubItemA, 0)
SetPropertyGridSubItemDescriptionGadgetHeight(PropertyGridSubItemA, 0)
EndIf
If IsGadget(GetPropertyGridSubItemItemGadget(PropertyGridSubItemA))
FreeGadget(GetPropertyGridSubItemItemGadget(PropertyGridSubItemA))
SetPropertyGridSubItemItemGadget(PropertyGridSubItemA, 0)
SetPropertyGridSubItemItemGadgetHeight(PropertyGridSubItemA, 0)
EndIf
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< L'opйrateur Disable <<<<<
Macro DisablePropertyGridSubItem(PropertyGridSubItemA, P_State)
If IsGadget(GetPropertyGridSubItemDescriptionGadget(PropertyGridSubItemA))
DisableGadget(GetPropertyGridSubItemDescriptionGadget(PropertyGridSubItemA), P_State)
EndIf
If IsGadget(GetPropertyGridSubItemItemGadget(PropertyGridSubItemA))
DisableGadget(GetPropertyGridSubItemItemGadget(PropertyGridSubItemA), P_State)
EndIf
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Code gйnйrй en : 00.004 secondes (17500.00 lignes/seconde) <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Dйclaration de la Structure <<<<<
Structure PropertyGridItem
SectionDescriptionGadget.i
SectionButtonGadget.i
IsSection.i
Opened.i ; Special : Toggle
List SubItems.PropertyGridSubItem()
EndStructure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les observateurs <<<<<
Macro GetPropertyGridItemSectionDescriptionGadget(PropertyGridItemA)
PropertyGridItemA\SectionDescriptionGadget
EndMacro
Macro GetPropertyGridItemSectionButtonGadget(PropertyGridItemA)
PropertyGridItemA\SectionButtonGadget
EndMacro
Macro GetPropertyGridItemIsSection(PropertyGridItemA)
PropertyGridItemA\IsSection
EndMacro
Macro GetPropertyGridItemOpened(PropertyGridItemA)
PropertyGridItemA\Opened
EndMacro
Macro GetPropertyGridItemSubItems(PropertyGridItemA)
PropertyGridItemA\SubItems()
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les mutateurs <<<<<
Macro SetPropertyGridItemSectionDescriptionGadget(PropertyGridItemA, P_SectionDescriptionGadget)
GetPropertyGridItemSectionDescriptionGadget(PropertyGridItemA) = P_SectionDescriptionGadget
EndMacro
Macro SetPropertyGridItemSectionButtonGadget(PropertyGridItemA, P_SectionButtonGadget)
GetPropertyGridItemSectionButtonGadget(PropertyGridItemA) = P_SectionButtonGadget
EndMacro
Macro SetPropertyGridItemIsSection(PropertyGridItemA, P_IsSection)
GetPropertyGridItemIsSection(PropertyGridItemA) = P_IsSection
EndMacro
Macro SetPropertyGridItemOpened(PropertyGridItemA, P_Opened)
GetPropertyGridItemOpened(PropertyGridItemA) = P_Opened
EndMacro
Macro SetPropertyGridItemSubItems(PropertyGridItemA, P_SubItems)
CopyPropertyGridSubItem(P_SubItems, GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les macros complйmentaires pour les Listes chaоnйes <<<<<
Macro AddPropertyGridItemSubItemsElement(PropertyGridItemA)
AddElement(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro AddPropertyGridItemSubItemsElementEx(PropertyGridItemA, P_Element)
AddElement(GetPropertyGridItemSubItems(PropertyGridItemA))
SetPropertyGridItemSubItems(PropertyGridItemA, P_Element)
EndMacro
Macro InsertPropertyGridItemSubItemsElement(PropertyGridItemA)
InsertElement(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro InsertPropertyGridItemSubItemsElementEx(PropertyGridItemA, P_Element)
InsertElement(GetPropertyGridItemSubItems(PropertyGridItemA))
SetPropertyGridItemSubItems(PropertyGridItemA, P_Element)
EndMacro
Macro SelectPropertyGridItemSubItemsElement(PropertyGridItemA, Position)
SelectElement(GetPropertyGridItemSubItems(PropertyGridItemA), Position)
EndMacro
Macro PreviousPropertyGridItemSubItemsElement(PropertyGridItemA)
PreviousElement(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro NextPropertyGridItemSubItemsElement(PropertyGridItemA)
NextElement(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro FirstPropertyGridItemSubItemsElement(PropertyGridItemA)
FirstElement(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro LastPropertyGridItemSubItemsElement(PropertyGridItemA)
LastElement(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro PopListPropertyGridItemSubItemsPosition(PropertyGridItemA)
PopListPosition(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro PushListPropertyGridItemSubItemsPosition(PropertyGridItemA)
PushListPosition(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro DeletePropertyGridItemSubItemsElement(PropertyGridItemA, Flag = 0)
DeleteElement(GetPropertyGridItemSubItems(PropertyGridItemA), Flag)
EndMacro
Macro ListPropertyGridItemSubItemsSize(PropertyGridItemA)
ListSize(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro ResetPropertyGridItemSubItemsList(PropertyGridItemA)
ResetList(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro ListPropertyGridItemSubItemsIndex(PropertyGridItemA)
ListIndex(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
Macro ClearPropertyGridItemSubItemsList(PropertyGridItemA)
ClearList(GetPropertyGridItemSubItems(PropertyGridItemA))
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les opйrateurs spйciaux <<<<<
Macro TogglePropertyGridItemOpened(PropertyGridItemA)
SetPropertyGridItemOpened(PropertyGridItemA, GetPropertyGridItemOpened(PropertyGridItemA) ! 1)
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< L'opйrateur Reset <<<<<
Macro ResetPropertyGridItem(PropertyGridItemA)
If IsGadget(GetPropertyGridItemSectionDescriptionGadget(PropertyGridItemA))
FreeGadget(GetPropertyGridItemSectionDescriptionGadget(PropertyGridItemA))
SetPropertyGridItemSectionDescriptionGadget(PropertyGridItemA, 0)
EndIf
If IsGadget(GetPropertyGridItemSectionButtonGadget(PropertyGridItemA))
FreeGadget(GetPropertyGridItemSectionButtonGadget(PropertyGridItemA))
SetPropertyGridItemSectionButtonGadget(PropertyGridItemA, 0)
EndIf
SetPropertyGridItemIsSection(PropertyGridItemA, 0)
SetPropertyGridItemOpened(PropertyGridItemA, 0)
ForEach GetPropertyGridItemSubItems(PropertyGridItemA)
ResetPropertyGridSubItem(GetPropertyGridItemSubItems(PropertyGridItemA))
Next
ClearPropertyGridItemSubItemsList(PropertyGridItemA)
ClearStructure(PropertyGridItemA, PropertyGridItem)
InitializeStructure(PropertyGridItemA, PropertyGridItem)
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Code gйnйrй en : 00.012 secondes (19000.00 lignes/seconde) <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Dйclaration de la Structure <<<<<
Structure PropertyGridData
ItemHeight.i
Font.i
BackColor.l
FrontColor.l
List Items.PropertyGridItem()
EndStructure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les observateurs <<<<<
Macro GetPropertyGridDataItemHeight(PropertyGridDataA)
PropertyGridDataA\ItemHeight
EndMacro
Macro GetPropertyGridDataFont(PropertyGridDataA)
PropertyGridDataA\Font
EndMacro
Macro GetPropertyGridDataBackColor(PropertyGridDataA)
PropertyGridDataA\BackColor
EndMacro
Macro GetPropertyGridDataFrontColor(PropertyGridDataA)
PropertyGridDataA\FrontColor
EndMacro
Macro GetPropertyGridDataItems(PropertyGridDataA)
PropertyGridDataA\Items()
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les mutateurs <<<<<
Macro SetPropertyGridDataItemHeight(PropertyGridDataA, P_ItemHeight)
GetPropertyGridDataItemHeight(PropertyGridDataA) = P_ItemHeight
EndMacro
Macro SetPropertyGridDataFont(PropertyGridDataA, P_Font)
GetPropertyGridDataFont(PropertyGridDataA) = P_Font
EndMacro
Macro SetPropertyGridDataBackColor(PropertyGridDataA, P_BackColor)
GetPropertyGridDataBackColor(PropertyGridDataA) = P_BackColor
EndMacro
Macro SetPropertyGridDataFrontColor(PropertyGridDataA, P_FrontColor)
GetPropertyGridDataFrontColor(PropertyGridDataA) = P_FrontColor
EndMacro
Macro SetPropertyGridDataItems(PropertyGridDataA, P_Items)
CopyPropertyGridItem(P_Items, GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les macros complйmentaires pour les Listes chaоnйes <<<<<
Macro AddPropertyGridDataItemsElement(PropertyGridDataA)
AddElement(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro AddPropertyGridDataItemsElementEx(PropertyGridDataA, P_Element)
AddElement(GetPropertyGridDataItems(PropertyGridDataA))
SetPropertyGridDataItems(PropertyGridDataA, P_Element)
EndMacro
Macro InsertPropertyGridDataItemsElement(PropertyGridDataA)
InsertElement(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro InsertPropertyGridDataItemsElementEx(PropertyGridDataA, P_Element)
InsertElement(GetPropertyGridDataItems(PropertyGridDataA))
SetPropertyGridDataItems(PropertyGridDataA, P_Element)
EndMacro
Macro SelectPropertyGridDataItemsElement(PropertyGridDataA, Position)
SelectElement(GetPropertyGridDataItems(PropertyGridDataA), Position)
EndMacro
Macro PreviousPropertyGridDataItemsElement(PropertyGridDataA)
PreviousElement(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro NextPropertyGridDataItemsElement(PropertyGridDataA)
NextElement(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro FirstPropertyGridDataItemsElement(PropertyGridDataA)
FirstElement(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro LastPropertyGridDataItemsElement(PropertyGridDataA)
LastElement(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro PopListPropertyGridDataItemsPosition(PropertyGridDataA)
PopListPosition(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro PushListPropertyGridDataItemsPosition(PropertyGridDataA)
PushListPosition(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro DeletePropertyGridDataItemsElement(PropertyGridDataA, Flag = 0)
DeleteElement(GetPropertyGridDataItems(PropertyGridDataA), Flag)
EndMacro
Macro ListPropertyGridDataItemsSize(PropertyGridDataA)
ListSize(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro ResetPropertyGridDataItemsList(PropertyGridDataA)
ResetList(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro ListPropertyGridDataItemsIndex(PropertyGridDataA)
ListIndex(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
Macro ClearPropertyGridDataItemsList(PropertyGridDataA)
ClearList(GetPropertyGridDataItems(PropertyGridDataA))
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< L'opйrateur Reset <<<<<
Macro ResetPropertyGridData(PropertyGridDataA)
SetPropertyGridDataItemHeight(PropertyGridDataA, 0)
If IsFont(GetPropertyGridDataFont(PropertyGridDataA))
FreeFont(GetPropertyGridDataFont(PropertyGridDataA))
SetPropertyGridDataFont(PropertyGridDataA, 0)
EndIf
SetPropertyGridDataBackColor(PropertyGridDataA, 0)
SetPropertyGridDataFrontColor(PropertyGridDataA, 0)
ForEach GetPropertyGridDataItems(PropertyGridDataA)
ResetPropertyGridItem(GetPropertyGridDataItems(PropertyGridDataA))
Next
ClearPropertyGridDataItemsList(PropertyGridDataA)
ClearStructure(PropertyGridDataA, PropertyGridData)
InitializeStructure(PropertyGridDataA, PropertyGridData)
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Code gйnйrй en : 00.014 secondes (15642.86 lignes/seconde) <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Procedure Private_PropertyGrid_OpenClose_Image(IsOpen.b)
Static OpenImage.i, CloseImage.i, OneShot.b
If OneShot = #False
OpenImage = CreateImage(#PB_Any, 11, 11, 32)
If OpenImage And StartDrawing(ImageOutput(OpenImage))
Box(0, 0, 11, 11, RGB($FF, $FF, $FF))
DrawingMode(#PB_2DDrawing_Outlined)
Box(0, 0, 11, 11, RGB($00, $00, $00))
LineXY(2, 5, 8, 5, RGB($00, $00, $00))
StopDrawing()
EndIf
CloseImage = CreateImage(#PB_Any, 11, 11, 32)
If CloseImage And StartDrawing(ImageOutput(CloseImage))
Box(0,0,11,11,RGB($FF,$FF,$FF))
DrawingMode(#PB_2DDrawing_Outlined)
Box(0,0,11,11,RGB($00,$00,$00))
LineXY(2,5,8,5,RGB($00,$00,$00))
LineXY(5,2,5,8,RGB($00,$00,$00))
StopDrawing()
EndIf
OneShot = #True
EndIf
If IsOpen
ProcedureReturn OpenImage
Else
ProcedureReturn CloseImage
EndIf
EndProcedure
Procedure Private_HidePropertyGridSubItem(*PropertyGridSubItemA.PropertyGridSubItem, IsOpen.b)
HideGadget(GetPropertyGridSubItemDescriptionGadget(*PropertyGridSubItemA), 1 - IsOpen)
If IsGadget(GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA))
HideGadget(GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA), 1 - IsOpen)
EndIf
EndProcedure
Procedure Private_RelocatePropertyGridSubItem(*PropertyGridSubItemA.PropertyGridSubItem, Index, Width, Height)
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
If GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA) <> -1
ResizeGadget(GetPropertyGridSubItemDescriptionGadget(*PropertyGridSubItemA), 20, Index, width >> 1 - 40, GetPropertyGridSubItemDescriptionGadgetHeight(*PropertyGridSubItemA) - 1)
Else
ResizeGadget(GetPropertyGridSubItemDescriptionGadget(*PropertyGridSubItemA), 20, Index, width - 42, GetPropertyGridSubItemDescriptionGadgetHeight(*PropertyGridSubItemA) - 1)
EndIf
If IsGadget(GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA))
ResizeGadget(GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA), width >> 1 - 19, Index, width >> 1 - 4, GetPropertyGridSubItemItemGadgetHeight(*PropertyGridSubItemA) - 1)
EndIf
CompilerCase #PB_OS_Linux
If GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA) <> -1
ResizeGadget(GetPropertyGridSubItemDescriptionGadget(*PropertyGridSubItemA), 20, Index - 12, width >> 1 - 40, GetPropertyGridSubItemDescriptionGadgetHeight(*PropertyGridSubItemA) - 1)
Else
ResizeGadget(GetPropertyGridSubItemDescriptionGadget(*PropertyGridSubItemA), 20, Index - 12, width - 42, GetPropertyGridSubItemDescriptionGadgetHeight(*PropertyGridSubItemA) - 1)
EndIf
If IsGadget(GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA))
ResizeGadget(GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA), width >> 1 - 19, Index - 12, width >> 1 - 4, GetPropertyGridSubItemItemGadgetHeight(*PropertyGridSubItemA) - 1)
EndIf
CompilerCase #PB_OS_MacOS
If GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA) <> -1
ResizeGadget(GetPropertyGridSubItemDescriptionGadget(*PropertyGridSubItemA), 20, Index, width >> 1 - 40, GetPropertyGridSubItemDescriptionGadgetHeight(*PropertyGridSubItemA) - 1)
Else
ResizeGadget(GetPropertyGridSubItemDescriptionGadget(*PropertyGridSubItemA), 20, Index, width - 40, GetPropertyGridSubItemDescriptionGadgetHeight(*PropertyGridSubItemA) - 1)
EndIf
If IsGadget(GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA))
ResizeGadget(GetPropertyGridSubItemItemGadget(*PropertyGridSubItemA), width >> 1 - 19, Index, width >> 1 - 4, GetPropertyGridSubItemItemGadgetHeight(*PropertyGridSubItemA) - 1)
EndIf
CompilerEndSelect
EndProcedure
Procedure Private_RelocatePropertyGridItem(*PropertyGridItemA.PropertyGridItem, Index, Width, Height)
If GetPropertyGridItemIsSection(*PropertyGridItemA)
ResizeGadget(GetPropertyGridItemSectionDescriptionGadget(*PropertyGridItemA), 20, Index, Width - 20, Height - 1)
ResizeGadget(GetPropertyGridItemSectionButtonGadget(*PropertyGridItemA), 4, Index + Height >> 1 - 12, 11, 11)
Else
ResizeGadget(GetPropertyGridItemSectionDescriptionGadget(*PropertyGridItemA), 20, Index, Width >> 1 - 40, Height - 1)
ResizeGadget(GetPropertyGridItemSectionButtonGadget(*PropertyGridItemA), Width >> 1 - 19, Index, Width >> 1 - 4, Height - 1)
EndIf
Index + Height
If GetPropertyGridItemOpened(*PropertyGridItemA) = #True
ForEach GetPropertyGridItemSubItems(*PropertyGridItemA)
Private_RelocatePropertyGridSubItem(GetPropertyGridItemSubItems(*PropertyGridItemA), Index, Width, Height)
Index + GetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(*PropertyGridItemA))
Next
EndIf
ProcedureReturn Index
EndProcedure
Procedure Private_Create_PropertyGridItem(*PropertyGridItemA.PropertyGridItem, SectionName.s, Width, Height, FrontColor, BackColor, IsOpen.b, FontID)
SetPropertyGridItemSectionDescriptionGadget(*PropertyGridItemA, TextGadget(#PB_Any, 20, 0, width - 20, height, SectionName))
SetPropertyGridItemSectionButtonGadget(*PropertyGridItemA, ImageGadget(#PB_Any,0,0,0,0,ImageID(Private_PropertyGrid_OpenClose_Image(IsOpen))))
SetPropertyGridItemIsSection(*PropertyGridItemA, #True)
SetPropertyGridItemOpened(*PropertyGridItemA, IsOpen)
SetGadgetFont(GetPropertyGridItemSectionDescriptionGadget(*PropertyGridItemA), FontID(FontID))
If BackColor <> -1
SetGadgetColor(GetPropertyGridItemSectionDescriptionGadget(*PropertyGridItemA), #PB_Gadget_BackColor, BackColor)
EndIf
If FrontColor <> -1
SetGadgetColor(GetPropertyGridItemSectionDescriptionGadget(*PropertyGridItemA), #PB_Gadget_FrontColor, FrontColor)
EndIf
EndProcedure
Procedure Private_Update_PropertyGrid(PropertyGridID)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
Protected Index.l, Height.l, Width.l
If *PropertyGridDataA <> #Null
Index = 0
Height = GetPropertyGridDataItemHeight(*PropertyGridDataA)
Width = GadgetWidth(PropertyGridID)
ForEach GetPropertyGridDataItems(*PropertyGridDataA)
Index = Private_RelocatePropertyGridItem(GetPropertyGridDataItems(*PropertyGridDataA), Index, Width, Height)
Next
If GetGadgetAttribute(PropertyGridID, #PB_ScrollArea_InnerHeight) <> Index
SetGadgetAttribute(PropertyGridID, #PB_ScrollArea_InnerHeight, Index)
EndIf
If GetGadgetAttribute(PropertyGridID, #PB_ScrollArea_InnerWidth) <> Width - 20
SetGadgetAttribute(PropertyGridID, #PB_ScrollArea_InnerWidth, Width - 20)
EndIf
EndIf
EndProcedure
Procedure Private_PropertyGridItem_EventManagement(*PropertyGridDataA.PropertyGridData, *PropertyGridItemA.PropertyGridItem)
Protected SomethingHappen.b = #False
If EventGadget() = GetPropertyGridItemSectionButtonGadget(*PropertyGridItemA) And EventType() = #PB_EventType_LeftClick
TogglePropertyGridItemOpened(GetPropertyGridDataItems(*PropertyGridDataA))
SetGadgetState(GetPropertyGridItemSectionButtonGadget(*PropertyGridItemA), ImageID(Private_PropertyGrid_OpenClose_Image(GetPropertyGridItemOpened(*PropertyGridItemA))))
ForEach GetPropertyGridItemSubItems(*PropertyGridItemA)
Private_HidePropertyGridSubItem(GetPropertyGridItemSubItems(*PropertyGridItemA), GetPropertyGridItemOpened(*PropertyGridItemA))
Next
SomethingHappen = #True
EndIf
ProcedureReturn SomethingHappen
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Les commandes а utiliser partout <<<<<
Procedure PropertyGridGadget(PropertyGridID, x, y, Width, Height, FrontColor.l = -1, BackColor.l = -1, Flags = #PB_ScrollArea_Flat)
Protected *PropertyGridDataA.PropertyGridData, GadgetHandle.i
GadgetHandle = ScrollAreaGadget(PropertyGridID, x, y, Width, Height, Width - 20, 1, #PropertyGrid_DefaultItemHeight, Flags)
If GadgetHandle
If PropertyGridID = #PB_Any
PropertyGridID = GadgetHandle
EndIf
If FrontColor <> -1
SetGadgetColor(PropertyGridID, #PB_Gadget_FrontColor, FrontColor)
EndIf
If BackColor <> -1
SetGadgetColor(PropertyGridID, #PB_Gadget_BackColor, BackColor)
EndIf
*PropertyGridDataA = AllocateMemory(SizeOf(PropertyGridData))
If *PropertyGridDataA = #Null
FreeGadget(PropertyGridID)
ProcedureReturn 0
EndIf
InitializeStructure(*PropertyGridDataA, PropertyGridData)
SetPropertyGridDataItemHeight(*PropertyGridDataA, #PropertyGrid_DefaultItemHeight)
SetPropertyGridDataFont(*PropertyGridDataA, LoadFont(#PB_Any, #PropertyGrid_SectionFont, #PropertyGrid_SectionFontSize, #PB_Font_Bold))
SetPropertyGridDataBackColor(*PropertyGridDataA, BackColor)
SetPropertyGridDataFrontColor(*PropertyGridDataA, FrontColor)
SetGadgetData(PropertyGridID, *PropertyGridDataA)
CloseGadgetList()
EndIf
ProcedureReturn PropertyGridID
EndProcedure
Procedure AddPropertyGridSection(PropertyGridID, SectionName.s, IsOpen.b = #True)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
LastPropertyGridDataItemsElement(*PropertyGridDataA)
If AddPropertyGridDataItemsElement(*PropertyGridDataA)
InitializeStructure(GetPropertyGridDataItems(*PropertyGridDataA), PropertyGridItem)
OpenGadgetList(PropertyGridID)
Private_Create_PropertyGridItem(GetPropertyGridDataItems(*PropertyGridDataA), SectionName, GadgetWidth(PropertyGridID), GetPropertyGridDataItemHeight(*PropertyGridDataA), GetPropertyGridDataFrontColor(*PropertyGridDataA), GetPropertyGridDataBackColor(*PropertyGridDataA), IsOpen, GetPropertyGridDataFont(*PropertyGridDataA))
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridItemSectionButtonGadget(GetPropertyGridDataItems(*PropertyGridDataA))
EndIf
EndIf
EndProcedure
Procedure CheckPropertyGridSectionClick(PropertyGridID)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
ForEach GetPropertyGridDataItems(*PropertyGridDataA)
If Private_PropertyGridItem_EventManagement(*PropertyGridDataA, GetPropertyGridDataItems(*PropertyGridDataA))
Private_Update_PropertyGrid(PropertyGridID)
Break
EndIf
Next
Private_Update_PropertyGrid(PropertyGridID)
EndIf
EndProcedure
Procedure SetPropertyGridSectionName(PropertyGridID, SectionNo, SectionName.s)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
SetGadgetText(GetPropertyGridItemSectionDescriptionGadget(GetPropertyGridDataItems(*PropertyGridDataA)), SectionName)
EndIf
EndIf
EndIf
EndProcedure
Procedure.s GetPropertyGridSectionName(PropertyGridID, SectionNo)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
ProcedureReturn GetGadgetText(GetPropertyGridItemSectionDescriptionGadget(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure GetPropertyGridSectionOpenCloseHandle(PropertyGridID, SectionNo)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
ProcedureReturn GetPropertyGridItemSectionButtonGadget(GetPropertyGridDataItems(*PropertyGridDataA))
EndIf
EndIf
EndIf
EndProcedure
Procedure SetPropertyGridSectionItemDescription(PropertyGridID, SectionNo, ItemNo, Description.s)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
If ItemNo >= 0 And ItemNo <= ListPropertyGridItemSubItemsSize(GetPropertyGridDataItems(*PropertyGridDataA)) - 1
If SelectPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA), ItemNo)
If IsGadget(GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
SetGadgetText(GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))), Description)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndProcedure
Procedure SetPropertyGridSectionItemContent(PropertyGridID, SectionNo, ItemNo, Content.s)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
If ItemNo >= 0 And ItemNo <= ListPropertyGridItemSubItemsSize(GetPropertyGridDataItems(*PropertyGridDataA)) - 1
If SelectPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA), ItemNo)
If IsGadget(GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
SetGadgetText(GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))), Content)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndProcedure
Procedure.s GetPropertyGridSectionItemContent(PropertyGridID, SectionNo, ItemNo)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
If ItemNo >= 0 And ItemNo <= ListPropertyGridItemSubItemsSize(GetPropertyGridDataItems(*PropertyGridDataA)) - 1
If SelectPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA), ItemNo)
If IsGadget(GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
ProcedureReturn GetGadgetText(GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndProcedure
Procedure SetPropertyGridSectionItemGadgetState(PropertyGridID, SectionNo, ItemNo, State)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
If ItemNo >= 0 And ItemNo <= ListPropertyGridItemSubItemsSize(GetPropertyGridDataItems(*PropertyGridDataA)) - 1
If SelectPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA), ItemNo)
If GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))) = -1
If IsGadget(GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
SetGadgetState(GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))), State)
ProcedureReturn 1
Else
ProcedureReturn -1
EndIf
Else
If IsGadget(GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
SetGadgetState(GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))), State)
ProcedureReturn 1
Else
ProcedureReturn -1
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndProcedure
Procedure GetPropertyGridSectionItemGadgetHandle(PropertyGridID, SectionNo, ItemNo)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
If ItemNo >= 0 And ItemNo <= ListPropertyGridItemSubItemsSize(GetPropertyGridDataItems(*PropertyGridDataA)) - 1
If SelectPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA), ItemNo)
If GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))) = -1
If IsGadget(GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
ProcedureReturn GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
Else
ProcedureReturn -1
EndIf
Else
If IsGadget(GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
ProcedureReturn GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
Else
ProcedureReturn -1
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndProcedure
Procedure GetPropertyGridSectionItemGadgetState(PropertyGridID, SectionNo, ItemNo)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
If ItemNo >= 0 And ItemNo <= ListPropertyGridItemSubItemsSize(GetPropertyGridDataItems(*PropertyGridDataA)) - 1
If SelectPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA), ItemNo)
If GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))) = -1
If IsGadget(GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
ProcedureReturn GetGadgetState(GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
Else
ProcedureReturn -1
EndIf
Else
If IsGadget(GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
ProcedureReturn GetGadgetState(GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))))
Else
ProcedureReturn -1
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndProcedure
Procedure GetPropertyGridSectionCount(PropertyGridID)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
Protected SectionCount.l = -1
If *PropertyGridDataA <> #Null
SectionCount = ListPropertyGridDataItemsSize(*PropertyGridDataA)
EndIf
ProcedureReturn SectionCount
EndProcedure
Procedure AddPropertyGridStringGadget(PropertyGridID, SectionNo, Description.s = "", Content.s = "", Flags = 0, P_ItemGadgetHeight = #PropertyGrid_DefaultItemHeight)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), StringGadget(#PB_Any, 0, 0, 0, 0, Description, #PB_String_ReadOnly))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), StringGadget(#PB_Any, 0, 0, 0, 0, Content, Flags))
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure AddPropertyGridButtonGadget(PropertyGridID, SectionNo, Description.s = "", Content.s = "", Flags = 0, P_ItemGadgetHeight = #PropertyGrid_DefaultItemHeight)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), StringGadget(#PB_Any, 0, 0, 0, 0, Description, #PB_String_ReadOnly))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), ButtonGadget(#PB_Any, 0, 0, 0, 0, Content, Flags))
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure AddPropertyGridCheckBoxGadget(PropertyGridID, SectionNo, Description.s = "", Flags = 0)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), CheckBoxGadget(#PB_Any, 0, 0, 0, 0, Description, Flags))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), -1)
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure AddPropertyGridOptionGadget(PropertyGridID, SectionNo, Description.s = "")
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), OptionGadget(#PB_Any, 0, 0, 0, 0, Description))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), -1)
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure AddPropertyGridTextGadget(PropertyGridID, SectionNo, Description.s = "", Flags = 0)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), TextGadget(#PB_Any, 0, 0, 0, 0, Description, Flags))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), -1)
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure AddPropertyGridComboBoxGadget(PropertyGridID, SectionNo, Description.s = "", Flags = 0, P_ItemGadgetHeight = #PropertyGrid_DefaultItemHeight)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), StringGadget(#PB_Any, 0, 0, 0, 0, Description, #PB_String_ReadOnly))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), ComboBoxGadget(#PB_Any, 0, 0, 0, 0, Flags))
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure AddPropertyGridGadgetItems(PropertyGridID, SectionNo, ItemNo, Position, Text.s)
Protected GadgetHandle = GetPropertyGridSectionItemGadgetHandle(PropertyGridID, SectionNo, ItemNo)
If IsGadget(GadgetHandle)
AddGadgetItem(GadgetHandle, Position, Text)
EndIf
EndProcedure
Procedure AddPropertyGridSpinGadget(PropertyGridID, SectionNo, Description.s = "", Minimum = 0, Maximum = 100, Flags = #PB_Spin_Numeric | #PB_Spin_ReadOnly, P_ItemGadgetHeight = #PropertyGrid_DefaultItemHeight)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), StringGadget(#PB_Any, 0, 0, 0, 0, Description, #PB_String_ReadOnly))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), SpinGadget(#PB_Any, 0, 0, 0, 0, Minimum, Maximum, Flags))
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure AddPropertyGridTrackBarGadget(PropertyGridID, SectionNo, Description.s = "", Minimum = 0, Maximum = 100, Flags = #PB_TrackBar_Ticks, P_ItemGadgetHeight = #PropertyGrid_DefaultItemHeight)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), StringGadget(#PB_Any, 0, 0, 0, 0, Description, #PB_String_ReadOnly))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), TrackBarGadget(#PB_Any, 0, 0, 0, 0, Minimum, Maximum, Flags))
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure AddPropertyGridProgressBarGadget(PropertyGridID, SectionNo, Description.s = "", Minimum = 0, Maximum = 100, Flags = #PB_ProgressBar_Smooth, P_ItemGadgetHeight = #PropertyGrid_DefaultItemHeight)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), StringGadget(#PB_Any, 0, 0, 0, 0, Description, #PB_String_ReadOnly))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), ProgressBarGadget(#PB_Any, 0, 0, 0, 0, Minimum, Maximum, Flags))
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
ProcedureReturn GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndProcedure
Procedure AddPropertyGridListIconGadget(PropertyGridID, SectionNo, Description.s = "", Title.s = "", TitleWidth = 100, Flags = 0, P_ItemGadgetHeight = 100)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
AddPropertyGridItemSubItemsElement(GetPropertyGridDataItems(*PropertyGridDataA))
OpenGadgetList(PropertyGridID)
If Description <> ""
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), StringGadget(#PB_Any, 0, 0, 0, 0, Description, #PB_String_ReadOnly))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), #PropertyGrid_DefaultItemHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), ListIconGadget(#PB_Any, 0, 0, 0, 0, Title, TitleWidth, Flags))
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
Else
SetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), ListIconGadget(#PB_Any, 0, 0, 0, 0, Title, TitleWidth, Flags))
SetPropertyGridSubItemDescriptionGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
SetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), -1)
SetPropertyGridSubItemItemGadgetHeight(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), P_ItemGadgetHeight)
EndIf
CloseGadgetList()
Private_Update_PropertyGrid(PropertyGridID)
If Description <> ""
ProcedureReturn GetPropertyGridSubItemItemGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
Else
ProcedureReturn GetPropertyGridSubItemDescriptionGadget(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
EndIf
EndIf
EndIf
EndIf
EndProcedure
Procedure DisablePropertyGridGadgetSection(PropertyGridID, SectionNo, State)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
OpenGadgetList(PropertyGridID)
ForEach GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))
DisablePropertyGridSubItem(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)), State)
Next
CloseGadgetList()
EndIf
EndIf
EndIf
EndProcedure
Procedure ClearPropertyGridGadgetSection(PropertyGridID, SectionNo)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
If SectionNo >= 0 And SectionNo <= ListPropertyGridDataItemsSize(*PropertyGridDataA) - 1
If SelectPropertyGridDataItemsElement(*PropertyGridDataA, SectionNo)
OpenGadgetList(PropertyGridID)
ForEach GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA))
ResetPropertyGridSubItem(GetPropertyGridItemSubItems(GetPropertyGridDataItems(*PropertyGridDataA)))
Next
ClearPropertyGridItemSubItemsList(GetPropertyGridDataItems(*PropertyGridDataA))
CloseGadgetList()
EndIf
EndIf
Private_Update_PropertyGrid(PropertyGridID)
EndIf
EndProcedure
Procedure ClearPropertyGridGadget(PropertyGridID)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
ForEach GetPropertyGridDataItems(*PropertyGridDataA)
ResetPropertyGridItem(GetPropertyGridDataItems(*PropertyGridDataA))
Next
ClearPropertyGridDataItemsList(*PropertyGridDataA)
InitializeStructure(*PropertyGridDataA, PropertyGridData)
EndIf
EndProcedure
Procedure FreePropertyGridGadget(PropertyGridID)
Protected *PropertyGridDataA.PropertyGridData = GetGadgetData(PropertyGridID)
If *PropertyGridDataA <> #Null
ResetPropertyGridData(*PropertyGridDataA)
FreeMemory(*PropertyGridDataA)
FreeGadget(PropertyGridID)
EndIf
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< !!! WARNING - YOU ARE NOW IN A TESTING ZONE - WARNING !!! <<<<<
; <<<<< !!! WARNING - THIS CODE SHOULD BE COMMENTED - WARNING !!! <<<<<
; <<<<< !!! WARNING - BEFORE THE FINAL COMPILATION. - WARNING !!! <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Enumeration
#PropertyGrid
#Btn_Clear_Section
EndEnumeration
If OpenWindow(0,0,0,800,600,"PropertyGrid",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
HideWindow(0, #True)
PropertyGridGadget(#PropertyGrid, 5, 5, 390, 500)
ButtonGadget(#Btn_Clear_Section, 5, 510,150,30, "Clear Section 2")
Define SectionID.l, EventID.i
For SectionID = 0 To 5
AddPropertyGridSection(#PropertyGrid, "Section 0" + Str(SectionID))
AddPropertyGridCheckBoxGadget(#PropertyGrid, SectionID, "Is Visible")
AddPropertyGridStringGadget(#PropertyGrid, SectionID, "String", "Enter a text here !")
AddPropertyGridComboBoxGadget(#PropertyGrid, SectionID, "ComboBox")
AddPropertyGridButtonGadget(#PropertyGrid, SectionID, "Button", "Button 0" + Str(SectionID))
AddPropertyGridSpinGadget(#PropertyGrid, SectionID, "SpinGadget", 0, 15)
AddPropertyGridTrackBarGadget(#PropertyGrid, SectionID, "TrackBar")
AddPropertyGridProgressBarGadget(#PropertyGrid, SectionID, "ProgressBar")
If SectionID % 2 = 0
AddPropertyGridListIconGadget(#PropertyGrid, SectionID, "ListIcon", "Column 1")
Else
AddPropertyGridListIconGadget(#PropertyGrid, SectionID, "", "Column 1")
EndIf
SetPropertyGridSectionItemGadgetState(#PropertyGrid, SectionID, 0, 1)
AddPropertyGridGadgetItems(#PropertyGrid, SectionID, 2, 0, "ComboBox Item 0")
AddPropertyGridGadgetItems(#PropertyGrid, SectionID, 2, 1, "ComboBox Item 1")
AddPropertyGridGadgetItems(#PropertyGrid, SectionID, 2, 2, "ComboBox Item 2")
AddPropertyGridGadgetItems(#PropertyGrid, SectionID, 2, 3, "ComboBox Item 3")
SetPropertyGridSectionItemGadgetState(#PropertyGrid, SectionID, 5, Random(90) + 5)
SetPropertyGridSectionItemGadgetState(#PropertyGrid, SectionID, 6, Random(90) + 5)
; Add items to the listicon (GadgetID = 7):
AddPropertyGridGadgetItems(#PropertyGrid, SectionID, 7, 0, "ListIcon Item 0")
AddPropertyGridGadgetItems(#PropertyGrid, SectionID, 7, 1, "ListIcon Item 1")
AddPropertyGridGadgetItems(#PropertyGrid, SectionID, 7, 2, "ListIcon Item 2")
Next
HideWindow(0, #False)
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case #PropertyGrid
Case #Btn_Clear_Section
ClearPropertyGridGadgetSection(#PropertyGrid, 2)
Case GetPropertyGridSectionItemGadgetHandle(#PropertyGrid, 0, 0)
If GetPropertyGridSectionItemGadgetState(#PropertyGrid, 0, 0)
Debug "CheckBox Section 0 Item 1 (Is Visible)"
Else
Debug "CheckBox Section 0 Item 1 (Is not visible)"
EndIf
Default
CheckPropertyGridSectionClick(#PropertyGrid)
EndSelect
EndSelect
Until EventID = #PB_Event_CloseWindow
FreePropertyGridGadget(#PropertyGrid)
EndIf
; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<< |
|
Добавлено через 4 минуты
Ещё пример
| PureBasic | 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
| ;
; Simple PropertyGrid
;
; by Danilo, May 2012, PureBasic 4.60
;
#PropertyGrid_SectionFont = "Arial"
#PropertyGrid_ImageLineColor = $0000ff
#PropertyGrid_ImageBackgroundColor = $ffffff
#PropertyGrid_SectionNamePreSpace = #True
Macro OS_Select ( variable, windows, linux, macos, def )
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows : variable = windows
CompilerCase #PB_OS_Linux : variable = linux
CompilerCase #PB_OS_MacOS : variable = macos
CompilerDefault : variable = def
CompilerEndSelect
EndMacro
OS_Select ( #PropertyGrid_DefaultItemHeight, 20, 22, 25, 20 )
OS_Select ( #PropertyGrid_SectionFontSize, 10, 10, 14, 12 )
Structure PropertyGridGadgetSubItem
DescriptionGadget.i
ItemGadget.i
EndStructure
Structure PropertyGridItem
SectionDescriptionGadget.i
SectionButtonGadget.i
IsSection.i
IsLocked.b
Opened.i
PopupMenu.i
test.l[4096]
List SubItems.PropertyGridGadgetSubItem()
EndStructure
Structure PropertyGridData
GridID.l
ItemHeight.i
Font.i
backColor.q
frontColor.q
Window.i
PopupMenu.i
test.l[4096]
List Items.PropertyGridItem()
EndStructure
Structure PropertyGridInfo
ID.l
Parent.i
test.l[4096]
EndStructure
Structure PropertyGridPopup
GridGadget.i
MenuItem.i
Parent.i
Item.i
EndStructure
Global NewList PopupMenuItems.PropertyGridPopup()
Global LastPopupMenuItem.i = -1
Procedure __GetPropertyGridImage ( state.i )
Static openImage.i, closeImage.i, lockImage.i, defaultImage.i
If Not defaultImage
defaultImage = CreateImage ( #PB_Any, 11, 11, 24 )
If defaultImage And StartDrawing ( ImageOutput ( defaultImage ) )
Box ( 0, 0, 11, 11, #PropertyGrid_ImageBackgroundColor )
DrawingMode ( #PB_2DDrawing_Outlined )
Box ( 0, 0, 11, 11, #PropertyGrid_ImageLineColor )
StopDrawing()
EndIf
EndIf
If Not openImage
openImage = CopyImage ( defaultImage, #PB_Any )
If openImage And StartDrawing ( ImageOutput ( openImage ) )
LineXY ( 2, 5, 8, 5, #PropertyGrid_ImageLineColor )
StopDrawing ( )
EndIf
EndIf
If Not closeImage
closeImage = CopyImage ( openImage, #PB_Any )
If closeImage And StartDrawing( ImageOutput ( closeImage ) )
LineXY ( 5, 2, 5, 8, #PropertyGrid_ImageLineColor )
StopDrawing ( )
EndIf
EndIf
If Not lockImage
lockImage = CopyImage ( defaultImage, #PB_Any )
If lockImage And StartDrawing( ImageOutput ( lockImage ) )
Box ( 3, 3, 5, 5, #PropertyGrid_ImageLineColor )
StopDrawing ( )
EndIf
EndIf
Select state
Case 0 : ProcedureReturn closeImage
Case 1 : ProcedureReturn openImage
Case 2 : ProcedureReturn lockImage
Default : ProcedureReturn defaultImage
EndSelect
EndProcedure
Procedure UpdatePropertyGrid ( PropertyGridGadget )
*memory.PropertyGridData = GetGadgetData ( PropertyGridGadget )
If *memory
i = 0
height = *memory\ItemHeight
width = GadgetWidth ( PropertyGridGadget )
ForEach *memory\Items()
If *memory\Items()\IsSection
ResizeGadget( *memory\Items()\SectionDescriptionGadget, 20, i, width - 20, height - 1 )
ResizeGadget( *memory\Items()\SectionButtonGadget , 4, i + height * 0.5 - 6, 11, 11 )
Else
ResizeGadget( *memory\Items()\SectionDescriptionGadget, 20, i, width * 0.5 - 40, height - 1 )
ResizeGadget( *memory\Items()\SectionButtonGadget , width * 0.5 - 19, i, width * 0.5 - 4, height - 1 )
EndIf
i + height
If *memory\Items()\Opened
ForEach *memory\Items()\SubItems()
ResizeGadget( *memory\Items()\SubItems()\DescriptionGadget, 20, i, width * 0.5 - 40, height - 1)
ResizeGadget( *memory\Items()\SubItems()\ItemGadget , width * 0.5 - 19, i, width * 0.5 - 4, height - 1 )
i + height
Next
EndIf
Next
SetGadgetAttribute ( PropertyGridGadget, #PB_ScrollArea_InnerHeight, i )
SetGadgetAttribute ( PropertyGridGadget, #PB_ScrollArea_InnerWidth, width - 20 )
EndIf
EndProcedure
Procedure __SetSection ( PropertyGridGadget, section )
*memory.PropertyGridData = GetGadgetData ( PropertyGridGadget )
If *memory
If section = 0
LastElement( *memory\Items() )
OpenGadgetList ( PropertyGridGadget )
ProcedureReturn #True
EndIf
ForEach *memory\Items()
If *memory\Items()\SectionButtonGadget = section
OpenGadgetList ( PropertyGridGadget )
ProcedureReturn #True
EndIf
Next
EndIf
EndProcedure
Procedure __AddSectionItem ( PropertyGridGadget, section, Description.s, Gadget.i )
*memory.PropertyGridData = GetGadgetData ( PropertyGridGadget )
If *memory
descGadget = StringGadget ( #PB_Any, 0, 0, 0, 0, Description, #PB_String_ReadOnly )
;descGadget = TextGadget(#PB_Any,0,0,0,0,Description);,#PB_Text_Border)
;DisableGadget( descGadget, 1 )
If section = 0
If AddElement( *memory\Items() )
With *memory\Items()
\IsSection = 0
\IsLocked = #False
\SectionButtonGadget = Gadget
\SectionDescriptionGadget = descGadget
EndWith
CloseGadgetList()
UpdatePropertyGrid ( PropertyGridGadget )
ProcedureReturn #True
EndIf
Else
LastElement( *memory\Items()\SubItems() )
If AddElement( *memory\Items()\SubItems() )
With *memory\Items()\SubItems()
\DescriptionGadget = descGadget
\ItemGadget = Gadget
EndWith
CloseGadgetList()
If *memory\Items()\Opened
UpdatePropertyGrid(PropertyGridGadget)
Else
HideGadget ( *memory\Items()\SubItems()\DescriptionGadget, 1 )
HideGadget ( *memory\Items()\SubItems()\ItemGadget , 1 )
EndIf
ProcedureReturn #True
EndIf
EndIf
EndIf
FreeGadget ( Gadget )
EndProcedure
Procedure __SetGadgetColor ( gadget, color_type, color )
If color <> -1
SetGadgetColor ( gadget, color_type, color )
EndIf
EndProcedure
Procedure __AddPopupMenuItem ( PropertyGridGadget, button, menu_item, text.s )
LastPopupMenuItem + 1
AddElement ( PopupMenuItems() )
PopupMenuItems()\GridGadget = PropertyGridGadget
PopupMenuItems()\Item = LastPopupMenuItem
PopupMenuItems()\MenuItem = menu_item
PopupMenuItems()\Parent = button
MenuItem ( LastPopupMenuItem, text )
EndProcedure
Procedure PropertyGridGadget ( gadgetNr, window, x, y, width, height, backColor.q = -1, frontColor.q = -1, flags = #PB_ScrollArea_Single )
gadget = ScrollAreaGadget ( gadgetNr, x, y, width, height, width - 20, 1, #PropertyGrid_DefaultItemHeight, flags )
If gadget
If gadgetNr = #PB_Any : gadgetNr = gadget : EndIf
__SetGadgetColor ( gadgetNr, #PB_Gadget_BackColor, backColor )
__SetGadgetColor ( gadgetNr, #PB_Gadget_FrontColor, frontColor )
*memory.PropertyGridData = AllocateMemory( SizeOf ( PropertyGridData ) )
If Not *memory
FreeGadget(gadgetNr)
ProcedureReturn 0
EndIf
InitializeStructure ( *memory,PropertyGridData )
With *memory
\ItemHeight = #PropertyGrid_DefaultItemHeight
\Font = LoadFont ( #PB_Any, #PropertyGrid_SectionFont, #PropertyGrid_SectionFontSize, #PB_Font_Bold )
\backColor = backColor
\frontColor = frontColor
\Window = window
EndWith
SetGadgetData ( gadgetNr, *memory )
CloseGadgetList()
EndIf
ProcedureReturn gadgetNr
EndProcedure
Procedure AddSection ( PropertyGridGadget, sectionName.s, open.i = 1, backColor.q = -1, frontColor.q = -1 )
If #PropertyGrid_SectionNamePreSpace = #True
sectionName = " " + sectionName
EndIf
*memory.PropertyGridData = GetGadgetData ( PropertyGridGadget )
If *memory
LastElement( *memory\Items() )
If AddElement( *memory\Items() )
OpenGadgetList ( PropertyGridGadget )
width = GadgetWidth ( PropertyGridGadget )
height = *memory\ItemHeight
gadget = TextGadget ( #PB_Any, 20, 0, width - 20, height, sectionName )
With *memory\Items()
\SectionDescriptionGadget = gadget
\SectionButtonGadget = ImageGadget ( #PB_Any, 0, 0, 0, 0, ImageID ( __GetPropertyGridImage ( open ) ) )
\Opened = open
\IsSection = 1
\IsLocked = #False
If \SectionButtonGadget
PopupMenu = CreatePopupMenu ( #PB_Any )
If PopupMenu
__AddPopupMenuItem ( PropertyGridGadget, \SectionButtonGadget, 1, "Expand All" )
__AddPopupMenuItem ( PropertyGridGadget, \SectionButtonGadget, 2, "Colapse All" )
__AddPopupMenuItem ( PropertyGridGadget, \SectionButtonGadget, 3, "Lock / Unlock" )
\PopupMenu = PopupMenu
EndIf
*memory_button.PropertyGridInfo = AllocateMemory ( SizeOf ( PropertyGridInfo ) )
If *memory_button
*memory_button\ID = $44495247
*memory_button\Parent = PropertyGridGadget
EndIf
SetGadgetData ( \SectionButtonGadget, *memory_button )
EndIf
EndWith
If backColor = -1 : backColor = *memory\backColor : EndIf
If frontColor = -1 : frontColor = *memory\frontColor : EndIf
SetGadgetFont ( gadget, FontID ( *memory\Font ) )
__SetGadgetColor ( gadget, #PB_Gadget_BackColor, backColor )
__SetGadgetColor ( gadget, #PB_Gadget_FrontColor, frontColor )
CloseGadgetList()
UpdatePropertyGrid ( PropertyGridGadget )
ProcedureReturn *memory\Items()\SectionButtonGadget
EndIf
EndIf
EndProcedure
Procedure LockSection ( PropertyGridGadget, Section, Lock )
*memory.PropertyGridData = GetGadgetData ( PropertyGridGadget )
If *memory
ForEach *memory\Items()
If *memory\Items()\SectionButtonGadget = Section
*memory\Items()\IsLocked = Lock
If Lock = #True
image_number = 2
Else
image_number = *memory\Items()\Opened
EndIf
SetGadgetState ( *memory\Items()\SectionButtonGadget, ImageID ( __GetPropertyGridImage ( image_number ) ) )
Break
EndIf
Next
EndIf
EndProcedure
Procedure ChangeSectionState ( *memory.PropertyGridItem, state )
If state = 2
*memory\Opened ! 1
Else
*memory\Opened = state
EndIf
SetGadgetState ( *memory\SectionButtonGadget, ImageID ( __GetPropertyGridImage ( *memory\Opened ) ) )
ForEach *memory\SubItems()
HideGadget( *memory\SubItems()\DescriptionGadget , 1 - *memory\Opened )
HideGadget( *memory\SubItems()\ItemGadget , 1 - *memory\Opened )
Next
EndProcedure
Procedure CheckPropertyGridSectionClick ( PropertyGridGadget, EventGadget, EventType )
*memory.PropertyGridData = GetGadgetData ( PropertyGridGadget )
If *memory
ForEach *memory\Items()
If EventGadget = *memory\Items()\SectionButtonGadget
If EventType = #PB_EventType_LeftClick And *memory\Items()\IsLocked = #False
ChangeSectionState ( *memory\Items(), 2 )
UpdatePropertyGrid ( PropertyGridGadget )
ProcedureReturn
EndIf
If EventType = #PB_EventType_RightClick And *memory\Items()\PopupMenu <> 0
DisplayPopupMenu ( *memory\Items()\PopupMenu, WindowID ( *memory\Window ) )
EndIf
EndIf
Next
EndIf
EndProcedure
Procedure SectionActions ( PropertyGridGadget, Section, Action )
*memory.PropertyGridData = GetGadgetData ( PropertyGridGadget )
If *memory
ForEach *memory\Items()
Select Action
Case 1
If *memory\Items()\IsLocked = #False
ChangeSectionState ( *memory\Items(), 1 )
EndIf
Case 2
If *memory\Items()\IsLocked = #False
ChangeSectionState ( *memory\Items(), 0 )
EndIf
Case 3
If Section = *memory\Items()\SectionButtonGadget
If *memory\Items()\IsLocked = #True
LockSection ( PropertyGridGadget, Section, #False )
Else
LockSection ( PropertyGridGadget, Section, #True )
EndIf
ProcedureReturn
EndIf
EndSelect
Next
UpdatePropertyGrid ( PropertyGridGadget )
EndIf
EndProcedure
;---[ PropertyGrid Gadgets ]---
Macro AddGridGadget ( PGG, Section, GadgetNr )
If __SetSection ( PGG, Section )
gadget = GadgetNr
If __AddSectionItem ( PGG, Section, Description, gadget )
ProcedureReturn gadget
EndIf
Else
FreeGadget ( GadgetNr )
EndIf
EndMacro
Procedure AddStringGadget ( PropertyGridGadget, section, Description.s, Content.s, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, StringGadget ( #PB_Any, 0, 0, 0, 0, Content, flags ) )
EndProcedure
Procedure AddCheckBoxGadget ( PropertyGridGadget, section, Description.s, Text.s, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, CheckBoxGadget ( #PB_Any, 0, 0, 0, 0, Text, flags ) )
EndProcedure
Procedure AddButtonGadget ( PropertyGridGadget, section, Description.s, Text.s, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, ButtonGadget ( #PB_Any, 0, 0, 0, 0, Text, flags ) )
EndProcedure
Procedure AddComboBoxGadget ( PropertyGridGadget, section, Description.s, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, ComboBoxGadget ( #PB_Any, 0, 0, 0, 0, flags ) )
EndProcedure
Procedure AddProgressBarGadget ( PropertyGridGadget, section, Description.s, Minimum, Maximum, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, ProgressBarGadget ( #PB_Any, 0, 0, 0, 0, Minimum, Maximum, flags ) )
EndProcedure
Procedure AddSpinGadget ( PropertyGridGadget, section, Description.s, Minimum, Maximum, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, SpinGadget ( #PB_Any, 0, 0, 0, 0, Minimum, Maximum, flags ) )
EndProcedure
Procedure AddTrackBarGadget ( PropertyGridGadget, section, Description.s, Minimum, Maximum, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, TrackBarGadget ( #PB_Any, 0, 0, 0, 0, Minimum, Maximum, flags ) )
EndProcedure
Procedure AddSplitterGadget ( PropertyGridGadget, section, Description.s, Gadget1, Gadget2, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, SplitterGadget ( #PB_Any, 0, 0, 0, 0, Gadget1, Gadget2, flags ) )
EndProcedure
Procedure AddIPAddressGadget ( PropertyGridGadget, section, Description.s )
AddGridGadget ( PropertyGridGadget, section, IPAddressGadget ( #PB_Any, 0, 0, 120, #PropertyGrid_DefaultItemHeight ) )
EndProcedure
Procedure AddShortcutGadget ( PropertyGridGadget, section, Description.s, Shortcut )
AddGridGadget ( PropertyGridGadget, section, ShortcutGadget ( #PB_Any, 0, 0, 0, 0, Shortcut ) )
EndProcedure
Procedure AddDateGadget ( PropertyGridGadget, section, Description.s, Mask$ = "", Date = 0, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, DateGadget ( #PB_Any, 0, 0, 0, 0, Mask$, Date, flags ) )
EndProcedure
Procedure AddHyperLinkGadget ( PropertyGridGadget, section, Description.s, Text$, Color, flags = 0 )
AddGridGadget ( PropertyGridGadget, section, HyperLinkGadget ( #PB_Any, 0, 0, 0, 0, Text$, Color, flags ) )
EndProcedure
Procedure IsGridGadget ( Gadget )
*memory.PropertyGridInfo = GetGadgetData ( Gadget )
If *memory
If *memory\ID = $44495247
ProcedureReturn *memory\Parent
EndIf
EndIf
ProcedureReturn 0
EndProcedure
;---------------------------------------------------------------------
Procedure AddComboBox_FalseTrue(PropertyGridGadget,section,Description.s,FalseTrue.i)
combo = AddComboBoxGadget(PropertyGridGadget,section,Description)
AddGadgetItem(combo,-1,"False")
AddGadgetItem(combo,-1,"True")
SetGadgetState(combo,FalseTrue)
ProcedureReturn combo
EndProcedure
main_window = OpenWindow ( #PB_Any,0,0,800,600,"PropertyGrid",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible)
prop = PropertyGridGadget(#PB_Any, main_window, 10, 10, 300, 580);,RGB($80,$80,$80),RGB($00,$00,$00))
section1 = AddSection(prop,"Section 1", 1, $ffcc00 )
string1 = AddStringGadget(prop,section1,"String","Item 1")
string2 = AddStringGadget(prop,section1,"Number","123456",#PB_String_Numeric)
spin1 = AddSpinGadget (prop,section1,"SpinGadget",1,100,#PB_Spin_Numeric)
SetGadgetText(spin1,"1")
split = AddSplitterGadget(prop,section1,"Splitter",ButtonGadget(#PB_Any,0,0,50,0,"1"),ButtonGadget(#PB_Any,0,0,50,0,"2"),#PB_Splitter_Vertical)
SetGadgetAttribute(split,#PB_Splitter_FirstMinimumSize,50)
SetGadgetAttribute(split,#PB_Splitter_SecondMinimumSize,50)
AddTrackBarGadget(prop,section1,"Trackbar",1,100)
LockSection ( prop, section1, #True )
section2 = AddSection(prop,"Section 2", 1, $00ccff)
combo1 = AddComboBoxGadget(prop,section2,"Combobox 1")
For i = 1 To 10 : AddGadgetItem(combo1,-1,"Item "+Str(i)) : Next
check1 = AddCheckBoxGadget(prop,section2,"Checkbox 1","Check me!")
btn1 = AddButtonGadget (prop,section2,"Choose Directory","...")
section3 = AddSection(prop,"Section 3")
progress = AddProgressBarGadget(prop,section3,"Progress",0,100)
SetGadgetState(progress,40)
AddShortcutGadget(prop,section3,"Shortcut",0)
AddDateGadget(prop,section3,"Date")
AddHyperLinkGadget(prop,section3,"Hyperlink","Hyper Hyper!",RGB($00,$00,$FF))
ip = AddIPAddressGadget(prop,section3,"IP Address")
SetGadgetState(ip, MakeIPAddress(127, 0, 0, 1))
For i = 4 To 20
sec = AddSection(prop,"Section "+Str(i),0)
For j = 1 To 10
AddStringGadget(prop,sec,"Description "+Str(j),"Item "+Str(j))
Next j
Next i
prop2 = PropertyGridGadget(#PB_Any, main_window, 330,10,450,280,RGB($40,$40,$40),RGB($FF,$FF,$FF))
For i = 1 To 20
sec = AddSection(prop2,"Section "+Str(i),0)
For j = 1 To 10
AddStringGadget(prop2,sec,"Section "+Str(i)+", Field "+Str(j),"Item "+Str(j))
Next j
Next i
prop3 = PropertyGridGadget(#PB_Any, main_window, 330,300,300,280,-1,-1,#PB_ScrollArea_Flat)
AddComboBox_FalseTrue(prop3,0,"AllowDrop" ,#False)
AddComboBox_FalseTrue(prop3,0,"Enabled" ,#True)
AddComboBox_FalseTrue(prop3,0,"FullRowSelect",#False)
AddComboBox_FalseTrue(prop3,0,"HideSelection",#True)
AddComboBox_FalseTrue(prop3,0,"HotTracking" ,#False)
spinImgIdx = AddSpinGadget (prop3,0,"ImageIndex",1,100,#PB_Spin_Numeric) : SetGadgetText(spinImgIdx,"1")
secImageSize = AddSection(prop3,"ImageSize",0)
spinImgWidth = AddSpinGadget (prop3,secImageSize,"Width ",1,100,#PB_Spin_Numeric) : SetGadgetText(spinImgWidth ,"32")
spinImgHeight = AddSpinGadget (prop3,secImageSize,"Height",1,100,#PB_Spin_Numeric) : SetGadgetText(spinImgHeight,"32")
While WindowEvent():Wend
HideWindow(main_window,0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Menu
ResetList ( PopupMenuItems() )
ForEach PopupMenuItems()
If PopupMenuItems()\Item = EventMenu()
SectionActions ( PopupMenuItems()\GridGadget, PopupMenuItems()\Parent, PopupMenuItems()\MenuItem )
EndIf
Next
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
Select EventGadget
Case btn1
MessageRequester("INFO","Button pressed")
LockSection ( prop, section1, #False )
Default
GridGagdet = IsGridGadget ( EventGadget )
If GridGagdet
CheckPropertyGridSectionClick ( GridGagdet, EventGadget, EventType )
EndIf
EndSelect
EndSelect
ForEver |
|
0
|