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 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 16223 16224 16225 16226 16227 16228 16229 16230 16231 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 16418 16419 16420 16421 16422 16423 16424 16425 16426 16427 16428 16429 16430 16431 16432 16433 16434 16435 16436 16437 16438 16439 16440 16441 16442 16443 16444 16445 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 16459 16460 16461 16462 16463 16464 16465 16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 16480 16481 16482 16483 16484 16485 16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 16565 16566 16567 16568 16569 16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628 16629 16630 16631 16632 16633 16634 16635 16636 16637 16638 16639 16640 16641 16642 16643 16644 16645 16646 16647 16648 16649 16650 16651 16652 16653 16654 16655 16656 16657 16658 16659 16660 16661 16662 16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 16686 16687 16688 16689 16690 16691 16692 16693 16694 16695 16696 16697 16698 16699 16700 16701 16702 16703 16704 16705 16706 16707 16708 16709 16710 16711 16712 16713 16714 16715 16716 16717 16718 16719 16720 16721 16722 16723 16724 16725 16726 16727 16728 16729 16730 16731 16732 16733 16734 16735 16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 17029 17030 17031 17032 17033 17034 17035 17036 17037 17038 17039 17040 17041 17042 17043 17044 17045 17046 17047 17048 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 17059 17060 17061 17062 17063 17064 17065 17066 17067 17068 17069 17070 17071 17072 17073 17074 17075 17076 17077 17078 17079 17080 17081 17082 17083 17084 17085 17086 17087 17088 17089 17090 17091 17092 17093 17094 17095 17096 17097 17098 17099 17100 17101 17102 17103 17104 17105 17106 17107 17108 17109 17110 17111 17112 17113 17114 17115 17116 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127 17128 17129 17130 17131 17132 17133 17134 17135 17136 17137 17138 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 17149 17150 17151 17152 17153 17154 17155 17156 17157 17158 17159 17160 17161 17162 17163 17164 17165 17166 17167 17168 17169 17170 17171 17172 17173 17174 17175 17176 17177 17178 17179 17180 17181 17182 17183 17184 17185 17186 17187 17188 17189 17190 17191 17192 17193 17194 17195 17196 17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218 17219 17220 17221 17222 17223 17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 17234 17235 17236 17237 17238 17239 17240 17241 17242 17243 17244 17245 17246 17247 17248 17249 17250 17251 17252 17253 17254 17255 17256 17257 17258 17259 17260 17261 17262 17263 17264 17265 17266 17267 17268 17269 17270 17271 17272 17273 17274 17275 17276 17277 17278 17279 17280 17281 17282 17283 17284 17285 17286 17287 17288 17289 17290 17291 17292 17293 17294 17295 17296 17297 17298 17299 17300 17301 17302 17303 17304 17305 17306 17307 17308 17309 17310 17311 17312 17313 17314 17315 17316 17317 17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 17332 17333 17334 17335 17336 17337 17338 17339 17340 17341 17342 17343 17344 17345 17346 17347 17348 17349 17350 17351 17352 17353 17354 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 17365 17366 17367 17368 17369 17370 17371 17372 17373 17374 17375 17376 17377 17378 17379 17380 17381 17382 17383 17384 17385 17386 17387 17388 17389 17390 17391 17392 17393 17394 17395 17396 17397 17398 17399 17400 17401 17402 17403 17404 17405 17406 17407 17408 17409 17410 17411 17412 17413 17414 17415 17416 17417 17418 17419 17420 17421 17422 17423 17424 17425 17426 17427 17428 17429 17430 17431 17432 17433 17434 17435 17436 17437 17438 17439 17440 17441 17442 17443 17444 17445 17446 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 17459 17460 17461 17462 17463 17464 17465 17466 17467 17468 17469 17470 17471 17472 17473 17474 17475 17476 17477 17478 17479 17480 17481 17482 17483 17484 17485 17486 17487 17488 17489 17490 17491 17492 17493 17494 17495 17496 17497 17498 17499 17500 17501 17502 17503 17504 17505 17506 17507 17508 17509 17510 17511 17512 17513 17514 17515 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 17533 17534 17535 17536 17537 17538 17539 17540 17541 17542 17543 17544 17545 17546 17547 17548 17549 17550 17551 17552 17553 17554 17555 17556 17557 17558 17559 17560 17561 17562 17563 17564 17565 17566 17567 17568 17569 17570 17571 17572 17573 17574 17575 17576 17577 17578 17579 17580 17581 17582 17583 17584 17585 17586 17587 17588 17589 17590 17591 17592 17593 17594 17595 17596 17597 17598 17599 17600 17601 17602 17603 17604 17605 17606 17607 17608 17609 17610 17611 17612 17613 17614 17615 17616 17617 17618 17619 17620 17621 17622 17623 17624 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 17648 17649 17650 17651 17652 17653 17654 17655 17656 17657 17658 17659 17660 17661 17662 17663 17664 17665 17666 17667 17668 17669 17670 17671 17672 17673 17674 17675 17676 17677 17678 17679 17680 17681 17682 17683 17684 17685 17686 17687 17688 17689 17690 17691 17692 17693 17694 17695 17696 17697 17698 17699 17700 17701 17702 17703 17704 17705 17706 17707 17708 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 17742 17743 17744 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 17787 17788 17789 17790 17791 17792 17793 17794 17795 17796 17797 17798 17799 17800 17801 17802 17803 17804 17805 17806 17807 17808 17809 17810 17811 17812 17813 17814 17815 17816 17817 17818 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 17895 17896 17897 17898 17899 17900 17901 17902 17903 17904 17905 17906 17907 17908 17909 17910 17911 17912 17913 17914 17915 17916 17917 17918 17919 17920 17921 17922 17923 17924 17925 17926 17927 17928 17929 17930 17931 17932 17933 17934 17935 17936 17937 17938 17939 17940 17941 17942 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959 17960 17961 17962 17963 17964 17965 17966 17967 17968 17969 17970 17971 17972 17973 17974 17975 17976 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 18049 18050 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 18112 18113 18114 18115 18116 18117 18118 18119 18120 18121 18122 18123 18124 18125 18126 18127 18128 18129 18130 18131 18132 18133 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 18169 18170 18171 18172 18173 18174 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 18185 18186 18187 18188 18189 18190 18191 18192 18193 18194 18195 18196 18197 18198 18199 18200 18201 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 18215 18216 18217 18218 18219 18220 18221 18222 18223 18224 18225 18226 18227 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 18253 18254 18255 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 18271 18272 18273 18274 18275 18276 18277 18278 18279 18280 18281 18282 18283 18284 18285 18286 18287 18288 18289 18290 18291 18292 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 18332 18333 18334 18335 18336 18337 18338 18339 18340 18341 18342 18343 18344 18345 18346 18347 18348 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 18360 18361 18362 18363 18364 18365 18366 18367 18368 18369 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 18387 18388 18389 18390 18391 18392 18393 18394 18395 18396 18397 18398 18399 18400 18401 18402 18403 18404 18405 18406 18407 18408 18409 18410 18411 18412 18413 18414 18415 18416 18417 18418 18419 18420 18421 18422 18423 18424 18425 18426 18427 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 18441 18442 18443 18444 18445 18446 18447 18448 18449 18450 18451 18452 18453 18454 18455 18456 18457 18458 18459 18460 18461 18462 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 18474 18475 18476 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 18525 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 18550 18551 18552 18553 18554 18555 18556 18557 18558 18559 18560 18561 18562 18563 18564 18565 18566 18567 18568 18569 18570 18571 18572 18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 18589 18590 18591 18592 18593 18594 18595 18596 18597 18598 18599 18600 18601 18602 18603 18604 18605 18606 18607 18608 18609 18610 18611 18612 18613 18614 18615 18616 18617 18618 18619 18620 18621 18622 18623 18624 18625 18626 18627 18628 18629 18630 18631 18632 18633 18634 18635 18636 18637 18638 18639 18640 18641 18642 18643 18644 18645 18646 18647 18648 18649 18650 18651 18652 18653 18654 18655 18656 18657 18658 18659 18660 18661 18662 18663 18664 18665 18666 18667 18668 18669 18670 18671 18672 18673 18674 18675 18676 18677 18678 18679 18680 18681 18682 18683 18684 18685 18686 18687 18688 18689 18690 18691 18692 18693 18694 18695 18696 18697 18698 18699 18700 18701 18702 18703 18704 18705 18706 18707 18708 18709 18710 18711 18712 18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 18734 18735 18736 18737 18738 18739 18740 18741 18742 18743 18744 18745 18746 18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 18767 18768 18769 18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 18789 18790 18791 18792 18793 18794 18795 18796 18797 18798 18799 18800 18801 18802 18803 18804 18805 18806 18807 18808 18809 18810 18811 18812 18813 18814 18815 18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 18856 18857 18858 18859 18860 18861 18862 18863 18864 18865 18866 18867 18868 18869 18870 18871 18872 18873 18874 18875 18876 18877 18878 18879 18880 18881 18882 18883 18884 18885 18886 18887 18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 18902 18903 18904 18905 18906 18907 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 18920 18921 18922 18923 18924 18925 18926 18927 18928 18929 18930 18931 18932 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 18946 18947 18948 18949 18950 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 18979 18980 18981 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 19008 19009 19010 19011 19012 19013 19014 19015 19016 19017 19018 19019 19020 19021 19022 19023 19024 19025 19026 19027 19028 19029 19030 19031 19032 19033 19034 19035 19036 19037 19038 19039 19040 19041 19042 19043 19044 19045 19046 19047 19048 19049 19050 19051 19052 19053 19054 19055 19056 19057 19058 19059 19060 19061 19062 19063 19064 19065 19066 19067 19068 19069 19070 19071 19072 19073 19074 19075 19076 19077 19078 19079 19080 19081 19082 19083 19084 19085 19086 19087 19088 19089 19090 19091 19092 19093 19094 19095 19096 19097 19098 19099 19100 19101 19102 19103 19104 19105 19106 19107 19108 19109 19110 19111 19112 19113 19114 19115 19116 19117 19118 19119 19120 19121 19122 19123 19124 19125 19126 19127 19128 19129 19130 19131 19132 19133 19134 19135 19136 19137 19138 19139 19140 19141 19142 19143 19144 19145 19146 19147 19148 19149 19150 19151 19152 19153 19154 19155 19156 19157 19158 19159 19160 19161 19162 19163 19164 19165 19166 19167 19168 19169 19170 19171 19172 19173 19174 19175 19176 19177 19178 19179 19180 19181 19182 19183 19184 19185 19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 19198 19199 19200 19201 19202 19203 19204 19205 19206 19207 19208 19209 19210 19211 19212 19213 19214 19215 19216 19217 19218 19219 19220 19221 19222 19223 19224 19225 19226 19227 19228 19229 19230 19231 19232 19233 19234 19235 19236 19237 19238 19239 19240 19241 19242 19243 19244 19245 19246 19247 19248 19249 19250 19251 19252 19253 19254 19255 19256 19257 19258 19259 19260 19261 19262 19263 19264 19265 19266 19267 19268 19269 19270 19271 19272 19273 19274 19275 19276 19277 19278 19279 19280 19281 19282 19283 19284 19285 19286 19287 19288 19289 19290 19291 19292 19293 19294 19295 19296 19297 19298 19299 19300 19301 19302 19303 19304 19305 19306 19307 19308 19309 19310 19311 19312 19313 19314 19315 19316 19317 19318 19319 19320 19321 19322 19323 19324 19325 19326 19327 19328 19329 19330 19331 19332 19333 19334 19335 19336 19337 19338 19339 19340 19341 19342 19343 19344 19345 19346 19347 19348 19349 19350 19351 19352 19353 19354 19355 19356 19357 19358 19359 19360 19361 19362 19363 19364 19365 19366 19367 19368 19369 19370 19371 19372 19373 19374 19375 19376 19377 19378 19379 19380 19381 19382 19383 19384 19385 19386 19387 19388 19389 19390 19391 19392 19393 19394 19395 19396 19397 19398 19399 19400 19401 19402 19403 19404 19405 19406 19407 19408 19409 19410 19411 19412 19413 19414 19415 19416 19417 19418 19419 19420 19421 19422 19423 19424 19425 19426 19427 19428 19429 19430 19431 19432 19433 19434 19435 19436 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 19451 19452 19453 19454 19455 19456 19457 19458 19459 19460 19461 19462 19463 19464 19465 19466 19467 19468 19469 19470 19471 19472 19473 19474 19475 19476 19477 19478 19479 19480 19481 19482 19483 19484 19485 19486 19487 19488 19489 19490 19491 19492 19493 19494 19495 19496 19497 19498 19499 19500 19501 19502 19503 19504 19505 19506 19507 19508 19509 19510 19511 19512 19513 19514 19515 19516 19517 19518 19519 19520 19521 19522 19523 19524 19525 19526 19527 19528 19529 19530 19531 19532 19533 19534 19535 19536 19537 19538 19539 19540 19541 19542 19543 19544 19545 19546 19547 19548 19549 19550 19551 19552 19553 19554 19555 19556 19557 19558 19559 19560 19561 19562 19563 19564 19565 19566 19567 19568 19569 19570 19571 19572 19573 19574 19575 19576 19577 19578 19579 19580 19581 19582 19583 19584 19585 19586 19587 19588 19589 19590 19591 19592 19593 19594 19595 19596 19597 19598 19599 19600 19601 19602 19603 19604 19605 19606 19607 19608 19609 19610 19611 19612 19613 19614 19615 19616 19617 19618 19619 19620 19621 19622 19623 19624 19625 19626 19627 19628 19629 19630 19631 19632 19633 19634 19635 19636 19637 19638 19639 19640 19641 19642 19643 19644 19645 19646 19647 19648 19649 19650 19651 19652 19653 19654 19655 19656 19657 19658 19659 19660 19661 19662 19663 19664 19665 19666 19667 19668 19669 19670 19671 19672 19673 19674 19675 19676 19677 19678 19679 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 19690 19691 19692 19693 19694 19695 19696 19697 19698 19699 19700 19701 19702 19703 19704 19705 19706 19707 19708 19709 19710 19711 19712 19713 19714 19715 19716 19717 19718 19719 19720 19721 19722 19723 19724 19725 19726 19727 19728 19729 19730 19731 19732 19733 19734 19735 19736 19737 19738 19739 19740 19741 19742 19743 19744 19745 19746 19747 19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 19855 19856 19857 19858 19859 19860 19861 19862 19863 19864 19865 19866 19867 19868 19869 19870 19871 19872 19873 19874 19875 19876 19877 19878 19879 19880 19881 19882 19883 19884 19885 19886 19887 19888 19889 19890 19891 19892 19893 19894 19895 19896 19897 19898 19899 19900 19901 19902 19903 19904 19905 19906 19907 19908 19909 19910 19911 19912 19913 19914 19915 19916 19917 19918 19919 19920 19921 19922 19923 19924 19925 19926 19927 19928 19929 19930 19931 19932 19933 19934 19935 19936 19937 19938 19939 19940 19941 19942 19943 19944 19945 19946 19947 19948 19949 19950 19951 19952 19953 19954 19955 19956 19957 19958 19959 19960 19961 19962 19963 19964 19965 19966 19967 19968 19969 19970 19971 19972 19973 19974 19975 19976 19977 19978 19979 19980 19981 19982 19983 19984 19985 19986 19987 19988 19989 19990 19991 19992 19993 19994 19995 19996 19997 19998 19999 20000 20001 20002 20003 20004 20005 20006 20007 20008 20009 20010 20011 20012 20013 20014 20015 20016 20017 20018 20019 20020 20021 20022 20023 20024 20025 20026 20027 20028 20029 20030 20031 20032 20033 20034 20035 20036 20037 20038 20039 20040 20041 20042 20043 20044 20045 20046 20047 20048 20049 20050 20051 20052 20053 20054 20055 20056 20057 20058 20059 20060 20061 20062 20063 20064 20065 20066 20067 20068 20069 20070 20071 20072 20073 20074 20075 20076 20077 20078 20079 20080 20081 20082 20083 20084 20085 20086 20087 20088 20089 20090 20091 20092 20093 20094 20095 20096 20097 20098 20099 20100 20101 20102 20103 20104 20105 20106 20107 20108 20109 20110 20111 20112 20113 20114 20115 20116 20117 20118 20119 20120 20121 20122 20123 20124 20125 20126 20127 20128 20129 20130 20131 20132 20133 20134 20135 20136 20137 20138 20139 20140 20141 20142 20143 20144 20145 20146 20147 20148 20149 20150 20151 20152 20153 20154 20155 20156 20157 20158 20159 20160 20161 20162 20163 20164 20165 20166 20167 20168 20169 20170 20171 20172 20173 20174 20175 20176 20177 20178 20179 20180 20181 20182 20183 20184 20185 20186 20187 20188 20189 20190 20191 20192 20193 20194 20195 20196 20197 20198 20199 20200 20201 20202 20203 20204 20205 20206 20207 20208 20209 20210 20211 20212 20213 20214 20215 20216 20217 20218 20219 20220 20221 20222 20223 20224 20225 20226 20227 20228 20229 20230 20231 20232 20233 20234 20235 20236 20237 20238 20239 20240 20241 20242 20243 20244 20245 20246 20247 20248 20249 20250 20251 20252 20253 20254 20255 20256 20257 20258 20259 20260 20261 20262 20263 20264 20265 20266 20267 20268 20269 20270 20271 20272 20273 20274 20275 20276 20277 20278 20279 20280 20281 20282 20283 20284 20285 20286 20287 20288 20289 20290 20291 20292 20293 20294 20295 20296 20297 20298 20299 20300 20301 20302 20303 20304 20305 20306 20307 20308 20309 20310 20311 20312 20313 20314 20315 20316 20317 20318 20319 20320 20321 20322 20323 20324 20325 20326 20327 20328 20329 20330 20331 20332 20333 20334 20335 20336 20337 20338 20339 20340 20341 20342 20343 20344 20345 20346 20347 20348 20349 20350 20351 20352 20353 20354 20355 20356 20357 20358 20359 20360 20361 20362 20363 20364 20365 20366 20367 20368 20369 20370 20371 20372 20373 20374 20375 20376 20377 20378 20379 20380 20381 20382 20383 20384 20385 20386 20387 20388 20389 20390 20391 20392 20393 20394 20395 20396 20397 20398 20399 20400 20401 20402 20403 20404 20405 20406 20407 20408 20409 20410 20411 20412 20413 20414 20415 20416 20417 20418 20419 20420 20421 20422 20423 20424 20425 20426 20427 20428 20429 20430 20431 20432 20433 20434 20435 20436 20437 20438 20439 20440 20441 20442 20443 20444 20445 20446 20447 20448 20449 20450 20451 20452 20453 20454 20455 20456 20457 20458 20459 20460 20461 20462 20463 20464 20465 20466 20467 20468 20469 20470 20471 20472 20473 20474 20475 20476 20477 20478 20479 20480 20481 20482 20483 20484 20485 20486 20487 20488 20489 20490 20491 20492 20493 20494 20495 20496 20497 20498 20499 20500 20501 20502 20503 20504 20505 20506 20507 20508 20509 20510 20511 20512 20513 20514 20515 20516 20517 20518 20519 20520 20521 20522 20523 20524 20525 20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 20611 20612 20613 20614 20615 20616 20617 20618 20619 20620 20621 20622 20623 20624 20625 20626 20627 20628 20629 20630 20631 20632 20633 20634 20635 20636 20637 20638 20639 20640 20641 20642 20643 20644 20645 20646 20647 20648 20649 20650 20651 20652 20653 20654 20655 20656 20657 20658 20659 20660 20661 20662 20663 20664 20665 20666 20667 20668 20669 20670 20671 20672 20673 20674 20675 20676 20677 20678 20679 20680 20681 20682 20683 20684 20685 20686 20687 20688 20689 20690 20691 20692 20693 20694 20695 20696 20697 20698 20699 20700 20701 20702 20703 20704 20705 20706 20707 20708 20709 20710 20711 20712 20713 20714 20715 20716 20717 20718 20719 20720 20721 20722 20723 20724 20725 20726 20727 20728 20729 20730 20731 20732 20733 20734 20735 20736 20737 20738 20739 20740 20741 20742 20743 20744 20745 20746 20747 20748 20749 20750 20751 20752 20753 20754 20755 20756 20757 20758 20759 20760 20761 20762 20763 20764 20765 20766 20767 20768 20769 20770 20771 20772 20773 20774 20775 20776 20777 20778 20779 20780 20781 20782 20783 20784 20785 20786 20787 20788 20789 20790 20791 20792 20793 20794 20795 20796 20797 20798 20799 20800 20801 20802 20803 20804 20805 20806 20807 20808 20809 20810 20811 20812 20813 20814 20815 20816 20817 20818 20819 20820 20821 20822 20823 20824 20825 20826 20827 20828 20829 20830 20831 20832 20833 20834 20835 20836 20837 20838 20839 20840 20841 20842 20843 20844 20845 20846 20847 20848 20849 20850 20851 20852 20853 20854 20855 20856 20857 20858 20859 20860 20861 20862 20863 20864 20865 20866 20867 20868 20869 20870 20871 20872 20873 20874 20875 20876 20877 20878 20879 20880 20881 20882 20883 20884 20885 20886 20887 20888 20889 20890 20891 20892 20893 20894 20895 20896 20897 20898 20899 20900 20901 20902 20903 20904 20905 20906 20907 20908 20909 20910 20911 20912 20913 20914 20915 20916 20917 20918 20919 20920 20921 20922 20923 20924 20925 20926 20927 20928 20929 20930 20931 20932 20933 20934 20935 20936 20937 20938 20939 20940 20941 20942 20943 20944 20945 20946 20947 20948 20949 20950 20951 20952 20953 20954 20955 20956 20957 20958 20959 20960 20961 20962 20963 20964 20965 20966 20967 20968 20969 20970 20971 20972 20973 20974 20975 20976 20977 20978 20979 20980 20981 20982 20983 20984 20985 20986 20987 20988 20989 20990 20991 20992 20993 20994 20995 20996 20997 20998 20999 21000 21001 21002 21003 21004 21005 21006 21007 21008 21009 21010 21011 21012 21013 21014 21015 21016 21017 21018 21019 21020 21021 21022 21023 21024 21025 21026 21027 21028 21029 21030 21031 21032 21033 21034 21035 21036 21037 21038 21039 21040 21041 21042 21043 21044 21045 21046 21047 21048 21049 21050 21051 21052 21053 21054 21055 21056 21057 21058 21059 21060 21061 21062 21063 21064 21065 21066 21067 21068 21069 21070 21071 21072 21073 21074 21075 21076 21077 21078 21079 21080 21081 21082 21083 21084 21085 21086 21087 21088 21089 21090 21091 21092 21093 21094 21095 21096 21097 21098 21099 21100 21101 21102 21103 21104 21105 21106 21107 21108 21109 21110 21111 21112 21113 21114 21115 21116 21117 21118 21119 21120 21121 21122 21123 21124 21125 21126 21127 21128 21129 21130 21131 21132 21133 21134 21135 21136 21137 21138 21139 21140 21141 21142 21143 21144 21145 21146 21147 21148 21149 21150 21151 21152 21153 21154 21155 21156 21157 21158 21159 21160 21161 21162 21163 21164 21165 21166 21167 21168 21169 21170 21171 21172 21173 21174 21175 21176 21177 21178 21179 21180 21181 21182 21183 21184 21185 21186 21187 21188 21189 21190 21191 21192 21193 21194 21195 21196 21197 21198 21199 21200 21201 21202 21203 21204 21205 21206 21207 21208 21209 21210 21211 21212 21213 21214 21215 21216 21217 21218 21219 21220 21221 21222 21223 21224 21225 21226 21227 21228 21229 21230 21231 21232 21233 21234 21235 21236 21237 21238 21239 21240 21241 21242 21243 21244 21245 21246 21247 21248 21249 21250 21251 21252 21253 21254 21255 21256 21257 21258 21259 21260 21261 21262 21263 21264 21265 21266 21267 21268 21269 21270 21271 21272 21273 21274 21275 21276 21277 21278 21279 21280 21281 21282 21283 21284 21285 21286 21287 21288 21289 21290 21291 21292 21293 21294 21295 21296 21297 21298 21299 21300 21301 21302 21303 21304 21305 21306 21307 21308 21309 21310 21311 21312 21313 21314 21315 21316 21317 21318 21319 21320 21321 21322 21323 21324 21325 21326 21327 21328 21329 21330 21331 21332 21333 21334 21335 21336 21337 21338 21339 21340 21341 21342 21343 21344 21345 21346 21347 21348 21349 21350 21351 21352 21353 21354 21355 21356 21357 21358 21359 21360 21361 21362 21363 21364 21365 21366 21367 21368 21369 21370 21371 21372 21373 21374 21375 21376 21377 21378 21379 21380 21381 21382 21383 21384 21385 21386 21387 21388 21389 21390 21391 21392 21393 21394 21395 21396 21397 21398 21399 21400 21401 21402 21403 21404 21405 21406 21407 21408 21409 21410 21411 21412 21413 21414 21415 21416 21417 21418 21419 21420 21421 21422 21423 21424 21425 21426 21427 21428 21429 21430 21431 21432 21433 21434 21435 21436 21437 21438 21439 21440 21441 21442 21443 21444 21445 21446 21447 21448 21449 21450 21451 21452 21453 21454 21455 21456 21457 21458 21459 21460 21461 21462 21463 21464 21465 21466 21467 21468 21469 21470 21471 21472 21473 21474 21475 21476 21477 21478 21479 21480 21481 21482 21483 21484 21485 21486 21487 21488 21489 21490 21491 21492 21493 21494 21495 21496 21497 21498 21499 21500 21501 21502 21503 21504 21505 21506 21507 21508 21509 21510 21511 21512 21513 21514 21515 21516 21517 21518 21519 21520 21521 21522 21523 21524 21525 21526 21527 21528 21529 21530 21531 21532 21533 21534 21535 21536 21537 21538 21539 21540 21541 21542 21543 21544 21545 21546 21547 21548 21549 21550 21551 21552 21553 21554 21555 21556 21557 21558 21559 21560 21561 21562 21563 21564 21565 21566 21567 21568 21569 21570 21571 21572 21573 21574 21575 21576 21577 21578 21579 21580 21581 21582 21583 21584 21585 21586 21587 21588 21589 21590 21591 21592 21593 21594 21595 21596 21597 21598 21599 21600 21601 21602 21603 21604 21605 21606 21607 21608 21609 21610 21611 21612 21613 21614 21615 21616 21617 21618 21619 21620 21621 21622 21623 21624 21625 21626 21627 21628 21629 21630 21631 21632 21633 21634 21635 21636 21637 21638 21639 21640 21641 21642 21643 21644 21645 21646 21647 21648 21649 21650 21651 21652 21653 21654 21655 21656 21657 21658 21659 21660 21661 21662 21663 21664 21665 21666 21667 21668 21669 21670 21671 21672 21673 21674 21675 21676 21677 21678 21679 21680 21681 21682 21683 21684 21685 21686 21687 21688 21689 21690 21691 21692 21693 21694 21695 21696 21697 21698 21699 21700 21701 21702 21703 21704 21705 21706 21707 21708 21709 21710 21711 21712 21713 21714 21715 21716 21717 21718 21719 21720 21721 21722 21723 21724 21725 21726 21727 21728 21729 21730 21731 21732 21733 21734 21735 21736 21737 21738 21739 21740 21741 21742 21743 21744 21745 21746 21747 21748 21749 21750 21751 21752 21753 21754 21755 21756 21757 21758 21759 21760 21761 21762 21763 21764 21765 21766 21767 21768 21769 21770 21771 21772 21773 21774 21775 21776 21777 21778 21779 21780 21781 21782 21783 21784 21785 21786 21787 21788 21789 21790 21791 21792 21793 21794 21795 21796 21797 21798 21799 21800 21801 21802 21803 21804 21805 21806 21807 21808 21809 21810 21811 21812 21813 21814 21815 21816 21817 21818 21819 21820 21821 21822 21823 21824 21825 21826 21827 21828 21829 21830 21831 21832 21833 21834 21835 21836 21837 21838 21839 21840 21841 21842 21843 21844 21845 21846 21847 21848 21849 21850 21851 21852 21853 21854 21855 21856 21857 21858 21859 21860 21861 21862 21863 21864 21865 21866 21867 21868 21869 21870 21871 21872 21873 21874 21875 21876 21877 21878 21879 21880 21881 21882 21883 21884 21885 21886 21887 21888 21889 21890 21891 21892 21893 21894 21895 21896 21897 21898 21899 21900 21901 21902 21903 21904 21905 21906 21907 21908 21909 21910 21911 21912 21913 21914 21915 21916 21917 21918 21919 21920 21921 21922 21923 21924 21925 21926 21927 21928 21929 21930 21931 21932 21933 21934 21935 21936 21937 21938 21939 21940 21941 21942 21943 21944 21945 21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 21957 21958 21959 21960 21961 21962 21963 21964 21965 21966 21967 21968 21969 21970 21971 21972 21973 21974 21975 21976 21977 21978 21979 21980 21981 21982 21983 21984 21985 21986 21987 21988 21989 21990 21991 21992 21993 21994 21995 21996 21997 21998 21999 22000 22001 22002 22003 22004 22005 22006 22007 22008 22009 22010 22011 22012 22013 22014 22015 22016 22017 22018 22019 22020 22021 22022 22023 22024 22025 22026 22027 22028 22029 22030 22031 22032 22033 22034 22035 22036 22037 22038 22039 22040 22041 22042 22043 22044 22045 22046 22047 22048 22049 22050 22051 22052 22053 22054 22055 22056 22057 22058 22059 22060 22061 22062 22063 22064 22065 22066 22067 22068 22069 22070 22071 22072 22073 22074 22075 22076 22077 22078 22079 22080 22081 22082 22083 22084 22085 22086 22087 22088 22089 22090 22091 22092 22093 22094 22095 22096 22097 22098 22099 22100 22101 22102 22103 22104 22105 22106 22107 22108 22109 22110 22111 22112 22113 22114 22115 22116 22117 22118 22119 22120 22121 22122 22123 22124 22125 22126 22127 22128 22129 22130 22131 22132 22133 22134 22135 22136 22137 22138 22139 22140 22141 22142 22143 22144 22145 22146 22147 22148 22149 22150 22151 22152 22153 22154 22155 22156 22157 22158 22159 22160 22161 22162 22163 22164 22165 22166 22167 22168 22169 22170 22171 22172 22173 22174 22175 22176 22177 22178 22179 22180 22181 22182 22183 22184 22185 22186 22187 22188 22189 22190 22191 22192 22193 22194 22195 22196 22197 22198 22199 22200 22201 22202 22203 22204 22205 22206 22207 22208 22209 22210 22211 22212 22213 22214 22215 22216 22217 22218 22219 22220 22221 22222 22223 22224 22225 22226 22227 22228 22229 22230 22231 22232 22233 22234 22235 22236 22237 22238 22239 22240 22241 22242 22243 22244 22245 22246 22247 22248 22249 22250 22251 22252 22253 22254 22255 22256 22257 22258 22259 22260 22261 22262 22263 22264 22265 22266 22267 22268 22269 22270 22271 22272 22273 22274 22275 22276 22277 22278 22279 22280 22281 22282 22283 22284 22285 22286 22287 22288 22289 22290 22291 22292 22293 22294 22295 22296 22297 22298 22299 22300 22301 22302 22303 22304 22305 22306 22307 22308 22309 22310 22311 22312 22313 22314 22315 22316 22317 22318 22319 22320 22321 22322 22323 22324 22325 22326 22327 22328 22329 22330 22331 22332 22333 22334 22335 22336 22337 22338 22339 22340 22341 22342 22343 22344 22345 22346 22347 22348 22349 22350 22351 22352 22353 22354 22355 22356 22357 22358 22359 22360 22361 22362 22363 22364 22365 22366 22367 22368 22369 22370 22371 22372 22373 22374 22375 22376 22377 22378 22379 22380 22381 22382 22383 22384 22385 22386 22387 22388 22389 22390 22391 22392 22393 22394 22395 22396 22397 22398 22399 22400 22401 22402 22403 22404 22405 22406 22407 22408 22409 22410 22411 22412 22413 22414 22415 22416 22417 22418 22419 22420 22421 22422 22423 22424 22425 22426 22427 22428 22429 22430 22431 22432 22433 22434 22435 22436 22437 22438 22439 22440 22441 22442 22443 22444 22445 22446 22447 22448 22449 22450 22451 22452 22453 22454 22455 22456 22457 22458 22459 22460 22461 22462 22463 22464 22465 22466 22467 22468 22469 22470 22471 22472 22473 22474 22475 22476 22477 22478 22479 22480 22481 22482 22483 22484 22485 22486 22487 22488 22489 22490 22491 22492 22493 22494 22495 22496 22497 22498 22499 22500 22501 22502 22503 22504 22505 22506 22507 22508 22509 22510 22511 22512 22513 22514 22515 22516 22517 22518 22519 22520 22521 22522 22523 22524 22525 22526 22527 22528 22529 22530 22531 22532 22533 22534 22535 22536 22537 22538 22539 22540 22541 22542 22543 22544 22545 22546 22547 22548 22549 22550 22551 22552 22553 22554 22555 22556 22557 22558 22559 22560 22561 22562 22563 22564 22565 22566 22567 22568 22569 22570 22571 22572 22573 22574 22575 22576 22577 22578 22579 22580 22581 22582 22583 22584 22585 22586 22587 22588 22589 22590 22591 22592 22593 22594 22595 22596 22597 22598 22599 22600 22601 22602 22603 22604 22605 22606 22607 22608 22609 22610 22611 22612 22613 22614 22615 22616 22617 22618 22619 22620 22621 22622 22623 22624 22625 22626 22627 22628 22629 22630 22631 22632 22633 22634 22635 22636 22637 22638 22639 22640 22641 22642 22643 22644 22645 22646 22647 22648 22649 22650 22651 22652 22653 22654 22655 22656 22657 22658 22659 22660 22661 22662 22663 22664 22665 22666 22667 22668 22669 22670 22671 22672 22673 22674 22675 22676 22677 22678 22679 22680 22681 22682 22683 22684 22685 22686 22687 22688 22689 22690 22691 22692 22693 22694 22695 22696 22697 22698 22699 22700 22701 22702 22703 22704 22705 22706 22707 22708 22709 22710 22711 22712 22713 22714 22715 22716 22717 22718 22719 22720 22721 22722 22723 22724 22725 22726 22727 22728 22729 22730 22731 22732 22733 22734 22735 22736 22737 22738 22739 22740 22741 22742 22743 22744 22745 22746 22747 22748 22749 22750 22751 22752 22753 22754 22755 22756 22757 22758 22759 22760 22761 22762 22763 22764 22765 22766 22767 22768 22769 22770 22771 22772 22773 22774 22775 22776 22777 22778 22779 22780 22781 22782 22783 22784 22785 22786 22787 22788 22789 22790 22791 22792 22793 22794 22795 22796 22797 22798 22799 22800 22801 22802 22803 22804 22805 22806 22807 22808 22809 22810 22811 22812 22813 22814 22815 22816 22817 22818 22819 22820 22821 22822 22823 22824 22825 22826 22827 22828 22829 22830 22831 22832 22833 22834 22835 22836 22837 22838 22839 22840 22841 22842 22843 22844 22845 22846 22847 22848 22849 22850 22851 22852 22853 22854 22855 22856 22857 22858 22859 22860 22861 22862 22863 22864 22865 22866 22867 22868 22869 22870 22871 22872 22873 22874 22875 22876 22877 22878 22879 22880 22881 22882 22883 22884 22885 22886 22887 22888 22889 22890 22891 22892 22893 22894 22895 22896 22897 22898 22899 22900 22901 22902 22903 22904 22905 22906 22907 22908 22909 22910 22911 22912 22913 22914 22915 22916 22917 22918 22919 22920 22921 22922 22923 22924 22925 22926 22927 22928 22929 22930 22931 22932 22933 22934 22935 22936 22937 22938 22939 22940 22941 22942 22943 22944 22945 22946 22947 22948 22949 22950 22951 22952 22953 22954 22955 22956 22957 22958 22959 22960 22961 22962 22963 22964 22965 22966 22967 22968 22969 22970 22971 22972 22973 22974 22975 22976 22977 22978 22979 22980 22981 22982 22983 22984 22985 22986 22987 22988 22989 22990 22991 22992 22993 22994 22995 22996 22997 22998 22999 23000 23001 23002 23003 23004 23005 23006 23007 23008 23009 23010 23011 23012 23013 23014 23015 23016 23017 23018 23019 23020 23021 23022 23023 23024 23025 23026 23027 23028 23029 23030 23031 23032 23033 23034 23035 23036 23037 23038 23039 23040 23041 23042 23043 23044 23045 23046 23047 23048 23049 23050 23051 23052 23053 23054 23055 23056 23057 23058 23059 23060 23061 23062 23063 23064 23065 23066 23067 23068 23069 23070 23071 23072 23073 23074 23075 23076 23077 23078 23079 23080 23081 23082 23083 23084 23085 23086 23087 23088 23089 23090 23091 23092 23093 23094 23095 23096 23097 23098 23099 23100 23101 23102 23103 23104 23105 23106 23107 23108 23109 23110 23111 23112 23113 23114 23115 23116 23117 23118 23119 23120 23121 23122 23123 23124 23125 23126 23127 23128 23129 23130 23131 23132 23133 23134 23135 23136 23137 23138 23139 23140 23141 23142 23143 23144 23145 23146 23147 23148 23149 23150 23151 23152 23153 23154 23155 23156 23157 23158 23159 23160 23161 23162 23163 23164 23165 23166 23167 23168 23169 23170 23171 23172 23173 23174 23175 23176 23177 23178 23179 23180 23181 23182 23183 23184 23185 23186 23187 23188 23189 23190 23191 23192 23193 23194 23195 23196 23197 23198 23199 23200 23201 23202 23203 23204 23205 23206 23207 23208 23209 23210 23211 23212 23213 23214 23215 23216 23217 23218 23219 23220 23221 23222 23223 23224 23225 23226 23227 23228 23229 23230 23231 23232 23233 23234 23235 23236 23237 23238 23239 23240 23241 23242 23243 23244 23245 23246 23247 23248 23249 23250 23251 23252 23253 23254 23255 23256 23257 23258 23259 23260 23261 23262 23263 23264 23265 23266 23267 23268 23269 23270 23271 23272 23273 23274 23275 23276 23277 23278 23279 23280 23281 23282 23283 23284 23285 23286 23287 23288 23289 23290 23291 23292 23293 23294 23295 23296 23297 23298 23299 23300 23301 23302 23303 23304 23305 23306 23307 23308 23309 23310 23311 23312 23313 23314 23315 23316 23317 23318 23319 23320 23321 23322 23323 23324 23325 23326 23327 23328 23329 23330 23331 23332 23333 23334 23335 23336 23337 23338 23339 23340 23341 23342 23343 23344 23345 23346 23347 23348 23349 23350 23351 23352 23353 23354 23355 23356 23357 23358 23359 23360 23361 23362 23363 23364 23365 23366 23367 23368 23369 23370 23371 23372 23373 23374 23375 23376 23377 23378 23379 23380 23381 23382 23383 23384 23385 23386 23387 23388 23389 23390 23391 23392 23393 23394 23395 23396 23397 23398 23399 23400 23401 23402 23403 23404 23405 23406 23407 23408 23409 23410 23411 23412 23413 23414 23415 23416 23417 23418 23419 23420 23421 23422 23423 23424 23425 23426 23427 23428 23429 23430 23431 23432 23433 23434 23435 23436 23437 23438 23439 23440 23441 23442 23443 23444 23445 23446 23447 23448 23449 23450 23451 23452 23453 23454 23455 23456 23457 23458 23459 23460 23461 23462 23463 23464 23465 23466 23467 23468 23469 23470 23471 23472 23473 23474 23475 23476 23477 23478 23479 23480 23481 23482 23483 23484 23485 23486 23487 23488 23489 23490 23491 23492 23493 23494 23495 23496 23497 23498 23499 23500 23501 23502 23503 23504 23505 23506 23507 23508 23509 23510 23511 23512 23513 23514 23515 23516 23517 23518 23519 23520 23521 23522 23523 23524 23525 23526 23527 23528 23529 23530 23531 23532 23533 23534 23535 23536 23537 23538 23539 23540 23541 23542 23543 23544 23545 23546 23547 23548 23549 23550 23551 23552 23553 23554 23555 23556 23557 23558 23559 23560 23561 23562 23563 23564 23565 23566 23567 23568 23569 23570 23571 23572 23573 23574 23575 23576 23577 23578 23579 23580 23581 23582 23583 23584 23585 23586 23587 23588 23589 23590 23591 23592 23593 23594 23595 23596 23597 23598 23599 23600 23601 23602 23603 23604 23605 23606 23607 23608 23609 23610 23611 23612 23613 23614 23615 23616 23617 23618 23619 23620 23621 23622 23623 23624 23625 23626 23627 23628 23629 23630 23631 23632 23633 23634 23635 23636 23637 23638 23639 23640 23641 23642 23643 23644 23645 23646 23647 23648 23649 23650 23651 23652 23653 23654 23655 23656 23657 23658 23659 23660 23661 23662 23663 23664 23665 23666 23667 23668 23669 23670 23671 23672 23673 23674 23675 23676 23677 23678 23679 23680 23681 23682 23683 23684 23685 23686 23687 23688 23689 23690 23691 23692 23693 23694 23695 23696 23697 23698 23699 23700 23701 23702 23703 23704 23705 23706 23707 23708 23709 23710 23711 23712 23713 23714 23715 23716 23717 23718 23719 23720 23721 23722 23723 23724 23725 23726 23727 23728 23729 23730 23731 23732 23733 23734 23735 23736 23737 23738 23739 23740 23741 23742 23743 23744 23745 23746 23747 23748 23749 23750 23751 23752 23753 23754 23755 23756 23757 23758 23759 23760 23761 23762 23763 23764 23765 23766 23767 23768 23769 23770 23771 23772 23773 23774 23775 23776 23777 23778 23779 23780 23781 23782 23783 23784 23785 23786 23787 23788 23789 23790 23791 23792 23793 23794 23795 23796 23797 23798 23799 23800 23801 23802 23803 23804 23805 23806 23807 23808 23809 23810 23811 23812 23813 23814 23815 23816 23817 23818 23819 23820 23821 23822 23823 23824 23825 23826 23827 23828 23829 23830 23831 23832 23833 23834 23835 23836 23837 23838 23839 23840 23841 23842 23843 23844 23845 23846 23847 23848 23849 23850 23851 23852 23853 23854 23855 23856 23857 23858 23859 23860 23861 23862 23863 23864 23865 23866 23867 23868 23869 23870 23871 23872 23873 23874 23875 23876 23877 23878 23879 23880 23881 23882 23883 23884 23885 23886 23887 23888 23889 23890 23891 23892 23893 23894 23895 23896 23897 23898 23899 23900 23901 23902 23903 23904 23905 23906 23907 23908 23909 23910 23911 23912 23913 23914 23915 23916 23917 23918 23919 23920 23921 23922 23923 23924 23925 23926 23927 23928 23929 23930 23931 23932 23933 23934 23935 23936 23937 23938 23939 23940 23941 23942 23943 23944 23945 23946 23947 23948 23949 23950 23951 23952 23953 23954 23955 23956 23957 23958 23959 23960 23961 23962 23963 23964 23965 23966 23967 23968 23969 23970 23971 23972 23973 23974 23975 23976 23977 23978 23979 23980 23981 23982 23983 23984 23985 23986 23987 23988 23989 23990 23991 23992 23993 23994 23995 23996 23997 23998 23999 24000 24001 24002 24003 24004 24005 24006 24007 24008 24009 24010 24011 24012 24013 24014 24015 24016 24017 24018 24019 24020 24021 24022 24023 24024 24025 24026 24027 24028 24029 24030 24031 24032 24033 24034 24035 24036 24037 24038 24039 24040 24041 24042 24043 24044 24045 24046 24047 24048 24049 24050 24051 24052 24053 24054 24055 24056 24057 24058 24059 24060 24061 24062 24063 24064 24065 24066 24067 24068 24069 24070 24071 24072 24073 24074 24075 24076 24077 24078 24079 24080 24081 24082 24083 24084 24085 24086 24087 24088 24089 24090 24091 24092 24093 24094 24095 24096 24097 24098 24099 24100 24101 24102 24103 24104 24105 24106 24107 24108 24109 24110 24111 24112 24113 24114 24115 24116 24117 24118 24119 24120 24121 24122 24123 24124 24125 24126 24127 24128 24129 24130 24131 24132 24133 24134 24135 24136 24137 24138 24139 24140 24141 24142 24143 24144 24145 24146 24147 24148 24149 24150 24151 24152 24153 24154 24155 24156 24157 24158 24159 24160 24161 24162 24163 24164 24165 24166 24167 24168 24169 24170 24171 24172 24173 24174 24175 24176 24177 24178 24179 24180 24181 24182 24183 24184 24185 24186 24187 24188 24189 24190 24191 24192 24193 24194 24195 24196 24197 24198 24199 24200 24201 24202 24203 24204 24205 24206 24207 24208 24209 24210 24211 24212 24213 24214 24215 24216 24217 24218 24219 24220 24221 24222 24223 24224 24225 24226 24227 24228 24229 24230 24231 24232 24233 24234 24235 24236 24237 24238 24239 24240 24241 24242 24243 24244 24245 24246 24247 24248 24249 24250 24251 24252 24253 24254 24255 24256 24257 24258 24259 24260 24261 24262 24263 24264 24265 24266 24267 24268 24269 24270 24271 24272 24273 24274 24275 24276 24277 24278 24279 24280 24281 24282 24283 24284 24285 24286 24287 24288 24289 24290 24291 24292 24293 24294 24295 24296 24297 24298 24299 24300 24301 24302 24303 24304 24305 24306 24307 24308 24309 24310 24311 24312 24313 24314 24315 24316 24317 24318 24319 24320 24321 24322 24323 24324 24325 24326 24327 24328 24329 24330 24331 24332 24333 24334 24335 24336 24337 24338 24339 24340 24341 24342 24343 24344 24345 24346 24347 24348 24349 24350 24351 24352 24353 24354 24355 24356 24357 24358 24359 24360 24361 24362 24363 24364 24365 24366 24367 24368 24369 24370 24371 24372 24373 24374 24375 24376 24377 24378 24379 24380 24381 24382 24383 24384 24385 24386 24387 24388 24389 24390 24391 24392 24393 24394 24395 24396 24397 24398 24399 24400 24401 24402 24403 24404 24405 24406 24407 24408 24409 24410 24411 24412 24413 24414 24415 24416 24417 24418 24419 24420 24421 24422 24423 24424 24425 24426 24427 24428 24429 24430 24431 24432 24433 24434 24435 24436 24437 24438 24439 24440 24441 24442 24443 24444 24445 24446 24447 24448 24449 24450 24451 24452 24453 24454 24455 24456 24457 24458 24459 24460 24461 24462 24463 24464 24465 24466 24467 24468 24469 24470 24471 24472 24473 24474 24475 24476 24477 24478 24479 24480 24481 24482 24483 24484 24485 24486 24487 24488 24489 24490 24491 24492 24493 24494 24495 24496 24497 24498 24499 24500 24501 24502 24503 24504 24505 24506 24507 24508 24509 24510 24511 24512 24513 24514 24515 24516 24517 24518 24519 24520 24521 24522 24523 24524 24525 24526 24527 24528 24529 24530 24531 24532 24533 24534 24535 24536 24537 24538 24539 24540 24541 24542 24543 24544 24545 24546 24547 24548 24549 24550 24551 24552 24553 24554 24555 24556 24557 24558 24559 24560 24561 24562 24563 24564 24565 24566 24567 24568 24569 24570 24571 24572 24573 24574 24575 24576 24577 24578 24579 24580 24581 24582 24583 24584 24585 24586 24587 24588 24589 24590 24591 24592 24593 24594 24595 24596 24597 24598 24599 24600 24601 24602 24603 24604 24605 24606 24607 24608 24609 24610 24611 24612 24613 24614 24615 24616 24617 24618 24619 24620 24621 24622 24623 24624 24625 24626 24627 24628 24629 24630 24631 24632 24633 24634 24635 24636 24637 24638 24639 24640 24641 24642 24643 24644 24645 24646 24647 24648 24649 24650 24651 24652 24653 24654 24655 24656 24657 24658 24659 24660 24661 24662 24663 24664 24665 24666 24667 24668 24669 24670 24671 24672 24673 24674 24675 24676 24677 24678 24679 24680 24681 24682 24683 24684 24685 24686 24687 24688 24689 24690 24691 24692 24693 24694 24695 24696 24697 24698 24699 24700 24701 24702 24703 24704 24705 24706 24707 24708 24709 24710 24711 24712 24713 24714 24715 24716 24717 24718 24719 24720 24721 24722 24723 24724 24725 24726 24727 24728 24729 24730 24731 24732 24733 24734 24735 24736 24737 24738 24739 24740 24741 24742 24743 24744 24745 24746 24747 24748 24749 24750 24751 24752 24753 24754 24755 24756 24757 24758 24759 24760 24761 24762 24763 24764 24765 24766 24767 24768 24769 24770 24771 24772 24773 24774 24775 24776 24777 24778 24779 24780 24781 24782 24783 24784 24785 24786 24787 24788 24789 24790 24791 24792 24793 24794 24795 24796 24797 24798 24799 24800 24801 24802 24803 24804 24805 24806 24807 24808 24809 24810 24811 24812 24813 24814 24815 24816 24817 24818 24819 24820 24821 24822 24823 24824 24825 24826 24827 24828 24829 24830 24831 24832 24833 24834 24835 24836 24837 24838 24839 24840 24841 24842 24843 24844 24845 24846 24847 24848 24849 24850 24851 24852 24853 24854 24855 24856 24857 24858 24859 24860 24861 24862 24863 24864 24865 24866 24867 24868 24869 24870 24871 24872 24873 24874 24875 24876 24877 24878 24879 24880 24881 24882 24883 24884 24885 24886 24887 24888 24889 24890 24891 24892 24893 24894 24895 24896 24897 24898 24899 24900 24901 24902 24903 24904 24905 24906 24907 24908 24909 24910 24911 24912 24913 24914 24915 24916 24917 24918 24919 24920 24921 24922 24923 24924 24925 24926 24927 24928 24929 24930 24931 24932 24933 24934 24935 24936 24937 24938 24939 24940 24941 24942 24943 24944 24945 24946 24947 24948 24949 24950 24951 24952 24953 24954 24955 24956 24957 24958 24959 24960 24961 24962 24963 24964 24965 24966 24967 24968 24969 24970 24971 24972 24973 24974 24975 24976 24977 24978 24979 24980 24981 24982 24983 24984 24985 24986 24987 24988 24989 24990 24991 24992 24993 24994 24995 24996 24997 24998 24999 25000 25001 25002 25003 25004 25005 25006 25007 25008 25009 25010 25011 25012 25013 25014 25015 25016 25017 25018 25019 25020 25021 25022 25023 25024 25025 25026 25027 25028 25029 25030 25031 25032 25033 25034 25035 25036 25037 25038 25039 25040 25041 25042 25043 25044 25045 25046 25047 25048 25049 25050 25051 25052 25053 25054 25055 25056 25057 25058 25059 25060 25061 25062 25063 25064 25065 25066 25067 25068 25069 25070 25071 25072 25073 25074 25075 25076 25077 25078 25079 25080 25081 25082 25083 25084 25085 25086 25087 25088 25089 25090 25091 25092 25093 25094 25095 25096 25097 25098 25099 25100 25101 25102 25103 25104 25105 25106 25107 25108 25109 25110 25111 25112 25113 25114 25115 25116 25117 25118 25119 25120 25121 25122 25123 25124 25125 25126 25127 25128 25129 25130 25131 25132 25133 25134 25135 25136 25137 25138 25139 25140 25141 25142 25143 25144 25145 25146 25147 25148 25149 25150 25151 25152 25153 25154 25155 25156 25157 25158 25159 25160 25161 25162 25163 25164 25165 25166 25167 25168 25169 25170 25171 25172 25173 25174 25175 25176 25177 25178 25179 25180 25181 25182 25183 25184 25185 25186 25187 25188 25189 25190 25191 25192 25193 25194 25195 25196 25197 25198 25199 25200 25201 25202 25203 25204 25205 25206 25207 25208 25209 25210 25211 25212 25213 25214 25215 25216 25217 25218 25219 25220 25221 25222 25223 25224 25225 25226 25227 25228 25229 25230 25231 25232 25233 25234 25235 25236 25237 25238 25239 25240 25241 25242 25243 25244 25245 25246 25247 25248 25249 25250 25251 25252 25253 25254 25255 25256 25257 25258 25259 25260 25261 25262 25263 25264 25265 25266 25267 25268 25269 25270 25271 25272 25273 25274 25275 25276 25277 25278 25279 25280 25281 25282 25283 25284 25285 25286 25287 25288 25289 25290 25291 25292 25293 25294 25295 25296 25297 25298 25299 25300 25301 25302 25303 25304 25305 25306 25307 25308 25309 25310 25311 25312 25313 25314 25315 25316 25317 25318 25319 25320 25321 25322 25323 25324 25325 25326 25327 25328 25329 25330 25331 25332 25333 25334
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script id="versionArea" type="text/javascript">
//<![CDATA[
var version = {title: "TiddlyWiki", major: 2, minor: 8, revision: 1, date: new Date("June 23, 2013"), extensions: {}};
//]]>
</script>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="copyright" content="
TiddlyWiki created by Jeremy Ruston, (jeremy [at] osmosoft [dot] com)
Copyright (c) Jeremy Ruston 2004-2007
Copyright (c) UnaMesa Association 2007-2012
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
Neither the name of the UnaMesa Association nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
" />
<!--PRE-HEAD-START-->
<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
<!--PRE-HEAD-END-->
<title> Access2Base - It's about converting PEOPLE, not data </title>
<style id="styleArea" type="text/css">
#saveTest {display:none;}
#messageArea {display:none;}
#copyright {display:none;}
#storeArea {display:none;}
#storeArea div {padding:0.5em; margin:1em 0em 0em 0em; border-color:#fff #666 #444 #ddd; border-style:solid; border-width:2px; overflow:auto;}
#shadowArea {display:none;}
#javascriptWarning {width:100%; text-align:center; font-weight:bold; background-color:#dd1100; color:#fff; padding:1em 0em;}
</style>
<!--POST-HEAD-START-->
<!--POST-HEAD-END-->
</head>
<body onload="main();" onunload="if(window.unload) unload();">
<!--PRE-BODY-START-->
<!--PRE-BODY-END-->
<div id="copyright">
Welcome to TiddlyWiki created by Jeremy Ruston; Copyright © 2004-2007 Jeremy Ruston, Copyright © 2007-2011 UnaMesa Association
</div>
<noscript>
<div id="javascriptWarning">
This page requires JavaScript to function properly.<br /><br />If you are using Microsoft Internet Explorer you may need to click on the yellow bar above and select 'Allow Blocked Content'. You must then click 'Yes' on the following security warning.
</div>
</noscript>
<div id="saveTest"></div>
<div id="backstageCloak"></div>
<div id="backstageButton"></div>
<div id="backstageArea"><div id="backstageToolbar"></div></div>
<div id="backstage">
<div id="backstagePanel"></div>
</div>
<div id="contentWrapper"></div>
<div id="contentStash"></div>
<div id="shadowArea">
<div title="ColorPalette">
<pre>Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
</pre>
</div>
<div title="EditTemplate">
<pre><!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
</pre>
</div>
<div title="GettingStarted">
<pre>To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
</pre>
</div>
<div title="ImportTiddlers">
<pre><<importTiddlers>>
</pre>
</div>
<div title="MarkupPreHead">
<pre><!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
</pre>
</div>
<div title="OptionsPanel">
<pre>These [[InterfaceOptions]] for customising [[TiddlyWiki]] are saved in your browser
Your username for signing your edits. Write it as a [[WikiWord]] (eg [[JoeBloggs]])
<<option txtUserName>>
<<option chkSaveBackups>> [[SaveBackups]]
<<option chkAutoSave>> [[AutoSave]]
<<option chkRegExpSearch>> [[RegExpSearch]]
<<option chkCaseSensitiveSearch>> [[CaseSensitiveSearch]]
<<option chkAnimate>> [[EnableAnimations]]
----
Also see [[AdvancedOptions]]
</pre>
</div>
<div title="PageTemplate">
<pre><!--{{{-->
<div class='header' role='banner' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' role='navigation' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' role='navigation' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' role='complementary' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea' role='main'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
</pre>
</div>
<div title="StyleSheetColors">
<pre>/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}
h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}
.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}
.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}
.tabSelected {color:[[ColorPalette::PrimaryDark]];
background:[[ColorPalette::TertiaryPale]];
border-left:1px solid [[ColorPalette::TertiaryLight]];
border-top:1px solid [[ColorPalette::TertiaryLight]];
border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}
#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}
.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}
.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}
#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}
.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}
.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}
.tiddler .defaultCommand {font-weight:bold;}
.shadow .title {color:[[ColorPalette::TertiaryDark]];}
.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}
.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}
.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}
.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}
.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}
.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}
.imageLink, #displayArea .imageLink {background:transparent;}
.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}
.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}
.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}
.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}
.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}
.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}
.readOnly {background:[[ColorPalette::TertiaryPale]];}
#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:alpha(opacity=60);}
/*}}}*/
</pre>
</div>
<div title="StyleSheetLayout">
<pre>/*{{{*/
* html .tiddler {height:1%;}
body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}
h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}
hr {height:1px;}
a {text-decoration:none;}
dt {font-weight:bold;}
ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}
.txtOptionInput {width:11em;}
#contentWrapper .chkOptionInput {border:0;}
.externalLink {text-decoration:underline;}
.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}
.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}
/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}
#mainMenu .tiddlyLinkExisting,
#mainMenu .tiddlyLinkNonExisting,
#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}
.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0; top:0;}
.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}
#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}
#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}
.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}
#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}
.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}
.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}
.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}
#contentWrapper {display:block;}
#splashScreen {display:none;}
#displayArea {margin:1em 17em 0 14em;}
.toolbar {text-align:right; font-size:.9em;}
.tiddler {padding:1em 1em 0;}
.missing .viewer,.missing .title {font-style:italic;}
.title {font-size:1.6em; font-weight:bold;}
.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}
.tiddler .button {padding:0.2em 0.4em;}
.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}
.footer {font-size:.9em;}
.footer li {display:inline;}
.annotation {padding:0.5em; margin:0.5em;}
* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}
.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0 3px 0 3px;}
.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}
.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0; padding-bottom:0;}
.fieldsetFix {border:0; padding:0; margin:1px 0px;}
.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}
* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}
.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
</pre>
</div>
<div title="StyleSheetLocale">
<pre>/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
</pre>
</div>
<div title="StyleSheetPrint">
<pre>/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/
</pre>
</div>
<div title="ViewTemplate">
<pre><!--{{{-->
<div class='toolbar' role='navigation' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
</pre>
</div>
</div>
<!--POST-SHADOWAREA-->
<div id="storeArea">
<div title="AbsolutePosition" modifier="Jean-Pierre Ledure" created="201308091604" modified="201406061409" tags="Properties" changecount="3">
<pre>The //~AbsolutePosition// property sets or returns the relative record number of a [[Recordset object's|Recordset]] current record.
!!!Applies to ...
| !Object |!Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.AbsolutePosition}}}
//recordset//{{{.AbsolutePosition}}} = //value//
!!!Returned values / Arguments
{{{Long}}}
!!!Remarks
*You can use the //~AbsolutePosition// property to position the current record pointer to a specific record based on its ordinal position in a //Recordset// object. You can also determine the current record number by checking the //~AbsolutePosition// property setting.
*The //~AbsolutePosition// property value is 1-based (that is, a setting of 1 refers to the first record in the //Recordset// object), you cannot set it to a value greater than or equal to the number of populated records; doing so causes an error. You can determine the number of populated records in the //Recordset// object by checking the [[RecordCount]] property setting. The maximum allowable setting for the //~AbsolutePosition// property is the value of the //~RecordCount// property.<br />Note that in //~MSAccess// the //~AbsolutePosition// property is zero-based (a setting of 0 refers to the 1st record of the //Recordset//).
*If there is no current record, as when there are no records in the //Recordset// object, //~AbsolutePosition// returns –1. If the current record is deleted, the //~AbsolutePosition// property value isn't defined, and an error occurs if it's referenced.
*You shouldn't use this property as a surrogate record number. //Bookmarks// are still the recommended way of retaining and returning to a given position and are the only way to position the current record across a //Recordset// object. In particular, the position of a record changes when one or more records preceding it are deleted. There is also no assurance that a record will have the same absolute position if the //Recordset// object is re-created again because the order of individual records within a //Recordset// object isn't guaranteed unless it's created with an SQL statement by using an ORDER BY clause.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Recordset delivered no data. Action on current record rejected |
|Recordset has been closed. Recordset action rejected |
|Current record out of range |
!!!See also
[[Bookmarkable]]
[[GoToRecord]]
[[Move|Move (recordset)]]
[[MoveFirst|Move (recordset)]]
[[MoveLast|Move (recordset)]]
[[MoveNext|Move (recordset)]]
[[MovePrevious|Move (recordset)]]
[[RecordCount]]
[[Recordset]]
!!!Example
<<tiddler "AbsolutePosition example">></pre>
</div>
<div title="AbsolutePosition example" modifier="YourName" created="201308091603" modified="201312261118" tags="[[Snippets of Code]]">
<pre>Know the number of records by moving to the last record of the recordset
//{{{
Dim oRecordset As Object
Set oRecordset = Application.CurrentDb().OpenRecordset("SELECT * FROM [Products]")
oRecordset.MoveLast()
Print "Number of records = " & oRecordset.AbsolutePosition
oRecordset.mClose()
//}}}
See also [[Design a generic DMedian function|DMedian function]]</pre>
</div>
<div title="Access2Base" modifier="YourName" created="201112251405" modified="201203161136" tags="NoTag">
<pre><<tiddler "Home">></pre>
</div>
<div title="Access2Base vs. VBA" modifier="Jean-Pierre Ledure" created="201106251419" modified="201408011503" tags="[[Snippets of Code]]" changecount="2">
<pre>~LibreOffice/~OpenOffice Base with ~Access2Base
//{{{
REM Open a form ...
OpenForm("myForm")
REM Move a form to new left-top coordinates ...
Dim ofForm As Object ' In VBA => Dim ofForm As Form
Set ofForm = Forms("myForm")
ofForm.Move(100, 200)
REM Get the value of a control ...
Dim ocControl As Object
ocControl = ofForm.Controls("myControl")
MsgBox ocControl.Value
REM Hide a control ...
ocControl.Visible = False
REM ... or alternatively ...
setValue("Forms!myForm!myControl.Visible", False) ' Shortcut notation
' In VBA => Forms!myForm!myControl.Visible = False
//}}}
</pre>
</div>
<div title="Actions" modifier="Jean-Pierre Ledure" created="201112271607" modified="201408011504" tags="Menu" changecount="1">
<pre></pre>
</div>
<div title="Add" modifier="Jean-Pierre Ledure" created="201401181218" modified="201602131611" tags="Methods" changecount="4">
<pre>*Adds a [[table|TableDef]] object to the [[TableDefs]] collection. The //Add// method finalizes the creation of a new table initiated with the [[CreateTableDef]] method.
*Adds a new [[tempvar object|TempVar]] to the [[TempVars collection|TempVars]] and initializes its value.
!!!Applies to ...
| !Object | !Description |
|[[TableDefs]] |The set of tables of the database. |
|[[TempVars]] |The collection of temporary variables. |
!!!Syntax
//database.~TableDefs()//{{{.Add(}}}//table//{{{)}}}
//[application.]~TempVars()//{{{.Add(}}}//name, value//{{{)}}}
| !Argument | !Type |!Returned value |
|table | [[TableDef]] object |True if success.|
|name | string |~|
|value | variant |~|
!!!Remarks when applied to ~TableDefs
*The name "Add" has been preferred to "Append" (like in //~MSAccess// because the latter is a reserved word in ~OpenOffice (not in ~LibreOffice).
When applied to ~TableDef objects:
*If the //Add// method is not invoked after a prior invocation of the [[CreateTableDef]] method, or if not at least one field has been defined with the [[CreateField]] method, an error message will be raised.
*The database document is automatically saved after the table creation.
!!!Error Messages
|Method 'Collection.Add' not applicable in this context |
|Table '...' could not be created |
!!!See also
[[CreateTableDef]]
[[CreateField]]
[[TableDef]]
[[TableDefs]]
[[TempVar]]
[[TempVars]]
!!!Example
<<tiddler "CreateTableDef example">>
<<tiddler "Tempvar example">></pre>
</div>
<div title="AddAllToBox" modifier="Jean-PierreLedure" created="201212241404" modified="201308161310" tags="HowTo">
<pre>(Q) Can I add a "All" option in a combo box on top of the list ?
(R) Use either a special SELECT statement or, alternatively, the [[RowSource]] property to adjust the list.
Assuming next table:
<<tiddler "CustomersTable">>
we want to make a combo box listing all //~CompanyName//s.
!!!(1) Solution with a UNION SELECT statement:
Define your combo box with the //List content// defined like
//{{{
SELECT "CompanyName" FROM "Customers" UNION SELECT '(All)' as "Bogus" From "Customers" ORDER BY "CompanyName"
//}}}
Depending on the database (RDBMS) used above SQL will probably require that the //Type of list contents// entry contains {{{Sql [Native]}}}
!!!(2) Solution with a bit code
This solution requires that the list of proposed values remains unchanged as long as the form remains open.
Additionally it is valid ONLY for LISTBOXES.
The listbox is defined, exactly as above. Store in the //List content// entry a more usual SQL statement:
//{{{
SELECT DISTINCT "CompanyName" FROM "Customers"
//}}}
Note that the code below is also usable if the //~ListBox// is based on a list of values i.o. data in a database table.
The code, triggered from the form's //When loading// event, will concatenate "(All)" with all values contained in the list.
//{{{
Sub AddAllToList(poEvent As Object)
Dim oEvent As Object, ofForm As Object, ocList As Object
Dim i As Integer, sSource As String
Set oEvent = Events(poEvent)
Set ofForm = oEvent.Source
Set ocList = ofForm.Controls("listBox-All")
With ocList
Select Case .RowSourceType
Case com.sun.star.form.ListSourceType.VALUELIST
.RowSource = "(All);" & .RowSource
Case Else ' Table, Query, SQL, SqlPassThrough
sSource = "(All)"
For i = 0 To .ListCount - 1
sSource = sSource & ";" & .Itemdata(i)
Next i
.RowSourceType = com.sun.star.form.ListSourceType.VALUELIST
.RowSource = sSource
End Select
End With
End Sub
//}}}
!!!See also
[[ComboBox]]
[[ListBox]]
[[RowSource]]
[[RowSourceType]]
!!!Refer to ...
| !Solution | !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
| (1) ||~Products_ListBoxFilter ||~CustomersAll-SQL |||
| (2) |~ListBox|~|When loading |~ListBox-All |~|~|</pre>
</div>
<div title="AddItem" modifier="Jean-Pierre Ledure" created="201205190946" modified="201405241125" tags="Methods" changecount="3">
<pre>The //~AddItem// method adds a new item to the list of values displayed by the specified list box control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a Dialog |!Description |
|[[Control]] | [[ListBox]] | [[ListBox]] | [[ListBox]] |A listbox on an open form, a dialog or in a [[GridControl]]|
!!!Syntax
//control//{{{.AddItem(}}}//value// [, //index//]{{{)}}}
| !Argument | !Type | !Description |
| value | String |The display text for the new item. |
| index | Integer<br />Long |The position of the item in the list.<br />If this argument is omitted, the item is added to the end of the list. |
!!!Remarks
*The [[RowSourceType]] property (invalid in dialogs) must contain the value {{{com.sun.star.form.ListSourceType.VALUELIST}}}.
*Combo boxes do not support this value for that property. That's why //~AddItem// is applicable only on listboxes.
*List item numbers start from zero. If the value of the {{{index}}} argument doesn't correspond to an existing item number or to the last item number + 1, an error occurs.
*//~AddItem// returns True if success, False otherwise.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Method not applicable in this context |
!!!See also
[[ListBox]]
[[RemoveItem]]
[[RowSource]]
[[RowSourceType]]
!!!Example
<<tiddler "Addremoveitem example">></pre>
</div>
<div title="AddNew" modifier="Jean-Pierre Ledure" created="201307131345" modified="201405240700" tags="Methods" changecount="2">
<pre>Creates a new record for an updatable [[Recordset object|Recordset]]. The //~AddNew// method must be finalized with the [[Update]] method.
!!!Applies to ...
| !Object | !Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.AddNew()}}}
!!!Returned value
{{{True}}} if success.
!!!Remarks
*Use the //~AddNew// method to create and add a new record. This method sets the fields to [[default values|DefaultValue]], and if no default values are specified in the table definition, it sets the fields to Null.
*After you modify the new record, use the [[Update]] method to save the changes and add the record to the //Recordset//. No changes occur in the database until you use the //Update// method.
**''Caution'' If you issue an //~AddNew// and then perform any operation that moves to another record, but without using //Update//, your changes are lost without warning.
*The record that was current before you used //~AddNew// remains current.
!!!Error Messages
|Recordset or field is not updatable |
!!!See also
[[CancelUpdate]]
[[Close|Close (method)]]
[[CloseAllRecordsets]]
[[DefaultValue]]
[[Edit]]
[[Update]]
[[Value|Value (field)]]
!!!Example
<<tiddler "AddNew example">></pre>
</div>
<div title="AddNew example" modifier="Jean-Pierre Ledure" created="201307191341" modified="201405241103" tags="[[Snippets of Code]]" changecount="1">
<pre>Add a new record to a table
//{{{
Dim oRecordset As Object
Set oRecordset = Application.CurrentDb().OpenRecordset("Expenses")
With oRecordset
.AddNew ' Fields initialised with the default value
.Fields("AMOUNT").Value = 1234
.Fields("DATE EXPENSE").Value = Now()
.Fields("CATEGORY").Value = "Food"
.Fields("DESCRIPTION").Value = "Lunch"
.Fields("VAT CODE").Value = 3
.Update
.mClose
End With
//}}}</pre>
</div>
<div title="AddRecordToRecordset" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201405311052" modified="201405311120" tags="HowTo" changecount="8">
<pre>(Q) How to add a record to a recordset
(R) To add a record to a [[Recordset object|Recordset]]:
*Use the [[AddNew]] method to create a record you can edit.
*Assign values to each of the record's fields.
*Use the [[Update]] method to save the new record.
The following code example adds a record to a Recordset associated with a table called Shippers.
<<tiddler "ShippersTable">>
//{{{
Dim odbNorthwind As Object
Dim orsShippers As Object
Set odbNorthwind = Application.CurrentDb
Set orsShippers = odbNorthwind.OpenRecordset("Shippers")
With orsShippers
.AddNew
.Fields("CompanyName").Value = "Global Open Source Service"
'
' Set remaining fields.
'
.Update
.mClose()
End With
//}}}
When you use the //~AddNew// method, //~Access2Base// prepares a new, blank record, initializes its fields to their default value and makes it the current record. When you use the //Update// method to save the new record, the record that was current before you used the //~AddNew// method becomes the current record again.
If you use the //~AddNew// method to add a record, and then move to another record or close the //Recordset// without first using the //Update// method, your changes are lost without warning. For example, omitting the ''Update'' method from the preceding example results in no changes being made to the Shippers table.
!!!See also
[[OpenRecordset]]
[[Value (field)]]
!!!Refer to ...
| !Basic module | !Sub |!Comments |
|~HowTo |~AddRecordToShippers ||</pre>
</div>
<div title="Addremoveitem example" modifier="Jean-PierreLedure" created="201205190949" modified="201212301434" tags="[[Snippets of Code]]">
<pre>Display in an empty ListBox all dates between today and today + 9 days
//{{{
Dim ocList As Object, i As Integer, sDate As String
Set ocList = getObject("Forms!myForm!myListBoxDate")
sDate = Date
For i = 0 To 9
ocList.AddItem(sDate)
sDate = DateAdd("d", 1, sDate)
Next i
//}}}
Remove from the added dates all the non-working days (it is assumed that, for any reason, this could not have been done while loading the dates in the box ...)
//{{{
Dim ocList As Object, i As Integer, sDates() As String, dDate As Date
Set ocList = getObject("Forms!myForm!myListBoxDate")
sDates() = ocList.ItemData
For i = 0 To UBound(sDates)
dDate = DateValue(sDates(i))
If DatePart("w", dDate, 2) > 5 Then ocList.RemoveItem(sDates(i)) ' Remove saturdays and sundays
Next i
//}}}</pre>
</div>
<div title="AllDialogs" modifier="Jean-Pierre Ledure" created="201302021535" modified="201612181346" tags="Collections" changecount="9">
<pre>The //~AllDialogs// collection describes instances of all [[dialogs|Dialog]] present in the currently loaded dialog libraries.
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]AllDialogs()}}}
{{{[Application.]AllDialogs(index)}}}
{{{[Application.]AllDialogs(dialogname)}}}
| !Argument #1 | !Type |!Returned value |
|| absent |A [[Collection]] object |
| index | integer<br>long |A [[Dialog]] object corresponding to the index-th item in the ~AllDialogs() collection. The 1st dialog is ~AllDialogs(0), the 2nd is ~AllDialogs(1) and so on ... The last one is ~AllDialogs.Count - 1.|
| dialogname | string |A [[Dialog]] object having the argument as name. The argument is NOT case-sensitive.|
!!!Remarks
*//~Access2Base// will scan first the dialogs present in the current Base document (".odb" file) or current non-Base document containing one or more [[standalone forms|Standalone Forms]] (".odt", ".ods", ... file) and continue the search thru all currently loaded libraries. __The //~Access2Base// library itself however will be skipped__.
*The //dialogname// argument is not case sensitive.
*Homonyms within the scanned libraries should be avoided. Only their non case-sensitive name can differentiate them.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection ~AllDialogs() |
|Dialog '...' not found in the currently loaded libraries |
!!!See also ...
[[Collection]]
[[EndExecute]]
[[Execute|Execute (dialog)]]
[[Start]]
[[Terminate]]
!!!Examples
<<tiddler "Dialog example">>
</pre>
</div>
<div title="AllForms" modifier="YourName" created="201106251313" modified="201902151442" tags="Collections" changecount="7">
<pre>The //~AllForms// collection describes instances of all __forms__ present in the current Base document (".odb" file) or in the current non-Base document (".odt", ".ods", ... file) containing one or more [[standalone forms|Standalone Forms]].
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]AllForms()}}} or {{{AllForms()}}}
{{{[Application.]AllForms(index)}}}
{{{[Application.]AllForms(formname)}}}
| !Argument #1 | !Type |!Returned value |
|| absent |A [[Collection]] object |
| index | integer<br>long |A [[Form]] object corresponding to the index-th item in the {{{AllForms()}}} collection. The 1st form is {{{AllForms(0)}}}, the 2nd is {{{AllForms(1)}}} and so on ... The last one has as index {{{AllForms.Count - 1}}}.|
| formname | string |A [[Form]] object having the argument as name. The argument is NOT case-sensitive.|
!!!Remarks
*~Access2Base supports hierarchical form names exactly like Base does it. The //formname// argument must contain the full pathname of the designated form.
*The //formname// argument is not case sensitive.
*When invoked from a [[standalone form|Standalone Forms]], the {{{formname}}} argument must be the own name of the form, __which is often "~MainForm"__. If only one form is present in the file (very often the case), use simply {{{AllForms(0)}}} to get a form object matching that single occurrence.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection ~AllForms() |
|Form "..." not found |
!!!See also ...
[[Forms]]
!!!Examples
<<tiddler "AllForms examples">>
</pre>
</div>
<div title="AllForms examples" modifier="Jean-PierreLedure" created="201106251454" modified="201212021456" tags="[[Snippets of Code]]">
<pre>To display the name of all forms (uses the [[Name]] property):
//{{{
Dim i As Integer, oCollection As Object
Set oCollection = AllForms
For i = 0 To oCollection.Count - 1 'AllForms without argument returns a Collection object
Print AllForms(i).Name, 'AllForms(...) with an argument returns a Form object
Next i
Print
//}}}
Can shorter ... :
//{{{
Dim i As Integer
For i = 0 To AllForms.Count - 1 'AllForms without argument returns a Collection object
Print AllForms(i).Name, 'AllForms(...) with an argument returns a Form object
Next i
Print
//}}}
To know the exact name of a form:
//{{{
Dim ofForm As Object
Set ofForm = AllForms("MYFORM") 'Exact name = myForm :o)
MsgBox ofForm.Name
//}}}</pre>
</div>
<div title="AllModules" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181139" modified="201612181346" tags="Collections" changecount="11">
<pre>The //~AllModules// collection describes instances of all [[modules|Module]] present in the currently loaded Basic libraries.
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]AllModules()}}}
{{{[Application.]AllModules(index)}}}
{{{[Application.]AllModules(modulename)}}}
| !Argument #1 | !Type |!Returned value |
|| absent |A [[Collection]] object |
| index | integer<br>long |A [[Module]] object corresponding to the index-th item in the ~AllModules() collection. The 1st module is ~AlModules(0), the 2nd is ~AllModules(1) and so on ... The last one is ~AllModules.Count - 1.|
| modulename | string |A [[Module]] object having the argument as name. The argument is NOT case-sensitive.|
!!!Remarks
*//~Access2Base// will scan first the modules present in the current Base document (".odb" file) or current non-Base document containing one or more [[standalone forms|Standalone Forms]] (".odt", ".ods", ... file) and continue the search thru all currently loaded libraries. __The //~Access2Base// library itself however will be skipped__.
*The //modulename// argument is not case sensitive.
!!!How to name modules ?
To manage potential homonyms among libraries, the ''name'' of a module consists in 3 components:
//{{{
[[SCOPE.][LIBRARY.]MODULE
//}}}
, the first two being optional.
*The //SCOPE// is either
**''{{{GLOBAL}}}'' grouping both the ''~LibreOffice/~OpenOffice Macros and Dialogs'' and the ''My Macros and Dialogs'' catalogs of libraries.
**''{{{DOCUMENT}}}'' grouping the libraries stored in the current document. __This is the default__.
*The //LIBRARY// component is the name of the library. __The default is "''Standard''"__.
As such,
//{{{
AllModules("DOCUMENT.STANDARD.myModule")
//}}}
is equivalent to:
//{{{
AllModules("myModule")
//}}}
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection ~AllModules() |
|Module '...' not found in the currently loaded libraries |
!!!See also ...
[[Collection]]
[[Module]]
!!!Examples
<<tiddler "Module example">>
</pre>
</div>
<div title="Allow example" modifier="Jean-PierreLedure" created="201107161723" modified="201212021501" tags="[[Snippets of Code]]">
<pre>Make a form read-only
//{{{
Dim ofForm As Object
Set ofForm = AllForms("myForm")
With ofForm
.AllowEdits = False
.AllowDeletions = False
.AllowAdditions = False
End With
//}}}</pre>
</div>
<div title="AllowAdditions" modifier="Jean-Pierre Ledure" created="201107161721" modified="201405291456" tags="Properties" changecount="1">
<pre>The //~AllowAdditions// property specifies whether a user can add a record when using a form or a subform.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
|[[SubForm]] |A subform in an open form |
!!!Syntax
//form//{{{.AllowAdditions}}}
//form//{{{.AllowAdditions}}} = //value//
//subform//{{{.AllowAdditions}}}
//form//{{{.AllowAdditions}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
!!!Error messages
|Form '...' is currently not open|
|Value '...' is invalid for property '~AllowAdditions' |
!!!See also
[[AllowDeletions]]
[[AllowEdits]]
!!!Example
<<tiddler "Allow example">></pre>
</div>
<div title="AllowDeletions" modifier="Jean-Pierre Ledure" created="201107161744" modified="201405291457" tags="Properties" changecount="1">
<pre>The //~AllowDeletions// property specifies whether a user can delete a record when using a form or a subform.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
|[[SubForm]] |A subform in an open form |
!!!Syntax
//form//{{{.AllowDeletions}}}
//form//{{{.AllowDeletions}}} = //value//
//subform//{{{.AllowDeletions}}}
//subform//{{{.AllowDeletions}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
!!!Error messages
|Form '...' is currently not open|
|Value '...' is invalid for property '~AllowDeletions' |
!!!See also
[[AllowAdditions]]
[[AllowEdits]]
!!!Example
<<tiddler "Allow example">></pre>
</div>
<div title="AllowEdits" modifier="Jean-Pierre Ledure" created="201107161748" modified="201405291457" tags="Properties" changecount="1">
<pre>The //~AllowEdits// property specifies whether a user can edit saved records when using a form or a subform.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
|[[SubForm]] |A subform in an open form |
!!!Syntax
//form//{{{.AllowEdits}}}
//form//{{{.AllowEdits}}} = //value//
//subform//{{{.AllowEdits}}}
//form//{{{.AllowEdits}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
!!!Error messages
|Form '...' is currently not open|
|Value '...' is invalid for property '~AllowEdits' |
!!!See also
[[AllowAdditions]]
[[AllowDeletions]]
!!!Example
<<tiddler "Allow example">></pre>
</div>
<div title="AppendChunk" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201603121353" modified="201603121409" tags="Methods" changecount="9">
<pre>The //~AppendChunk// method appends data to a binary [[Field]] belonging to the [[Fields]] collection of a [[Recordset]].
!!!Applies to ...
| !Object | !Type of field |
|[[Field]] |com.sun.star.sdbc.~DataType.BINARY<br />com.sun.star.sdbc.~DataType.VARBINARY<br />com.sun.star.sdbc.~DataType.LONGVARBINARY |
!!!Syntax
//field//{{{.AppendChunk(}}}//value//{{{)}}}
!!!Arguments
| !Argument | !Type | !Description |
|value | Variant |An array of integers, probably built with the [[GetChunk]] method. |
!!!Remarks
*Use the //~AppendChunk// and //~GetChunk// methods to access subsets of data in (Long) Binary fields.
*If memory space is limited or the amount of bytes to be stored cannot be reasonably processed with the [[Value|Value (field)]] property, you may need to work with chunks of a field instead of the entire field.
*The initial AppendChunk operation (after an [[Edit]] or [[AddNew]] call) will simply place the data in the field, overwriting any existing data. Subsequent //~AppendChunk// calls within the same Edit or ~AddNew session will then add to the existing data.
*//~AppendChunk// will be rejected if either the [[AddNew]] or the [[Edit]] method has not been applied on the concerned [[Recordset]] first. The modifications will be applied when the [[Update]] Method is applied on the same //recordset// object. If the //Update// method is never applied, or if the [[CancelUpdate]] method is invoked instead, the database will not be impacted.
!!!Error messages
|Method '~AppendChunk' not applicable in this context |
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[AddNew]]
[[CancelUpdate]]
[[Edit]]
[[GetChunk]]
[[Update]]
[[WriteAllBytes]]
[[Value|Value (field)]]
!!!Example
<<tiddler "Chunk example">></pre>
</div>
<div title="Application" modifier="Jean-Pierre Ledure" created="201301111725" modified="201612181100" tags="Objects" changecount="12">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //Application// class is the root class from which the initial [[collections|Collection]] are derived.
The //Application// class must not be instantiated. The only preset instance MUST be called {{{Application}}}. In fact it is implemented simply as a Basic module.
As an example, next statements are equivalent :
//{{{
Set ofForm = Forms("anyform")
//}}}
and
//{{{
Set ofForm = Application.Forms("anyform")
//}}}
However, __the second one is recommended__ to avoid risks of naming collisions between concurrent Basic libraries.
!!Functions returning objects
| !Function | !Description |
|[[AllDialogs]] |Collection of dialogs, active or not. |
|[[AllForms]] |Collection of forms, open or not. |
|[[AllModules]] |All Basic scripts available in the currently loaded Basic libraries. |
|[[CommandBars]] |Collection of tool-, menu- and statusbars associated with the current window. |
|[[CurrentDb]] |Returns the current [[database|Database]] object, i.e. the only database from a Base (".odb" document, or the database linked with the first [[standalone form|Standalone Forms]] contained in a non-Base (Writer, Calc, ...) document. |
|[[Events]] |Returns the currently running [[event|Event]] as an object. |
|[[Forms]] |Collection of open forms. |
|[[OpenDatabase]] |Returns a [[database|Database]] object giving access to the data stored in that database. |
|[[TempVars]] |Collection of temporary variables available thru the whole ~LibreOffice/~OpenOffice session. |
!!Properties
| !Property | !Type | !Description |
|[[CurrentUser]] | String |The logon name of the current user. |
|[[DAvg]]<br />[[DCount]]<br />[[DLookup]]<br />[[DMin, DMax]]<br />[[DStDev, DStDevP]]<br />[[DSum]]<br />[[DVar, DVarP]] | Any |The database functions. |
|[[HtmlEncode]] | String |Returns an Html encoded string. |
|[[ProductCode]] | String |Returns "~Access2Base x.y.z" where x.y.z equals the version number of the library. |
|[[Version]] | String |Returns "~LibreOffice x.y.z" or "~OpenOffice x.y.z" where x.y.z is the version number. |
!!Methods
|[[OpenConnection]] |To be run to connect the application to the database. |
|[[CloseConnection]] |To be run to disconnect the application from the database. |</pre>
</div>
<div title="ApplyApplication" modifier="Jean-Pierre Ledure" created="201301111830" modified="201407111109" tags="NoTag" changecount="2">
<pre>!!!Applies to ...
| !Object | !Description |
|[[Application]] |Root class. When present, its name must be "{{{Application}}}" but the object name is optional. |</pre>
</div>
<div title="ApplyDoCmd" modifier="Jean-Pierre Ledure" created="201301121114" modified="201407111108" tags="NoTag" changecount="1">
<pre>!!!Applies to ...
| !Object | !Description |
|[[DoCmd]] |Root class. When present, its name must be "{{{DoCmd}}}" but the object name is optional. |</pre>
</div>
<div title="ApplyFilter" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201410261037" modified="201412301558" tags="Actions" changecount="25">
<pre>{{firstletter{
@@color:#930;U@@
}}}se the //~ApplyFilter// action to apply a filter, a query, or an SQL WHERE clause to a table, form, subform or query to restrict the records in the table or query, or the records from the underlying table or query of the form/subform.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]ApplyFilter(}}}//{{{[filter], [SQLwhere], [controlname]}}}//{{{)}}}
| !Argument | !Optional | !Type |!Description |
|{{{filter}}} | Yes | String |The //Filter// and //~SQLWhere// arguments have identical meanings.<br />They both contain a SQL ''Where'' clause without the word //Where//.<br />If both arguments are present, __the second argument__ only is applied to the data. |
|{{{SQLwhere}}} |~|~|~|
|{{{controlname}}} |~|~|The name of a subform of the active form. |
!!!Remarks
*The //~ApplyFilter// action must not be called from a [[standalone form|Standalone Forms]].
*The //~ApplyFilter// action is applied on the current window. To make a window current, use the [[SelectObject]] action. If the current window is neither a form, a table datasheet or a query datasheet, the //~ApplyFilter// action return {{{False}}} and ignores the request.
*The //~ApplyFilter// action, when applied to a table or a query datasheet, __does NOT work in //~OpenOffice//__ (//~LibreOffice// OK).
*To apply a filter on a table or a query with //~ApplyFilter//, the table or the query must be open. Eventually use therefore the [[OpenTable]] or [[OpenQuery]] actions.
*If //controlname// is present, the active window is expected to be a form. Otherwise //~ApplyFilter// refurns {{{False}}} and the request is ignored. The //controlname// is NOT case-sensitive. If //controlname// does not exist in the active form or is not the name of one of its [[subforms|SubForm]] then the action generates a run-time error.
*When a filter is applied with //~ApplyFilter// the first record (if it exists ...) becomes the current record.
*Once applied, the filter is preserved for subsequent table or query openings during the same //~LibreOffice/~OpenOffice// session. It will become persistent when the database file ("*.odb") is saved.
*In the filter argument, record and field names may be surrounded by square brackets. They will be replaced with the correct character surrounding such names in SQL statements targeted to be run on the concerned RDBMS (Relational Database Management System).
*Giving the null-length string ("") as filter argument resets any pre-existing filter.
!!!Error messages
|Argument nr.X [Value = '...'] is invalid|
|Control '...' not found in parent (form, grid or dialog) '...' |
|Subform '...' not found in parent form '...' |
!!!See also
[[Filter]]
[[FilterOn]]
[[GoToRecord]]
[[SelectObject]]
[[SetFocus]]
[[SetOrderBy]]
!!!Example
<<tiddler "ApplyFilter example">></pre>
</div>
<div title="ApplyFilter example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201410261735" modified="201410261735" tags="[[Snippets of Code]]" changecount="2">
<pre>Set and apply a filter on the data displayed by a query
//{{{
Dim sApplyFilter As String
Const cstQueryName = "myQuery"
OpenQuery(cstQueryName)
sApplyFilter = "[USUAL NAME] LIKE 'W%'"
SelectObject(acQuery, cstQueryName)
DoCmd.ApplyFilter(sApplyFilter)
//}}}</pre>
</div>
<div title="AskBeforeSaving" modifier="Jean-PierreLedure" created="201212231635" modified="201308161222" tags="HowTo">
<pre>(Q) How can I control when a record is saved in a form ?
(R) Use the form's //Before record change// event to run code each time Base tries to save a record. This way, if the user doesn't want to save a record, you can issue an Undo command instead of saving the record.
For strange reasons the //Before record change// form event is fired twice by //AAO/~LibO// while in most cases one occurrence would be sufficient. That's where the //Recommendation// property becomes useful.
Read [[Roberto Benitez's Forms and Dialogs document|http://www.baseprogramming.com/FormsAndDialogs.pdf]] about this strange behaviour (p. 20+).
!!!Solution
Next code will make it. The event fires here a //Function// which will return {{{True}}} only if the modification is confirmed by the user. Otherwise the //Undo// command is run automatically. Other requests for changes (INSERT or DELETE actions) will be accepted blindly.
//{{{
Function AskBeforeSave(poEvent As Object) As Boolean
Dim sMsg As String, oEvent As Object
REM MsgBox constants
Const vbYesNo = 4 ' Yes and No buttons
Const vbQuestion = 32 ' Warning query
Const vbYes = 6 ' Yes button pressed
AskBeforeSave = True
Set oEvent = Events(poEvent)
If oEvent.Recommendation = "IGNORE" Then Exit Function
If oEvent.RowChangeAction <> com.sun.star.sdb.RowChangeAction.UPDATE Then Exit Function ' INSERT / DELETE ignored
sMsg = "Data has changed." & Chr(13) & "Do you wish to save the changes?" _
& Chr(13) & "Click Yes to save or No to discard changes."
If MsgBox(sMsg, vbQuestion + vbYesNo, "Save record ?") <> vbYes Then
RunCommand("RecUndo") ' Cancel editing done
AskBeforeSave = False
End If
End Function
//}}}
!!!See also
[[Event]]
[[Events Handler]]
[[RunCommand]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|~NewRec |~Customers_NewRec |Before record action ||||</pre>
</div>
<div title="AttachFileMIMETypes" modifier="Jean-Pierre Ledure" created="201108061432" modified="201108061603" tags="excludeLists">
<pre>text/plain
.txt .text .js .vbs .asp .cgi .pl
----
text/html
.htm .html .hta .htx .mht
----
text/comma-separated-values
.csv
----
text/javascript
.js
----
text/css
.css
----
text/xml
.xml .xsl .xslt
----
image/gif
.gif
----
image/jpeg
.jpg .jpe .jpeg
----
image/png
.png
----
image/bmp
.bmp
----
image/tiff
.tif .tiff
----
audio/basic
.au .snd
----
audio/wav
.wav
----
audio/x-pn-realaudio
.ra .rm .ram
----
audio/x-midi
.mid .midi
----
audio/mp3
.mp3
----
audio/m3u
.m3u
----
video/x-ms-asf
.asf
----
video/avi
.avi
----
video/mpeg
.mpg .mpeg
----
video/quicktime
.qt .mov .qtvr
----
application/pdf
.pdf
----
application/rtf
.rtf
----
application/postscript
.ai .eps .ps
----
application/wordperfect
.wpd
----
application/mswrite
.wri
----
application/msexcel
.xls .xls3 .xls4 .xls5 .xlw
----
application/msword
.doc
----
application/mspowerpoint
.ppt .pps
----
application/x-director
.swa
----
application/x-shockwave-flash
.swf
----
application/x-zip-compressed
.zip
----
application/x-gzip
.gz
----
application/x-rar-compressed
.rar
----
application/octet-stream
.com .exe .dll .ocx
----
application/java-archive
.jar</pre>
</div>
<div title="AttachFilePlugin" modifier="Jean-PierreLedure" created="201108061423" modified="201304121729" tags="systemConfig excludeLists">
<pre>/***
|Name|AttachFilePlugin|
|Source|http://www.TiddlyTools.com/#AttachFilePlugin|
|Documentation|http://www.TiddlyTools.com/#AttachFilePluginInfo|
|Version|4.0.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires|AttachFilePluginFormatters, AttachFileMIMETypes|
|Description|Store binary files as base64-encoded tiddlers with fallback links for separate local and/or remote file storage|
Store or link binary files (such as jpg, gif, pdf or even mp3) within your TiddlyWiki document and then use them as images or links from within your tiddler content.
> Important note: As of version 3.6.0, in order to //render// images and other binary attachments created with this plugin, you must also install [[AttachFilePluginFormatters]], which extends the behavior of the TiddlyWiki core formatters for embedded images ({{{[img[tooltip|image]]}}}), linked embedded images ({{{[img[tooltip|image][link]]}}}), and external/"pretty" links ({{{[[label|link]]}}}), so that these formatter will process references to attachment tiddlers as if a normal file reference had been provided. |
!!!!!Documentation
>see [[AttachFilePluginInfo]]
!!!!!Inline interface (live)
>see [[AttachFile]] (shadow tiddler)
><<tiddler AttachFile>>
!!!!!Revisions
<<<
2011.02.14 4.0.1 fix OSX error: use picker.file.path
2009.06.04 4.0.0 changed attachment storage format to use //sections// instead of embedded substring markers.
|please see [[AttachFilePluginInfo]] for additional revision details|
2005.07.20 1.0.0 Initial Release
<<<
!!!!!Code
***/
// // version
//{{{
version.extensions.AttachFilePlugin= {major: 4, minor: 0, revision: 1, date: new Date(2011,2,14)};
// shadow tiddler
config.shadowTiddlers.AttachFile="<<attach inline>>";
// add 'attach' backstage task (insert before built-in 'importTask')
if (config.tasks) { // for TW2.2b or above
config.tasks.attachTask = {
text: "attach",
tooltip: "Attach a binary file as a tiddler",
content: "<<attach inline>>"
}
config.backstageTasks.splice(config.backstageTasks.indexOf("importTask"),0,"attachTask");
}
config.macros.attach = {
// // lingo
//{{{
label: "attach file",
tooltip: "Attach a file to this document",
linkTooltip: "Attachment: ",
typeList: "AttachFileMIMETypes",
titlePrompt: " enter tiddler title...",
MIMEPrompt: "<option value=''>select MIME type...</option><option value='editlist'>[edit list...]</option>",
localPrompt: " enter local path/filename...",
URLPrompt: " enter remote URL...",
tiddlerErr: "Please enter a tiddler title",
sourceErr: "Please enter a source path/filename",
storageErr: "Please select a storage method: embedded, local or remote",
MIMEErr: "Unrecognized file format. Please select a MIME type",
localErr: "Please enter a local path/filename",
URLErr: "Please enter a remote URL",
fileErr: "Invalid path/file or file not found",
tiddlerFormat: '!usage\n{{{%0}}}\n%0\n!notes\n%1\n!type\n%2\n!file\n%3\n!url\n%4\n!data\n%5\n',
//}}}
// // macro definition
//{{{
handler:
function(place,macroName,params) {
if (params && !params[0])
{ createTiddlyButton(place,this.label,this.tooltip,this.toggleAttachPanel); return; }
var id=params.shift();
this.createAttachPanel(place,id+"_attachPanel",params);
document.getElementById(id+"_attachPanel").style.position="static";
document.getElementById(id+"_attachPanel").style.display="block";
},
//}}}
//{{{
createAttachPanel:
function(place,panel_id,params) {
if (!panel_id || !panel_id.length) var panel_id="_attachPanel";
// remove existing panel (if any)
var panel=document.getElementById(panel_id); if (panel) panel.parentNode.removeChild(panel);
// set styles for this panel
setStylesheet(this.css,"attachPanel");
// create new panel
var title=""; if (params && params[0]) title=params.shift();
var types=this.MIMEPrompt+this.formatListOptions(store.getTiddlerText(this.typeList)); // get MIME types
panel=createTiddlyElement(place,"span",panel_id,"attachPanel",null);
var html=this.html.replace(/%id%/g,panel_id);
html=html.replace(/%title%/g,title);
html=html.replace(/%disabled%/g,title.length?"disabled":"");
html=html.replace(/%IEdisabled%/g,config.browser.isIE?"disabled":"");
html=html.replace(/%types%/g,types);
panel.innerHTML=html;
if (config.browser.isGecko) { // FF3 FIXUP
document.getElementById("attachSource").style.display="none";
document.getElementById("attachFixPanel").style.display="block";
}
return panel;
},
//}}}
//{{{
toggleAttachPanel:
function (e) {
if (!e) var e = window.event;
var parent=resolveTarget(e).parentNode;
var panel = document.getElementById("_attachPanel");
if (panel==undefined || panel.parentNode!=parent)
panel=config.macros.attach.createAttachPanel(parent,"_attachPanel");
var isOpen = panel.style.display=="block";
if(config.options.chkAnimate)
anim.startAnimating(new Slider(panel,!isOpen,e.shiftKey || e.altKey,"none"));
else
panel.style.display = isOpen ? "none" : "block" ;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
return(false);
},
//}}}
//{{{
formatListOptions:
function(text) {
if (!text || !text.trim().length) return "";
// get MIME list content from text
var parts=text.split("\n----\n");
var out="";
for (var p=0; p<parts.length; p++) {
var lines=parts[p].split("\n");
var label=lines.shift(); // 1st line=display text
var value=lines.shift(); // 2nd line=item value
out +='<option value="%1">%0</option>'.format([label,value]);
}
return out;
},
//}}}
// // interface definition
//{{{
css:
".attachPanel { display: none; position:absolute; z-index:10; width:35em; right:105%; top:0em;\
background-color: #eee; color:#000; font-size: 8pt; line-height:110%;\
border:1px solid black; border-bottom-width: 3px; border-right-width: 3px;\
padding: 0.5em; margin:0em; -moz-border-radius:1em;-webkit-border-radius:1em; text-align:left }\
.attachPanel form { display:inline;border:0;padding:0;margin:0; }\
.attachPanel select { width:99%;margin:0px;font-size:8pt;line-height:110%;}\
.attachPanel input { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\
.attachPanel textarea { width:98%;margin:0px;height:2em;font-size:8pt;line-height:110%}\
.attachPanel table { width:100%;border:0;margin:0;padding:0;color:inherit; }\
.attachPanel tbody, .attachPanel tr, .attachPanel td { border:0;margin:0;padding:0;color:#000; }\
.attachPanel .box { border:1px solid black; padding:.3em; margin:.3em 0px; background:#f8f8f8; \
-moz-border-radius:5px;-webkit-border-radius:5px; }\
.attachPanel .chk { width:auto;border:0; }\
.attachPanel .btn { width:auto; }\
.attachPanel .btn2 { width:49%; }\
",
//}}}
//{{{
html:
'<form>\
attach from source file\
<input type="file" id="attachSource" name="source" size="56"\
onChange="config.macros.attach.onChangeSource(this)">\
<div id="attachFixPanel" style="display:none"><!-- FF3 FIXUP -->\
<input type="text" id="attachFixSource" style="width:90%"\
title="Enter a path/file to attach"\
onChange="config.macros.attach.onChangeSource(this);">\
<input type="button" style="width:7%" value="..."\
title="Enter a path/file to attach"\
onClick="config.macros.attach.askForFilename(document.getElementById(\'attachFixSource\'));">\
</div><!--end FF3 FIXUP-->\
<div class="box">\
<table style="border:0"><tr style="border:0"><td style="border:0;text-align:right;width:1%;white-space:nowrap">\
embed data <input type=checkbox class=chk name="useData" %IEdisabled% \
onclick="if (!this.form.MIMEType.value.length)\
this.form.MIMEType.selectedIndex=this.checked?1:0; ">&nbsp;\
</td><td style="border:0">\
<select size=1 name="MIMEType" \
onchange="this.title=this.value; if (this.value==\'editlist\')\
{ this.selectedIndex=this.form.useData.checked?1:0; story.displayTiddler(null,config.macros.attach.typeList,2); return; }">\
<option value=""></option>\
%types%\
</select>\
</td></tr><tr style="border:0"><td style="border:0;text-align:right;width:1%;white-space:nowrap">\
local link <input type=checkbox class=chk name="useLocal"\
onclick="this.form.local.value=this.form.local.defaultValue=this.checked?config.macros.attach.localPrompt:\'\';">&nbsp;\
</td><td style="border:0">\
<input type=text name="local" size=15 autocomplete=off value=""\
onchange="this.form.useLocal.checked=this.value.length" \
onkeyup="this.form.useLocal.checked=this.value.length" \
onfocus="if (!this.value.length) this.value=config.macros.attach.localPrompt; this.select()">\
</td></tr><tr style="border:0"><td style="border:0;text-align:right;width:1%;white-space:nowrap">\
remote link <input type=checkbox class=chk name="useURL"\
onclick="this.form.URL.value=this.form.URL.defaultValue=this.checked?config.macros.attach.URLPrompt:\'\';\">&nbsp;\
</td><td style="border:0">\
<input type=text name="URL" size=15 autocomplete=off value=""\
onfocus="if (!this.value.length) this.value=config.macros.attach.URLPrompt; this.select()"\
onchange="this.form.useURL.checked=this.value.length;"\
onkeyup="this.form.useURL.checked=this.value.length;">\
</td></tr></table>\
</div>\
<table style="border:0"><tr style="border:0"><td style="border:0;text-align:right;vertical-align:top;width:1%;white-space:nowrap">\
notes&nbsp;\
</td><td style="border:0" colspan=2>\
<textarea name="notes" style="width:98%;height:3.5em;margin-bottom:2px"></textarea>\
</td><tr style="border:0"><td style="border:0;text-align:right;width:1%;white-space:nowrap">\
attach as&nbsp;\
</td><td style="border:0" colspan=2>\
<input type=text name="tiddlertitle" size=15 autocomplete=off value="%title%"\
onkeyup="if (!this.value.length) { this.value=config.macros.attach.titlePrompt; this.select(); }"\
onfocus="if (!this.value.length) this.value=config.macros.attach.titlePrompt; this.select()" %disabled%>\
</td></tr></tr><tr style="border:0"><td style="border:0;text-align:right;width:1%;white-space:nowrap">\
add tags&nbsp;\
</td><td style="border:0">\
<input type=text name="tags" size=15 autocomplete=off value="" onfocus="this.select()">\
</td><td style="width:40%;text-align:right;border:0">\
<input type=button class=btn2 value="attach"\
onclick="config.macros.attach.onClickAttach(this)"><!--\
--><input type=button class=btn2 value="close"\
onclick="var panel=document.getElementById(\'%id%\'); if (panel) panel.parentNode.removeChild(panel);">\
</td></tr></table>\
</form>',
//}}}
// // control processing
//{{{
onChangeSource:
function(here) {
var form=here.form;
var list=form.MIMEType;
var theFilename = here.value;
var theExtension = theFilename.substr(theFilename.lastIndexOf('.')).toLowerCase();
// if theFilename is in current document folder, remove path prefix and use relative reference
var h=document.location.href; folder=getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf("/")+1)));
if (theFilename.substr(0,folder.length)==folder) theFilename='./'+theFilename.substr(folder.length);
else theFilename='file:///'+theFilename; // otherwise, use absolute reference
theFilename=theFilename.replace(/\\/g,"/"); // fixup: change \ to /
form.useLocal.checked = true;
form.local.value = theFilename;
form.useData.checked = !form.useData.disabled;
list.selectedIndex=1;
for (var i=0; i<list.options.length; i++) // find matching MIME type
if (list.options[i].value.indexOf(theExtension)!=-1) { list.selectedIndex = i; break; }
if (!form.tiddlertitle.disabled)
form.tiddlertitle.value=theFilename.substr(theFilename.lastIndexOf('/')+1); // get tiddlername from filename
},
//}}}
//{{{
onClickAttach:
function (here) {
clearMessage();
// get input values
var form=here.form;
var src=form.source; if (config.browser.isGecko) src=document.getElementById("attachFixSource");
src=src.value!=src.defaultValue?src.value:"";
var when=(new Date()).formatString(config.macros.timeline.dateFormat);
var title=form.tiddlertitle.value;
var local = form.local.value!=form.local.defaultValue?form.local.value:"";
var url = form.URL.value!=form.URL.defaultValue?form.URL.value:"";
var notes = form.notes.value;
var tags = "attachment excludeMissing "+form.tags.value;
var useData=form.useData.checked;
var useLocal=form.useLocal.checked;
var useURL=form.useURL.checked;
var mimetype = form.MIMEType.value.length?form.MIMEType.options[form.MIMEType.selectedIndex].text:"";
// validate checkboxes and get filename
if (useData) {
if (src.length) { if (!theLocation) var theLocation=src; }
else { alert(this.sourceErr); src.focus(); return false; }
}
if (useLocal) {
if (local.length) { if (!theLocation) var theLocation = local; }
else { alert(this.localErr); form.local.focus(); return false; }
}
if (useURL) {
if (url.length) { if (!theLocation) var theLocation = url; }
else { alert(this.URLErr); form.URL.focus(); return false; }
}
if (!(useData||useLocal||useURL))
{ form.useData.focus(); alert(this.storageErr); return false; }
if (!theLocation)
{ src.focus(); alert(this.sourceErr); return false; }
if (!title || !title.trim().length || title==this.titlePrompt)
{ form.tiddlertitle.focus(); alert(this.tiddlerErr); return false; }
// if not already selected, determine MIME type based on filename extension (if any)
if (useData && !mimetype.length && theLocation.lastIndexOf('.')!=-1) {
var theExt = theLocation.substr(theLocation.lastIndexOf('.')).toLowerCase();
var theList=form.MIMEType;
for (var i=0; i<theList.options.length; i++)
if (theList.options[i].value.indexOf(theExt)!=-1)
{ var mimetype=theList.options[i].text; theList.selectedIndex=i; break; }
}
// attach the file
return this.createAttachmentTiddler(src, when, notes, tags, title,
useData, useLocal, useURL, local, url, mimetype);
},
getMIMEType:
function(src,def) {
var ext = src.substr(src.lastIndexOf('.')).toLowerCase();
var list=store.getTiddlerText(this.typeList);
if (!list || !list.trim().length) return def;
// get MIME list content from tiddler
var parts=list.split("\n----\n");
for (var p=0; p<parts.length; p++) {
var lines=parts[p].split("\n");
var mime=lines.shift(); // 1st line=MIME type
var match=lines.shift(); // 2nd line=matching extensions
if (match.indexOf(ext)!=-1) return mime;
}
return def;
},
createAttachmentTiddler:
function (src, when, notes, tags, title, useData, useLocal, useURL, local, url, mimetype, noshow) {
if (useData) { // encode the data
if (!mimetype.length) {
alert(this.MIMEErr);
form.MIMEType.selectedIndex=1; form.MIMEType.focus();
return false;
}
var d = this.readFile(src); if (!d) { return false; }
displayMessage('encoding '+src);
var encoded = this.encodeBase64(d);
displayMessage('file size='+d.length+' bytes, encoded size='+encoded.length+' bytes');
}
var usage=(mimetype.substr(0,5)=="image"?'[img[%0]]':'[[%0|%0]]').format([title]);
var theText=this.tiddlerFormat.format([
usage, notes.length?notes:'//none//', mimetype,
useLocal?local.replace(/\\/g,'/'):'', useURL?url:'',
useData?('data:'+mimetype+';base64,'+encoded):'' ]);
store.saveTiddler(title,title,theText,config.options.txtUserName,new Date(),tags);
var panel=document.getElementById("attachPanel"); if (panel) panel.style.display="none";
if (!noshow) { story.displayTiddler(null,title); story.refreshTiddler(title,null,true); }
displayMessage('attached "'+title+'"');
return true;
},
//}}}
// // base64 conversion
//{{{
encodeBase64:
function (d) {
if (!d) return null;
// encode as base64
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var out="";
var chr1,chr2,chr3="";
var enc1,enc2,enc3,enc4="";
for (var count=0,i=0; i<d.length; ) {
chr1=d.charCodeAt(i++);
chr2=d.charCodeAt(i++);
chr3=d.charCodeAt(i++);
enc1=chr1 >> 2;
enc2=((chr1 & 3) << 4) | (chr2 >> 4);
enc3=((chr2 & 15) << 2) | (chr3 >> 6);
enc4=chr3 & 63;
if (isNaN(chr2)) enc3=enc4=64;
else if (isNaN(chr3)) enc4=64;
out+=keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);
chr1=chr2=chr3=enc1=enc2=enc3=enc4="";
}
return out;
},
decodeBase64: function(input) {
var out="";
var chr1,chr2,chr3;
var enc1,enc2,enc3,enc4;
var i = 0;
// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
input=input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
do {
enc1=keyStr.indexOf(input.charAt(i++));
enc2=keyStr.indexOf(input.charAt(i++));
enc3=keyStr.indexOf(input.charAt(i++));
enc4=keyStr.indexOf(input.charAt(i++));
chr1=(enc1 << 2) | (enc2 >> 4);
chr2=((enc2 & 15) << 4) | (enc3 >> 2);
chr3=((enc3 & 3) << 6) | enc4;
out=out+String.fromCharCode(chr1);
if (enc3!=64) out=out+String.fromCharCode(chr2);
if (enc4!=64) out=out+String.fromCharCode(chr3);
} while (i<input.length);
return out;
},
//}}}
// // I/O functions
//{{{
readFile: // read local BINARY file data
function(filePath) {
if(!window.Components) { return null; }
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); }
catch(e) { alert("access denied: "+filePath); return null; }
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
try { file.initWithPath(filePath); } catch(e) { alert("cannot read file - invalid path: "+filePath); return null; }
if (!file.exists()) { alert("cannot read file - not found: "+filePath); return null; }
var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
inputStream.init(file, 0x01, 00004, null);
var bInputStream = Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream);
bInputStream.setInputStream(inputStream);
return(bInputStream.readBytes(inputStream.available()));
},
//}}}
//{{{
writeFile:
function(filepath,data) {
// TBD: decode base64 and write BINARY data to specified local path/filename
return(false);
},
//}}}
//{{{
askForFilename: // for FF3 fixup
function(target) {
var msg=config.messages.selectFile;
if (target && target.title) msg=target.title; // use target field tooltip (if any) as dialog prompt text
// get local path for current document
var path=getLocalPath(document.location.href);
var p=path.lastIndexOf("/"); if (p==-1) p=path.lastIndexOf("\\"); // Unix or Windows
if (p!=-1) path=path.substr(0,p+1); // remove filename, leave trailing slash
var file=""
var result=window.mozAskForFilename(msg,path,file,true); // FF3 FIXUP ONLY
if (target && result.length) // set target field and trigger handling
{ target.value=result; target.onchange(); }
return result;
}
};
//}}}
//{{{
if (window.mozAskForFilename===undefined) { // also defined by CoreTweaks (for ticket #604)
window.mozAskForFilename=function(msg,path,file,mustExist) {
if(!window.Components) return false;
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
picker.init(window, msg, mustExist?nsIFilePicker.modeOpen:nsIFilePicker.modeSave);
var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
thispath.initWithPath(path);
picker.displayDirectory=thispath;
picker.defaultExtension='';
picker.defaultString=file;
picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
if (picker.show()!=nsIFilePicker.returnCancel)
var result=picker.file.path;
}
catch(ex) { displayMessage(ex.toString()); }
return result;
}
}
//}}}</pre>
</div>
<div title="AttachFilePluginFormatters" modifier="Jean-Pierre Ledure" created="201108061429" modified="201108061604" tags="systemConfig excludeLists">
<pre>/***
|Name|AttachFilePluginFormatters|
|Source|http://www.TiddlyTools.com/#AttachFilePluginFormatters|
|Version|4.0.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1.3|
|Type|plugin|
|Description|run-time library for displaying attachment tiddlers|
Runtime processing for //rendering// attachment tiddlers created by [[AttachFilePlugin]]. Attachment tiddlers are tagged with<<tag attachment>>and contain binary file content (e.g., jpg, gif, pdf, mp3, etc.) that has been stored directly as base64 text-encoded data or can be loaded from external files stored on a local filesystem or remote web server. Note: after creating new attachment tiddlers, you can remove [[AttachFilePlugin]], as long as you retain //this// tiddler (so that images can be rendered later on).
!!!!!Formatters
<<<
This plugin extends the behavior of the following TiddlyWiki core "wikify()" formatters:
* embedded images: {{{[img[tooltip|image]]}}}
* linked embedded images: {{{[img[tooltip|image][link]]}}}
* external/"pretty" links: {{{[[label|link]]}}}
''Please refer to AttachFilePlugin (source: http://www.TiddlyTools.com/#AttachFilePlugin) for additional information.''
<<<
!!!!!Revisions
<<<
2009.10.10 [4.0.1] in fileExists(), check for IE to avoid hanging Chrome during startup
2009.06.04 [4.0.0] changed attachment storage format to use //sections// instead of embedded substring markers.
2008.01.08 [*.*.*] plugin size reduction: documentation moved to ...Info
2007.12.04 [*.*.*] update for TW2.3.0: replaced deprecated core functions, regexps, and macros
2007.10.29 [3.7.0] more code reduction: removed upload handling from AttachFilePlugin (saves ~7K!)
2007.10.28 [3.6.0] removed duplicate formatter code from AttachFilePlugin (saves ~10K!) and updated documentation accordingly. This plugin ([[AttachFilePluginFormatters]]) is now //''required''// in order to display attached images/binary files within tiddler content.
2006.05.20 [3.4.0] through 2007.03.01 [3.5.3] sync with AttachFilePlugin
2006.05.13 [3.2.0] created from AttachFilePlugin v3.2.0
<<<
!!!!!Code
***/
// // version
//{{{
version.extensions.AttachFilePluginFormatters= {major: 4, minor: 0, revision: 1, date: new Date(2009,10,10)};
//}}}
//{{{
if (config.macros.attach==undefined) config.macros.attach= { };
//}}}
//{{{
if (config.macros.attach.isAttachment==undefined) config.macros.attach.isAttachment=function (title) {
var tiddler = store.getTiddler(title);
if (tiddler==undefined || tiddler.tags==undefined) return false;
return (tiddler.tags.indexOf("attachment")!=-1);
}
//}}}
//{{{
// test for local file existence - returns true/false without visible error display
if (config.macros.attach.fileExists==undefined) config.macros.attach.fileExists=function(f) {
if(window.Components) { // MOZ
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); }
catch(e) { return false; } // security access denied
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
try { file.initWithPath(f); }
catch(e) { return false; } // invalid directory
return file.exists();
}
else if (config.browser.isIE) { // IE
var fso = new ActiveXObject("Scripting.FileSystemObject");
return fso.FileExists(f);
}
else return true; // other browsers: assume file exists
}
//}}}
//{{{
if (config.macros.attach.getAttachment==undefined) config.macros.attach.getAttachment=function(title) {
// extract embedded data, local and remote links (if any)
var text=store.getTiddlerText(title,'');
var embedded=store.getTiddlerText(title+'##data','').trim();
var locallink=store.getTiddlerText(title+'##file','').trim();
var remotelink=store.getTiddlerText(title+'##url','').trim();
// backward-compatibility for older attachments (pre 4.0.0)
var startmarker="---BEGIN_DATA---\n";
var endmarker="\n---END_DATA---";
var pos=0; var endpos=0;
if ((pos=text.indexOf(startmarker))!=-1 && (endpos=text.indexOf(endmarker))!=-1)
embedded="data:"+(text.substring(pos+startmarker.length,endpos)).replace(/\n/g,'');
if ((pos=text.indexOf("/%LOCAL_LINK%/"))!=-1)
locallink=text.substring(text.indexOf("|",pos)+1,text.indexOf("]]",pos));
if ((pos=text.indexOf("/%REMOTE_LINK%/"))!=-1)
remotelink=text.substring(text.indexOf("|",pos)+1,text.indexOf("]]",pos));
// if there is a data: URI defined (not supported by IE)
if (embedded.length && !config.browser.isIE) return embedded;
// document is being served remotely... use remote URL (if any) (avoids security alert)
if (remotelink.length && document.location.protocol!="file:")
return remotelink;
// local link only... return link without checking file existence (avoids security alert)
if (locallink.length && !remotelink.length)
return locallink;
// local link, check for file exist... use local link if found
if (locallink.length) {
locallink=locallink.replace(/^\.[\/\\]/,''); // strip leading './' or '.\' (if any)
if (this.fileExists(getLocalPath(locallink))) return locallink;
// maybe local link is relative... add path from current document and try again
var pathPrefix=document.location.href; // get current document path and trim off filename
var slashpos=pathPrefix.lastIndexOf("/"); if (slashpos==-1) slashpos=pathPrefix.lastIndexOf("\\");
if (slashpos!=-1 && slashpos!=pathPrefix.length-1) pathPrefix=pathPrefix.substr(0,slashpos+1);
if (this.fileExists(getLocalPath(pathPrefix+locallink))) return locallink;
}
// no embedded data, no local (or not found), fallback to remote URL (if any)
if (remotelink.length) return remotelink;
// attachment URL doesn't resolve, just return input as is
return title;
}
//}}}
//{{{
if (config.macros.attach.init_formatters==undefined) config.macros.attach.init_formatters=function() {
if (this.initialized) return;
// find the formatter for "image" and replace the handler
for (var i=0; i<config.formatters.length && config.formatters[i].name!="image"; i++);
if (i<config.formatters.length) config.formatters[i].handler=function(w) {
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) // Simple bracketted link
{
var e = w.output;
if(lookaheadMatch[5])
{
var link = lookaheadMatch[5];
// ELS -------------
var external=config.formatterHelpers.isExternalLink(link);
if (external)
{
if (config.macros.attach.isAttachment(link))
{
e = createExternalLink(w.output,link);
e.href=config.macros.attach.getAttachment(link);
e.title = config.macros.attach.linkTooltip + link;
}
else
e = createExternalLink(w.output,link);
}
else
e = createTiddlyLink(w.output,link,false,null,w.isStatic);
// ELS -------------
addClass(e,"imageLink");
}
var img = createTiddlyElement(e,"img");
if(lookaheadMatch[1])
img.align = "left";
else if(lookaheadMatch[2])
img.align = "right";
if(lookaheadMatch[3])
img.title = lookaheadMatch[3];
img.src = lookaheadMatch[4];
// ELS -------------
if (config.macros.attach.isAttachment(lookaheadMatch[4]))
img.src=config.macros.attach.getAttachment(lookaheadMatch[4]);
// ELS -------------
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
//}}}
//{{{
// find the formatter for "prettyLink" and replace the handler
for (var i=0; i<config.formatters.length && config.formatters[i].name!="prettyLink"; i++);
if (i<config.formatters.length) {
config.formatters[i].handler=function(w) {
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var e;
var text = lookaheadMatch[1];
if(lookaheadMatch[3]) {
// Pretty bracketted link
var link = lookaheadMatch[3];
if (config.macros.attach.isAttachment(link)) {
e = createExternalLink(w.output,link);
e.href=config.macros.attach.getAttachment(link);
e.title=config.macros.attach.linkTooltip+link;
}
else e = (!lookaheadMatch[2] && config.formatterHelpers.isExternalLink(link))
? createExternalLink(w.output,link)
: createTiddlyLink(w.output,link,false,null,w.isStatic);
} else {
e = createTiddlyLink(w.output,text,false,null,w.isStatic);
}
createTiddlyText(e,text);
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
} // if "prettyLink" formatter found
this.initialized=true;
}
//}}}
//{{{
config.macros.attach.init_formatters(); // load time init
//}}}
//{{{
if (TiddlyWiki.prototype.coreGetRecursiveTiddlerText==undefined) {
TiddlyWiki.prototype.coreGetRecursiveTiddlerText = TiddlyWiki.prototype.getRecursiveTiddlerText;
TiddlyWiki.prototype.getRecursiveTiddlerText = function(title,defaultText,depth) {
return config.macros.attach.isAttachment(title)?
config.macros.attach.getAttachment(title):this.coreGetRecursiveTiddlerText.apply(this,arguments);
}
}
//}}}</pre>
</div>
<div title="AttachFilePluginInfo" modifier="YourName" created="201108061426" modified="201403081100" tags="excludeLists">
<pre>/***
|Name|AttachFilePluginInfo|
|Source|http://www.TiddlyTools.com/#AttachFilePlugin|
|Documentation|http://www.TiddlyTools.com/#AttachFilePluginInfo|
|Version|4.0.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|Documentation for AttachFilePlugin|
Store or link binary files (such as jpg, gif, pdf or even mp3) within your ~TiddlyWiki document and then use them as images or links from within your tiddler content.
!!!!!Inline interface (live)
>see [[AttachFile]] (shadow tiddler)
><<tiddler AttachFile>>
!!!!!Syntax
<<<
''To display the attach file control panel, simply view the [[AttachFile]] shadow tiddler that is automatically created by the plugin, and contains an instance of the inline control panel.''. Or, you can write:
{{{
<<attach inline>>
}}}
in any tiddler to display the control panel embedded within that tiddler. Note: you can actually use any unique identifier in place of the "inline" keyword. Each unique id creates a separate instance of the controls. If the same ID is used in more than one tiddler, then the control panel is automatically moved to the most recently rendered location. Or, you can write:
{{{
<<attach>>
}}}
(with no ID parameter) in ~SidebarOptions. This adds a command link that opens the controls as a floating panel, positioned directly to the left of the sidebar.
<<<
!!!!!Usage
<<<
Binary file content can be stored in three different locations:
#embedded in the attachment tiddler (encoded as base64)
#on your filesystem (a 'local link' path/filename)
#on a web server (a 'remote link' URL)
The plugin creates an "attachment tiddler" for each file you attach. Regardless of where you store the binary content, your document can refer to the attachment tiddler rather than using a direct file or URL reference in your embedded image or external links, so that changing document locations will not require updating numerous tiddlers or copying files from one system to another.
> Important note: As of version 3.6.0, in order to //render// images and other binary attachments created with this plugin, you must also install [[AttachFilePluginFormatters]], which extends the behavior of the ~TiddlyWiki core formatters for embedded images ({{{[img[tooltip|image]]}}}), linked embedded images ({{{[img[tooltip|image][link]]}}}), and external/"pretty" links ({{{[[label|link]]}}}), so that these formatter will process references to attachment tiddlers as if a normal file reference had been provided. |
When you attach a file, a tiddler (tagged with<<tag attachment>>) is generated (using the source filename as the tiddler's title). The tiddler contains //''base64 text-encoded binary data''//, surrounded by {{{/%...%/}}} comment markers (so they are not visible when viewing the tiddler). The tiddler also includes summary details about the file: when it was attached, by whom, etc. and, if the attachment is an image file (jpg, gif, or png), the image is automatically displayed below the summary information.
>Note: although you can edit an attachment tiddler, ''don't change any of the encoded content below the attachment header'', as it has been prepared for use in the rest of your document, and even changing a single character can make the attachment unusable. //If needed, you ''can'' edit the header information or even the MIME type declaration in the attachment data, but be very careful not to change any of the base64-encoded binary data.//
Unfortunately, embedding just a few moderately-sized binary files using base64 text-encoding can dramatically increase the size of your document. To avoid this problem, you can create attachment tiddlers that define external local filesystem (file://) and/or remote web server (http://) 'reference' links, without embedding the binary data directly in the tiddler (i.e., uncheck "embed data" in the 'control panel').
These links provide an alternative source for the binary data: if embedded data is not found (or you are running on Internet Explorer, which does not currently support using embedded data), then the plugin tries the local filesystem reference. If a local file is not found, then the remote reference (if any) is used. This "fallback" approach also lets you 'virtualize' the external links in your document, so that you can access very large binary content such as ~PDFs, ~MP3's, and even *video* files, by using just a 'remote reference link' without embedding any data or downloading huge files to your hard disk.
Of course, when you //do// download an attached file, the local copy will be used instead of accessing a remote server each time, thereby saving bandwidth and allowing you to 'go mobile' without having to edit any tiddlers to alter the link locations...
<<<
!!!!!Syntax / Examples
<<<
To embed attached files as images or link to them from other tiddlers, use the standard ~TiddlyWiki image syntax ({{{[img[tooltip|filename]]}}}), linked image syntax ({{{[img[tooltip|filename][tiddlername]]}}}) , or "external link" syntax ({{{[[text|URL]]}}}), replacing the filename or URL that is normally entered with the title of an attachment tiddler.
embedded image data:
>{{{[img[Meow|tracelog dialog.png]]}}}
>[img[Meow|tracelog dialog.png]]
embedded image data with link to larger remote image:
>{{{[img[click for larger view|tracelog dialog.png][tracelog dialog.png]]}}}
>[img[click for larger view|tracelog dialog.png][tracelog dialog.png]]
'external' link to embedded image data:
>{{{[[click to view attachment|tracelog dialog.png]]}}}
>[[click to view attachment|tracelog dialog.png]]
'external' link to remote image:
>{{{[[click to view attachment|tracelog dialog.png]]}}}
>[[click to view attachment|tracelog dialog.png]]
regular ~TiddlyWiki links to attachment tiddlers:
>{{{[[tracelog dialog.png]]}}} [[tracelog dialog.png]]
>{{{[[tracelog dialog.png]]}}} [[tracelog dialog.png]]
<<<
!!!!!Defining MIME types
<<<
When you select a source file, a ''[[MIME|http://en.wikipedia.org/wiki/MIME]]'' file type is automatically suggested, based on filename extension. The AttachFileMIMETypes tiddler defines the list of MIME types that will be recognized by the plugin. Each MIME type definition consists of exactly two lines of text: the official MIME type designator (e.g., "text/plain", "image/gif", etc.), and a space-separated list of file extensions associated with that type. List entries are separated by "----" (horizontal rules).
<<<
!!!!!Known Limitations
<<<
Internet Explorer does not support the data: URI scheme, and cannot use the //embedded// data to render images or links. However, you can still use the local/remote link definitions to create file attachments that are stored externally. In addition, while it is relatively easy to read local //text// files, reading binary files is not directly supported by IE's ~FileSystemObject (FSO) methods, and other file I/O techniques are subject to security barriers or require additional MS proprietary technologies (like ASP or VB) that make implementation more difficult. As a result, you cannot //create// new attachment tiddlers using IE.
<<<
!!!!!Installation
<<<
Import (or copy/paste) the following tiddlers into your document:
* [[AttachFilePlugin]] (tagged with <<tag systemConfig>>)
* [[AttachFilePluginFormatters]] ("runtime distribution library") (tagged with <<tag systemConfig>>)
* ~TraceLog Dialog.png and ~TraceLog Dialog.png //(tagged with <<tag attachment>>)//
* [[AttachFileMIMETypes]] //(defines binary file types)//
> Important note: As of version 3.6.0, in order to //render// images and other binary attachments created with this plugin, you must also install [[AttachFilePluginFormatters]], which extends the behavior of the ~TiddlyWiki core formatters for embedded images ({{{[img[tooltip|image]]}}}), linked embedded images ({{{[img[tooltip|image][link]]}}}), and external/"pretty" links ({{{[[label|link]]}}}), so that these formatter will process references to attachment tiddlers as if a normal file reference had been provided. |
<<<
!!!!!Revisions
<<<
2009.06.04 4.0.0 changed attachment storage format to use //sections// instead of embedded substring markers.
2008.07.21 3.9.0 Fixup for ~FireFox 3: use HTML with separate text+button control instead of type='file' control
2008.05.12 3.8.1 automatically add 'attach' task to backstage (moved from ~BackstageTweaks)
2008.04.09 3.8.0 in onChangeSource(), if source matches current document folder, use relative reference for local link. Also, disable 'embed' when using IE (which //still// doesn't support data: URI)
2008.04.07 3.7.3 fixed typo in HTML for 'local file link' so that clicking in input field doesn't erase current path/file (if any)
2008.04.07 3.7.2 auto-create AttachFile shadow tiddler for inline interface
2008.01.08 [*.*.*] plugin size reduction: documentation moved to ...Info
2007.12.04 [*.*.*] update for ~TW2.3.0: replaced deprecated core functions, regexps, and macros
2007.12.03 3.7.1 in createAttachmentTiddler(), added optional "noshow" flag to suppress display of newly created tiddlers.
2007.10.29 3.7.0 code reduction: removed support for built-in upload to server... on-line hosting of binary attachments is left to the document author, who can upload/host files using 3rd-party web-based services (e.g. www.flickr.com, ) or stand-alone applications (e.g., FTP).
2007.10.28 3.6.0 code reduction: removed duplicate definition of image and prettyLink formatters. Rendering of attachment tiddlers now //requires// installation of AttachFilePluginFormatters
2007.03.01 3.5.3 use apply() to invoke hijacked function
2007.02.25 3.5.2 in hijack of "prettyLink", fix version check for ~TW2.2 compatibility (prevent incorrect use of fallback handler)
2007.01.09 3.5.1 onClickAttach() refactored to create separate createAttachmentTiddler() API for use with ~FileDropPluginHandlers
2006.11.30 3.5.0 in getAttachment(), for local references, add check for file existence and fallback to remote URL if local file not found. Added fileExists() to encapsulate FF vs. IE local file test function (IE FSO object code is TBD).
2006.11.29 3.4.8 in hijack for ~PrettyLink, 'simple bracketed link' opens tiddler instead of external link to attachment
2006.11.29 3.4.7 in readFile(), added try..catch around initWithPath() to handle invalid/non-existent paths better.
2006.11.09 3.4.6 REAL FIX for ~TWv2.1.3: incorporate new ~TW2.1.3 core "prettyLink" formatter regexp handling logic and check for version < 2.1.3 with fallback to old plugin code. Also, cleanup table layout in HTML (added "border:0" directly to table elements to override stylesheet)
2006.11.08 3.4.5 TEMPORARY FIX for ~TWv2.1.3: disable hijack of wikiLink formatter due to changes in core wikiLink regexp definition. //Links to attachments are broken, but you can still use {{{[img[TiddlerName]]}}} to render attachments as images, as well as {{{background:url('[[TiddlerName]]')}}} in CSS declarations for background images.//
2006.09.10 3.4.4 update formatters for 2.1 compatibility (use this.lookaheadRegExp instead of temp variable)
2006.07.24 3.4.3 in prettyLink formatter, added check for isShadowTiddler() to fix problem where shadow links became external links.
2006.07.13 3.4.2 in getAttachment(), fixed stripping of newlines so data: used in CSS will work
2006.05.21 3.4.1 in getAttachment(), fixed substring() to extract data: URI (was losing last character, which broken rendering of SOME images)
2006.05.20 3.4.0 hijack core getRecursiveTiddlerText() to support rendering attachments in stylesheets (e.g. {{{url([[TraceLog Dialog.png]])}}})
2006.05.20 3.3.6 add "description" feature to easily include notes in attachment tiddler (you can always edit to add them later... but...)
2006.05.19 3.3.5 add "attach as" feature to change default name for attachment tiddlers. Also, new optional param to specify tiddler name (disables editing)
2006.05.16 3.3.0 completed ~XMLHttpRequest handling for GET or POST to configurable server scripts
2006.05.13 3.2.0 added interface for upload feature. Major rewrite of code for clean object definitions. Major improvements in UI interaction and validation.
2006.05.09 3.1.1 add wikifer support for using attachments in links from "linked image" syntax: {{{[img[tip|attachment1][attachment2]]}}}
2006.05.09 3.1.0 lots of code changes: new options for attachments that use embedded data and/or links to external files (local or remote)
2006.05.03 3.0.2 added {{{/%...%/}}} comments around attachment data to hide it when viewing attachment tiddler.
2006.02.05 3.0.1 wrapped wikifier hijacks in initAttachmentFormatters() function to eliminate globals and avoid ~FireFox 1.5.0.1 crash bug when referencing globals
2005.12.27 3.0.0 Update for ~TW2.0. Automatically add 'excludeMissing' tag to attachments
2005.12.16 2.2.0 Dynamically create/remove attachPanel as needed to ensure only one instance of interface elements exists, even if there are multiple instances of macro embedding.
2005.11.20 2.1.0 added wikifier handler extensions for "image" and "prettyLink" to render tiddler attachments
2005.11.09 2.0.0 begin port from old ELS Design adaptation based on ~TW1.2.33
2005.07.20 1.0.0 Initial release (as adaptation)
<<<</pre>
</div>
<div title="BOF, EOF" modifier="Jean-PierreLedure" created="201306230517" modified="201306231430" tags="Properties">
<pre>The //BOF// property returns a value that indicates whether the current record position is before the first record in a [[Recordset]] object.
The //EOF// property returns a value that indicates whether the current record position is after the last record in a [[Recordset]] object.
!!!Applies to ...
| !Object |!Description |
|[[Recordset]] |The representation of a set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.BOF}}}
//recordset//{{{.EOF}}}
!!!Returned values
{{{Boolean}}}
!!!Remarks
*You can use the //BOF// and //EOF// properties to determine whether a //Recordset// object contains records or whether you've gone beyond the limits of a //Recordset// object when you move from record to record.
*If either the //BOF// or //EOF// property is {{{True}}}, there is no current record.
*If you open a //Recordset// object containing no records, the //BOF// and //EOF// properties are set to {{{True}}}, and the //Recordset// object's [[RecordCount]] property setting is 0. When you open a //Recordset// object that contains at least one record, the first record is the current record and the //BOF// and //EOF// properties are {{{False}}}; they remain {{{False}}} until you move beyond the beginning or end of the //Recordset// object by using the [[MovePrevious|Move (recordset)]] or [[MoveNext|Move (recordset)]] method, respectively. When you move beyond the beginning or end of the //Recordset//, there is no current record or no record exists.
*If you delete the last remaining record in the //Recordset// object, the //BOF// and //EOF// properties may remain {{{False}}} until you attempt to reposition the current record.
*Typically, when you work with all the records in a //Recordset// object, your code will loop through the records by using the //~MoveNext// method until the //EOF// property is set to {{{True}}}.
*If you use the //~MoveNext// method while the //EOF// property is set to {{{True}}} or the //~MovePrevious// method while the //BOF// property is set to {{{True}}}, an error occurs.
!!!Error messages
!!!See also
[[Move|Move (recordset)]]
[[MoveFirst|Move (recordset)]]
[[MoveLast|Move (recordset)]]
[[MoveNext|Move (recordset)]]
[[MovePrevious|Move (recordset)]]
[[Recordset]]
!!!Example
<<tiddler "OpenRecordset example">></pre>
</div>
<div title="BackColor" modifier="Jean-Pierre Ledure" created="201108051510" modified="201405291459" tags="Properties" changecount="1">
<pre>The //~BackColor// property specifies or determines the color (RGB) of the Control's background.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a Dialog |!Description |
|[[Control]] |All except<br />--~GroupBox<br />~HiddenControl<br />[[SubForm]]-- | None | All |A control on an open form |
!!!Syntax
//control//{{{.BackColor}}}
//control//{{{.BackColor}}} = //value//
!!!Returned values / Arguments
{{{Long}}}
!!!Remarks
The //~BackColor// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~BackColor' not applicable in this context |
|Value '...' is invalid for property '~BackColor' |
!!!See also
[[BorderColor]]
[[BorderStyle]]
[[ForeColor]]
!!!Example
<<tiddler "Color example">></pre>
</div>
<div title="BeginGroup" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201507211510" modified="201507211513" tags="Properties" changecount="2">
<pre>The //~BeginGroup// property returns {{{True}}} if the specified [[command bar control|CommandBarControl]] appears at the beginning of a group of controls on the command bar. The property is read-only.
!!!Applies to ...
| !Object |!Description |
|[[CommandBarControl]] |A control belonging to a [[CommandBar]]. |
!!!Syntax
//commandbarcontrol//{{{.BeginGroup}}}
!!!Returned values
{{{Boolean}}}
!!!Remarks
!!!Error messages
!!!See also
[[CommandBar]]
[[CommandBarControl]]
</pre>
</div>
<div title="BookMarkTiddler" modifier="Jean-Pierre Ledure" created="201212311155" modified="201407130938" tags="excludeLists" changecount="11">
<pre><script>
if (!window.story) window.story=window;
var url="http://www.access2base.com/access2base.html"; //store.getTiddlerText("SiteUrl");
if (!url) url=document.location.href;
var title=story.findContainingTiddler(place).id.substr(7).replace('_',' ') //var title=story.findContainingTiddler(place).id.substr(7)
var permalink=encodeURIComponent(String.encodeTiddlyLink(title));
return "\n"+"|Bookmark this page » » [["+title+"|"+url+"#"+permalink+"]]|";
</script>
</pre>
</div>
<div title="BookMarksList" modifier="Jean-PierreLedure" created="201212311322" modified="201301162009" tags="excludeLists">
<pre>*sitemap.xml
<script>
var out=""
var tids=store.getTiddlers("title","excludeLists");
var d=""
for (var t=0; t<tids.length; t++) {
var url="http://www.access2base.com/access2base.html"; //store.getTiddlerText("SiteUrl");
if (!url) url=document.location.href;
var permalink=encodeURIComponent(String.encodeTiddlyLink(tids[t].title));
d = tids[t].modified.getFullYear() + '-';
if (tids[t].modified.getMonth() + 1 < 10) d = d + '0';
d = d + (tids[t].modified.getMonth() + 1) + '-';
if (tids[t].modified.getDate() < 10) d = d + '0';
d = d +tids[t].modified.getDate();
out+="<url><loc>"+url+"#"+permalink+"</loc><lastmod>"+d+"</lastmod></url>"+"\n";
}
return "{{{\n"+out+"\n}}}\n";
</script>
*urllist.txt
<script>
var out=""
var tids=store.getTiddlers("title","excludeLists");
for (var t=0; t<tids.length; t++) {
var url="http://www.access2base.com/access2base.html"; //store.getTiddlerText("SiteUrl");
if (!url) url=document.location.href;
var permalink=encodeURIComponent(String.encodeTiddlyLink(tids[t].title));
out+=url+"#"+permalink+"\n";
}
return "{{{\n"+out+"\n}}}\n";
</script></pre>
</div>
<div title="Bookmark" modifier="Jean-Pierre Ledure" created="201205181512" modified="201408011506" tags="Properties" changecount="1">
<pre>The //Bookmark// property specifies uniquely the current record of
*a form's underlying table, query or SQL statement;
*a //Recordset// object.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form. |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//form//{{{.Bookmark}}}
//form//{{{.Bookmark}}} = //value//
//recordset//{{{.Bookmark}}}
//recordset//{{{.Bookmark}}} = //value//
!!!Returned values / Arguments
{{{Variant}}}
!!!Remarks
*There is no rule about the bookmark value returned by the API. That's why the argument must be of type {{{Variant}}}.
*The {{{value}}} argument refers to the record where to move to.
*There is no limit to the number of bookmarks you can establish. To create a bookmark for a record other than the current record, move to the desired record and assign the value of the //Bookmark// property to a {{{Variant}}} variable that identifies the record.
*The //Bookmark// property setting moves the cursor to the row identified by a valid bookmark. If the bookmark could not be located, the result set will be positioned after the last record. If the bookmark is invalid, or not generated by the current result set, then the behaviour is not defined, __even an abnormal termination is possible__.
*To make sure the //Recordset// object supports bookmarks, check the value of its [[Bookmarkable]] property before you use the //Bookmark// property. If the //Bookmarkable// property is {{{False}}}, the //Recordset// object doesn't support bookmarks, and using the //Bookmark// property results in an error.
!!!Error messages
|Form '...' is currently not open |
|Action rejected in a forward-only or not bookmarkable recordset |
|Value '...' is invalid for property 'Bookmark' |
!!!See also
[[Bookmarkable]]
[[GoToRecord]]
[[Move|Move (recordset)]]
[[MoveFirst|Move (recordset)]]
[[MoveLast|Move (recordset)]]
[[MoveNext|Move (recordset)]]
[[MovePrevious|Move (recordset)]]
[[Recordset]]
[[SetFocus]]
!!!Example
<<tiddler "Bookmark example">>
<<tiddler "Bookmark2 example">></pre>
</div>
<div title="Bookmark example" modifier="Jean-PierreLedure" created="201205181529" modified="201306231452" tags="[[Snippets of Code]]">
<pre>Register the actual record of a form
//{{{
Global gvBookmark As Variant
//}}}
//{{{
Dim ofForm As Object
Set ofForm = Forms("myForm")
gvBookmark = ofForm.Bookmark
//}}}
Later on, for any reason, go back to same record
//{{{
Dim ofForm As Object
Set ofForm = Forms("myForm")
ofForm.Bookmark = gvBookmark
//}}}</pre>
</div>
<div title="Bookmark2 example" modifier="Jean-PierreLedure" created="201306231446" modified="201306231450" tags="[[Snippets of Code]]">
<pre>Walk through a recordset with bookmarks
//{{{
Dim oRecordset As Object, vBookmark As Variant
Set oRecordset = Application.CurrentDb().OpenRecordset("SELECT * FROM [ARTICLE]")
With oRecordset
.Move(1000)
If .Bookmarkable Then
vBookmark = .Bookmark
.MoveLast
MsgBox "Last record = # " & .RecordCount
.Bookmark = vBookmark ' Back to bookmarked record
End If
.mClose() ' Never forget !!
End With
//}}}</pre>
</div>
<div title="Bookmarkable" modifier="Jean-Pierre Ledure" created="201306231410" modified="201408011506" tags="Properties" changecount="1">
<pre>The //Bookmarkable// property returns a value that indicates whether a [[Recordset]] object supports bookmarks, which you can set by using the [[Bookmark]] property.
!!!Applies to ...
| !Object |!Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.Bookmarkable}}}
!!!Returned values
{{{Boolean}}}
!!!Remarks
Check the Bookmarkable property setting of a //Recordset// object before you attempt to set or check the Bookmark property.
!!!Error messages
!!!See also
[[Bookmark]]
[[GoToRecord]]
[[Move|Move (recordset)]]
[[MoveFirst|Move (recordset)]]
[[MoveLast|Move (recordset)]]
[[MoveNext|Move (recordset)]]
[[MovePrevious|Move (recordset)]]
[[Recordset]]
[[SetFocus]]
!!!Example
<<tiddler "Bookmark2 example">></pre>
</div>
<div title="BorderColor" modifier="Jean-Pierre Ledure" created="201107221356" modified="201405291500" tags="Properties" changecount="1">
<pre>The //~BorderColor// property specifies or determines the color (RGB) of a Control's border.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a Dialog |!Description |
|[[Control]] |All except<br />--~CheckBox<br />~CommandButton<br />~GroupBox<br />~HiddenControl<br />~NavigationBar<br />[[RadioButton]]<br />[[SubForm]]-- | None |All except<br />--~CheckBox<br />~CommandButton<br />~FixedLine<br />[[RadioButton]]-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.BorderColor}}}
//control//{{{.BorderColor}}} = //value//
!!!Returned values / Arguments
{{{Long}}}
!!!Remarks
*The //~BorderColor// property is not compatible with all values of the [[BorderStyle]] property.
*The //~BorderColor// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~BorderColor' not applicable in this context |
|Value '...' is invalid for property '~BorderColor' |
!!!See also
[[BackColor]]
[[BorderStyle]]
[[ForeColor]]
!!!Example
<<tiddler "Color example">></pre>
</div>
<div title="BorderStyle" modifier="Jean-Pierre Ledure" created="201107221407" modified="201405291501" tags="Properties" changecount="1">
<pre>The //~BorderStyle// property specifies or determines the style (normal, 3D) of a Control's border.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a Dialog |!Description |
|[[Control]] |All except<br />--~CheckBox<br />~CommandButton<br />~GroupBox<br />~HiddenControl<br />[[RadioButton]]<br />[[SubForm]]-- | None |All except<br />--~CheckBox<br />~CommandButton<br />~FixedLine<br />[[RadioButton]]-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.BorderStyle}}}
//control//{{{.BorderStyle}}} = //value//
!!!Returned values / Arguments
{{{Integer}}}
!!!Remarks
*The allowed values for ~BorderStyle are:
>0: No border
>1: 3D border
>2: simple border
*The //~BorderStyle// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~BorderStyle' not applicable in this context |
|Value '...' is invalid for property '~BorderStyle' |
!!!See also
[[BorderColor]]
!!!Example
<<tiddler "Color example">></pre>
</div>
<div title="BrowseThruControls" modifier="Jean-PierreLedure" created="201212231108" modified="201308161209" tags="HowTo">
<pre>(Q) Can I list the value of all controls on a form for debugging purposes ?
(R) Use the [[Controls]] collection on objects and nested objects recursively as shown.
Consider next tables:
<<tiddler "OrdersTable">>
<<tiddler "OrderDetailsTable">>
Define a main/sub form based on those tables (wizard is perfect for making the form ...: choose a normal format for the mainform and the grid format for the subform).
Run next code:
//{{{
Sub StartBrowseThruControls(ByVal psFormName As String)
Dim oMainForm As Object
Set oMainForm = Forms(psFormName)
BrowseThruControls(oMainForm)
End Sub
Sub BrowseThruControls(poObject As Object, ByVal Optional piLevel As Integer)
Dim i As Integer, ocControl As Object
If IsMissing(piLevel) Then piLevel = 1
For i = 0 To poObject.Controls.Count - 1
Set ocControl = poObject.Controls(i)
Select Case ocControl.SubType
Case "SUBFORMCONTROL"
DebugPrint piLevel, ocControl.SubType, ocControl.Name
BrowseThruControls(ocControl.Form, piLevel + 1)
Case "GRIDCONTROL"
DebugPrint piLevel, ocControl.SubType, ocControl.Name
BrowseThruControls(ocControl, piLevel + 1)
Case Else
If ocControl.hasProperty("Value") Then DebugPrint piLevel, ocControl.SubType, ocControl.Name, ocControl.Value
End Select
Next i
End Sub
//}}}
This will produce next result in the //~Access2Base// console:
//{{{
13:23:38 ===> 1 TEXTFIELD txtShipPostalCode 51100
13:23:38 ===> 1 FORMATTEDFIELD fmtShipVia 3
13:23:38 ===> 1 DATEFIELD datRequiredDate 01/08/1996
13:23:38 ===> 1 SUBFORMCONTROL SubForm
13:23:38 ===> 2 GRIDCONTROL SubForm_Grid
13:23:38 ===> 3 FORMATTEDFIELD OrderID 10248
13:23:38 ===> 3 FORMATTEDFIELD Discount 0
13:23:38 ===> 3 FORMATTEDFIELD ProductID 11
13:23:38 ===> 3 FORMATTEDFIELD UnitPrice 14
13:23:38 ===> 3 FORMATTEDFIELD Quantity 12
13:23:38 ===> 1 DATEFIELD datShippedDate 16/07/1996
13:23:38 ===> 1 TIMEFIELD timShippedDate 0
13:23:38 ===> 1 FORMATTEDFIELD fmtEmployeeID 5
13:23:38 ===> 1 TEXTFIELD txtShipName Vins et alcools Chevalier
13:23:38 ===> 1 TIMEFIELD timRequiredDate 0
13:23:39 ===> 1 TEXTFIELD txtShipAddress 59 rue de l'Abbaye
13:23:39 ===> 1 FORMATTEDFIELD fmtOrderID 10248
13:23:39 ===> 1 FORMATTEDFIELD fmtFreight 32,38
13:23:39 ===> 1 DATEFIELD datOrderDate 04/07/1996
13:23:39 ===> 1 TEXTFIELD txtShipCountry France
13:23:39 ===> 1 TEXTFIELD txtShipCity Reims
13:23:39 ===> 1 TEXTFIELD txtShipRegion
13:23:39 ===> 1 TIMEFIELD timOrderDate 0
13:23:39 ===> 1 TEXTFIELD txtCustomerID WILMK
//}}}
It makes clear:
*that a subform is a control like any control
*that the gridcontrol is simply embedded in the subform also like any other control
!!!See also
[[DebugPrint]]
[[Form (subform)]]
[[hasProperty]]
[[SubType]]
[[TraceConsole]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|Browse |~Orders_Browse ||||Open the form manually and run the //Main// Sub from the Basic IDE. |</pre>
</div>
<div title="BuiltIn" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201503081654" modified="201503081656" tags="Properties" changecount="4">
<pre>The //~BuiltIn// property returns {{{True}}} if the specified [[command bar|CommandBar]] or [[command bar control|CommandBarControl]] is a built-in command bar or command bar control of the container window. It returns {{{False}}} if it is a custom command bar or command bar control. The property is read-only.
!!!Applies to ...
| !Object |!Description |
|[[CommandBar]] |The representation of a tool-, menu- or statusbar. |
|[[CommandBarControl]] |A control belonging to a ~CommandBar. |
!!!Syntax
//commandbar//{{{.BuiltIn}}}
//commandbarcontrol//{{{.BuiltIn}}}
!!!Returned values
{{{Boolean}}}
!!!Remarks
!!!Error messages
!!!See also
[[CommandBar]]
[[CommandBarControl]]
!!!Example
<<tiddler "CommandBar example">></pre>
</div>
<div title="CalculatedField" modifier="Jean-PierreLedure" created="201206051612" modified="201308161051" tags="HowTo">
<pre>(Q) How do I simulate a calculated field on a form ? //AOO/~LibO// does not support such fields in forms while //~MSAccess// does.
(R)
*Make the calculated field {{{Enabled = False}}} in the Control properties sheet.
*Compute its content in the "After record Change" event.
Let's consider next tables:
<<tiddler OrdersTable>>
<<tiddler OrderDetailsTable>>
The goal is to have a form linked to the {{{Orders}}} table in which a //~SumOfDetails// calculated field contains the sum of the orders as found in the {{{Order Details}}} child records, computed as:
//{{{
[Order Details].[UnitPrice] * [Order Details].[Quantity] * (1 - [Order Details].[Discount])
//}}}
!!!(1) Solution by computing the field in Basic
Store next code in the "After record Change" event of the form :
//{{{
Sub ComputeOrderTotal(poEvent As Object)
Dim oeEvent As Object, ofForm As Object, ocSum As Object, vOrderId As Variant
Set oeEvent = Events(poEvent)
If Not IsNull(oeEvent) Then
Set ofForm =oeEvent.Source
vOrderId = ofForm.Controls("OrderID").Value
If Not IsEmpty(vOrderId) Then
Set ocSum = ofForm.Controls("SumOfDetails")
ocSum.Value = DSum("[Order Details].[UnitPrice] * [Order Details].[Quantity] * (1 - [Order Details].[Discount])" _
, "[Order Details]", "[Order Details].[OrderID]=" & vOrderId)
End If
End If
End Sub
//}}}
!!!(2) Solution with SQL only
This solution is preferable whenever possible.
To have an idea of the functions built in HSQLDB, look at [[HSLQB Built-in functions|http://wiki.openoffice.org/wiki/Built-in_functions_and_Stored_Procedures]].
Associate the form with next SQL command and the Calculated field with the //~TotalOrder// database field :
//{{{
SELECT "Orders"."OrderID", "Orders"."OrderDate", "Orders"."ShipAddress", "Orders"."ShipCity",
SUM( "Order Details"."UnitPrice" * "Order Details"."Quantity" * ( 1 - "Order Details"."Discount" ) ) AS "TotalOrder"
FROM "Order Details", "Orders" WHERE "Order Details"."OrderID" = "Orders"."OrderID"
GROUP BY "Orders"."OrderID", "Orders"."OrderDate", "Orders"."ShipAddress", "Orders"."ShipCity"
//}}}
!!!See also
[[Events Handler]]
[[getObject]]
[[DSum]]
[[Forms]]
[[Controls]]
!!!Refer to ...
| !Solution | !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
| (1) |~CalculatedField |~Orders_CalculatedField |After Record change |||
| (2) |~|~Orders_CalculatedFieldGrid ||~|~|</pre>
</div>
<div title="CalculatorDialog" modifier="YourName" created="201304121636" modified="201806200930" tags="HowTo" changecount="2">
<pre>(Q) Can a numeric field be edited thru a Calculator widget like Base forms propose a Calendar widget for date fields ?
(R) A calculator can be implemented as a [[Dialog]]. When the dialog is closed the computed result is copied into the concerned form field.
The solution must implement a //as easy as possible// programming AND user interface from the initial form event activating the calculator up to the final copy of the result into the numeric form field.
See the suggested implementation in the //Calculator// form of the provided examples database: a button with a nice calculator icon opens the dialog.
Steps:
!!!!Make a form containing the targeted numeric fields and one button by such field.
Link the //Execute action// event of each button with a macro similar to next one. One macro by each field/button pair.
//{{{
Sub StartCalculator(poEvent As Object)
' StartCalculator should be adapted to user's need:
' - it is assumed to be activated from an appropriate button
' - the field to compute is assumed in the same form or subform as the button
' - the field to compute must be of type NUMERICFIELD or CURRENCYFIELD
' - the name of the field to compute should be set in next line
' - The 3rd argument is optional. True = initialize calculator with field current value
Call StartCalcDialog(poEvent, "TargetCalcField", True)
End Sub
//}}}
Of course adapt the code to your needs !
!!!!--Design a calculator such as-- ... Export and re-import next calculator dialog ...
[img[calculator.png]]
!!!!The code behind the //~StartCalcDialog// Sub
The code is stored in the //Calculator// module of the provided example file. It is inspired by an old [[sample code from Microsoft|http://groups.engin.umd.umich.edu/CIS/course.des/cis400/vbasic/calcode.txt]].
It is generic enough to adapt the display of the decimal point to the locale settings.
1. The current status of the Calculator is constantly maintained in next variables
//{{{
Type CalcBuffer
DisplayField As Object ' Display window on calculator dialog
Operand1 As Double ' 1st Operand
Operand2 As Double ' 2nd Operand
DisplayText As String ' To display in dialog
NumberOfOperands As Integer ' 1 or 2
DecimalPoint As Boolean ' Decimal point present yet ?
LastInput As String ' Indicate type of last keypress event (NONE, CE, NUMS, NEG, OPS)
PendingOperation As String ' Indicate pending operation (+, -, *, /)
LocalePoint As String ' Local decimal point
End Type
Public gCalc As CalcBuffer
Const cstStdFormat = "General Number" ' Format of display in calculator
//}}}
2. Next Sub (the core Sub) checks the arguments, manages the display of the dialog window, and copies the result in the original numeric field if the OK button is pressed:
//{{{
Sub StartCalcDialog(poEvent, ByVal psFieldName As String, Optional ByVal pbCopy As Boolean)
Dim ocFieldToCompute As Object, ocButton As Object, ofForm As Object, oDialog As Object
Dim i As Integer, bFound As Boolean, iDialog As Integer
Set ocButton = Application.Events(poEvent).Source
If ocButton.ObjectType <> "CONTROL" Then Exit Sub
If IsMissing(pbCopy) Then pbCopy = True
'Check field name exists
Set ofForm = ocButton.Parent ' ofForm could be a form or a subform !
bFound = False
For i = 0 To ofForm.Controls().Count - 1
Set ocFieldToCompute = ofForm.Controls(i)
If UCase(ocFieldToCompute.Name) = UCase(psFieldName) Then
bFound = True
Exit For
End If
Next i
If Not bFound Then
TraceLog("ERROR", "Field name " & psFieldName & " not found in form or subform " & ofForm.Name)
Exit Sub
End If
'Check field is of admitted types
If ocFieldToCompute.SubType <> "NUMERICFIELD" And ocFieldToCompute.SubType <> "CURRENCYFIELD" Then
TraceLog("ERROR", "Field " & psFieldName & " is not numeric")
Exit Sub
End If
Const dlgOK = 1 ' OK button pressed
Const dlgCancel = 0 ' Cancel button pressed
Set oDialog = Application.AllDialogs("dlgCalc")
oDialog.Start
' Initialize gCalc
gCalc.DisplayField = oDialog.Controls("CalcDisplay")
gCalc.LocalePoint = Right(Format(0,"General Number"),1)
If pbCopy Then
gCalc.Operand1 = ocFieldToCompute.Value
gCalc.Operand2 = gCalc.Operand1
gCalc.DisplayText = Join(Split(Format(gCalc.Operand1, cstStdFormat), ","), ".")
gCalc.DecimalPoint = ( Abs(gCalc.Operand1 - Fix(gCalc.Operand1)) > 0 )
gCalc.NumberOfOperands = 1
gCalc.LastInput = "OPS"
gCalc.PendingOperation = "="
Else
gCalc.LastInput = "NONE"
gCalc.NumberOfOperands = 0
gCalc.PendingOperation = " "
gCalc.DecimalPoint = False
gCalc.Operand1 = 0
gCalc.Operand2 = 0
End If
'Load dialog
gCalc.DisplayField.Value = Format(gCalc.Operand1, cstStdFormat)
oDialog.Controls("BtnPoint").Caption = gCalc.LocalePoint ' Set decimal point button to locale setting
iDialog = oDialog.Execute
Select Case iDialog
Case dlgOK
ocFieldToCompute.Value = gCalc.Operand1
Case dlgCancel
End Select
oDialog.Terminate
Exit Sub
End Sub
//}}}
3. The calculator should react to each activation of any button in the dialog box. Link all buttons - except //OK// and //Cancel// - //Execute action// event to next Sub:
//{{{
Sub CalcButtonPressed(poEvent As Object)
Dim oEvent As Object, sName As String, oButton As Object, oDisplay As Object, sChar As String
Set oEvent = Application.Events(poEvent)
If oEvent.EventType <> "ACTIONEVENT" Then Exit Sub
Set oButton = oEvent.Source
sName = UCase(oButton.Name)
Select Case sName
Case "BTNADD" : sChar = "+"
Case "BTNSUB" : sChar = "-"
Case "BTNMULT" : sChar = "*"
Case "BTNDIV" : sChar = "/"
Case "BTNENTER" : sChar = "="
Case "BTNCLEAR" : sChar = "C"
Case "BTNCE" : sChar = "CE"
Case "BTNINVERT" : sChar = "1/x"
Case "BTNPOINT" : sChar = "."
Case Else : sChar = Right(sName, 1) ' DIGIT !!
End Select
Call ProcessKey(sChar)
Exit Sub
End Sub
//}}}
4. In addition, the caculator should react in the same way when the equivalent key is pressed. Link the //Key pressed// event of the //~CalcDisplay// field (i.e. the display of the calculator) to next Sub:
//{{{
Sub CalcKeyPressed(poEvent As Object)
Dim oEvent As Object, oDisplay As Object, sChar As String
Set oEvent = Application.Events(poEvent)
If oEvent.EventType <> "KEYEVENT" Then Exit Sub
'Accepted keys: 0-9, BACKSPACE, C, ESCAPE, dot, comma, +, -, *, /, %, =, ENTER.
'All other keys ignored
With oEvent
Select Case True ' Both KeyCode and KeyChar used to be generic across all keyboards and OS's
Case .KeyAlt, .KeyCtrl : Beep : Exit Sub ' Ignore if associated with Alt or Ctrl
Case .KeyCode = com.sun.star.awt.Key.ESCAPE Or UCase(.KeyChar) = "C" : sChar = "C"
Case .KeyCode = com.sun.star.awt.Key.BACKSPACE : sChar = "CE"
Case .KeyCode = com.sun.star.awt.Key.RETURN Or .KeyCode = com.sun.star.awt.Key.EQUAL Or .KeyChar = "="
sChar = "="
Case .KeyCode = com.sun.star.awt.Key.ADD Or .KeyChar = "+" : sChar = "+"
Case .KeyCode = com.sun.star.awt.Key.SUBTRACT Or .KeyChar = "-" : sChar = "-"
Case .KeyCode = com.sun.star.awt.Key.MULTIPLY Or .KeyChar = "*" : sChar = "*"
Case .KeyCode = com.sun.star.awt.Key.DIVIDE Or .KeyChar = "/" Or .KeyChar = ":"
sChar = "/"
Case .KeyChar = "_" : sChar = "1/x"
Case .KeyCode = com.sun.star.awt.Key.DECIMAL Or .KeyCode = com.sun.star.awt.Key.POINT _
Or .KeyCode = com.sun.star.awt.Key.COMMA Or .KeyChar = "." Or .KeyChar = ","
sChar = "."
Case .KeyChar >= "0" And .KeyChar <= "9" : sChar = .KeyChar
Case .KeyCode >= com.sun.star.awt.Key.NUM0 And .KeyCode <= com.sun.star.awt.Key.NUM9
sChar = Trim(Str(.KeyCode - com.sun.star.awt.Key.NUM0))
Case Else : Beep : Exit Sub
End Select
End With
Call ProcessKey(sChar)
Exit Sub
End Sub
//}}}
5. Now the real processing of the entered key or the clicked button:
//{{{
Sub ProcessKey(ByVal psChar As String)
' Process gCalc structure based on argument
Dim sDisplayText As String
Const cstMax = 999999999999
Select Case psChar
Case "C" ' Cancel
gCalc.DisplayText = Format(0, "0.")
gCalc.Operand1 = 0
gCalc.Operand2 = 0
gCalc.NumberOfOperands = 0
gCalc.PendingOperation = " "
gCalc.LastInput = "NONE"
Case "CE" ' Cancel entry
gCalc.DisplayText = Format(0, "0.")
gCalc.DecimalPoint = False
gCalc.LastInput = "CE"
Case "." ' Decimal point
' If last keypress was an operator, initialize DisplayText to "0."
' Otherwise, append a decimal point to the display.
If gCalc.DecimalPoint Then
Beep
Else
If gCalc.LastInput = "NEG" Then
gCalc.DisplayText = Format(0, "-0.")
ElseIf gCalc.LastInput <> "NUMS" Then
gCalc.DisplayText = Format(0, "0.")
End If
gCalc.DecimalPoint = True
gCalc.LastInput = "NUMS"
End If
Case "+", "-", "*", "/", "=" ' Arithmetic operators
' If the immediately preceeding keypress was part of a number, increment DecimalPoint. If one operand is present,
' set Operand1. If two are present, set Operand1 equal to the result of the operation on Operand1 and the current
' input string, and display the result.
sDisplayText = gCalc.DisplayText
If gCalc.LastInput = "NUMS" Then
gCalc.NumberOfOperands = gCalc.NumberOfOperands + 1
End If
Select Case gCalc.NumberOfOperands
Case 0
If psChar = "-" And gCalc.LastInput <> "NEG" Then
gCalc.DisplayText = "-" & gCalc.DisplayText
gCalc.LastInput = "NEG"
End If
Case 1
gCalc.Operand1 = Val(gCalc.DisplayText)
If psChar = "-" And gCalc.LastInput <> "NUMS" And gCalc.PendingOperation <> "=" Then
gCalc.DisplayText = "-"
gCalc.LastInput = "NEG"
End If
Case 2
gCalc.Operand2 = Val(sDisplayText)
Select Case gCalc.PendingOperation
Case "+"
gCalc.Operand1 = gCalc.Operand1 + gCalc.Operand2
Case "-"
gCalc.Operand1 = gCalc.Operand1 - gCalc.Operand2
Case "*"
gCalc.Operand1 = gCalc.Operand1 * gCalc.Operand2
Case "/"
If Sgn(gCalc.Operand2) = 0 Then
gCalc.Operand1 = cstMax * Sgn(gCalc.Operand1)
Else
gCalc.Operand1 = gCalc.Operand1 / gCalc.Operand2
End If
Case "="
gCalc.Operand1 = gCalc.Operand2
End Select
gCalc.DisplayText = Join(Split(Format(gCalc.Operand1, cstStdFormat), ","), ".")
gCalc.NumberOfOperands = 1
End Select
If gCalc.LastInput <> "NEG" Then
gCalc.LastInput = "OPS"
gCalc.PendingOperation = psChar
End If
Case "1/x" ' Invert result
If gCalc.LastInput = "NUMS" Then gCalc.Operand1 = Val(gCalc.DisplayText)
If Sgn(gCalc.Operand1) = 0 Then
gCalc.Operand1 = cstMax
Else
gCalc.Operand1 = 1 / gCalc.Operand1
End If
gCalc.LastInput = "OPS"
gCalc.DisplayText = Join(Split(Format(gCalc.Operand1, cstStdFormat), ","), ".")
Case Else ' DIGIT
' Append new number to the number in the display.
If gCalc.LastInput <> "NUMS" Then
gCalc.DisplayText = Format(0, ".")
gCalc.DecimalPoint = False
End If
If gCalc.DecimalPoint Then
gCalc.DisplayText = gCalc.DisplayText & psChar
Else
gCalc.DisplayText = Left(gCalc.DisplayText, InStr(gCalc.DisplayText, ".") - 1) & psChar & "."
End If
If gCalc.LastInput = "NEG" Then gCalc.DisplayText = "-" & gCalc.DisplayText
gCalc.LastInput = "NUMS"
End Select
'DebugPrint psChar, gCalc.Operand1, gCalc.Operand2, gCalc.PendingOperation, gCalc.NumberOfOperands, gCalc.LastInput, gCalc.DisplayText
gCalc.DisplayField.Value = Join(Split(gCalc.DisplayText, "."), gcalc.LocalePoint)
Exit Sub
End Sub
//}}}
!!!See also
[[Dialog]]
[[Control]]
[[Events Handler]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|Calculator |Calculator ||Calculator |Execute action |Enter an optional initial value and click on the icon. |
|~|dlgCalc<br />(dialog) |~|cmd0...9<br />btnClear<br />btnCE<br />btnAdd<br />btnSub<br />btnMult<br />btnDiv<br />btnEnter<br />btnInvert |Execute action ||
|~|~|~|~CalcDisplay |Key pressed |~|</pre>
</div>
<div title="Cancel" modifier="Jean-PierreLedure" created="201107221501" modified="201306151418" tags="Properties">
<pre>The //Cancel// property specifies if a command button has or not the behaviour of a Cancel button.
!!!Applies to ...
| !Oobject | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |~CommandButton | None |~CommandButton |A control on an open form or dialog |
!!!Syntax
//control//{{{.Cancel}}}
//control//{{{.Cancel}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
!!!Error messages
|Property 'Cancel' not applicable in this context |
|Value '...' is invalid for property 'Cancel' |
!!!See also
[[Default]]
!!!Example
<<tiddler "Cancel & Default example">></pre>
</div>
<div title="Cancel & Default example" modifier="Jean-PierreLedure" created="201107221501" modified="201212021555" tags="[[Snippets of Code]]">
<pre>Display the status of a command button
//{{{
Dim ocControl As Object
Set ocControl = getObject("Forms!myForm!cmdButton")
MsgBox "Cancel=" & ocControl.Cancel & " - Default=" & ocControl.Default
//}}}</pre>
</div>
<div title="CancelUpdate" modifier="Jean-PierreLedure" created="201307191636" modified="201307211501" tags="Methods">
<pre>Cancels any pending updates for a [[Recordset object|Recordset]].
!!!Applies to ...
| !Object | !Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.CancelUpdate()}}}
!!!Returned value
{{{True}}} if success.
!!!Remarks
*You can use the //~CancelUpdate// method to cancel any pending updates resulting from an [[Edit]] or [[AddNew]] operation. For example, if a user invokes the //Edit// or //~AddNew// method and hasn't yet invoked the [[Update]] method, //~CancelUpdate// cancels any changes made after //Edit// or //~AddNew// was invoked.
*Check the [[EditMode property|EditMode]] of the //Recordset// to determine if there is a pending operation that can be canceled.
*Using the //~CancelUpdate// method has the same effect as moving to another record without using the //Update// method, except that the current record doesn't change, and various properties, such as [[BOF|BOF, EOF]] and [[EOF|BOF, EOF]], aren't updated.
!!!Error Messages
!!!See also
[[AddNew]]
[[CancelUpdate]]
[[Close|Close (method)]]
[[CloseAllRecordsets]]
[[DefaultValue]]
[[Edit]]
[[Update]]
[[Value|Value (field)]]
!!!Example
<<tiddler "CancelUpdate example">></pre>
</div>
<div title="CancelUpdate example" modifier="Jean-Pierre Ledure" created="201307191637" modified="201405241103" tags="[[Snippets of Code]]" changecount="3">
<pre>Modify the last record in a table fter user confirmation
//{{{
Dim oRecordset As Object
Const cstYesNo = 4
Const cstYes = 6
Set oRecordset = Application.CurrentDb().OpenRecordset("Expenses") ' "Expenses" = a table
With oRecordset
.MoveLast
.Edit
.Fields("AMOUNT").Value = 9876
If MsgBox("Do you confirm ?", cstYesNo, "Update record") = cstYes Then .Update Else .CancelUpdate
.mClose
End With
//}}}</pre>
</div>
<div title="Caption" modifier="Jean-Pierre Ledure" created="201107161810" modified="201507121359" tags="Properties" changecount="6">
<pre>The //Caption// property specifies the text string appearing in the title bar of a [[form|Form]] or a [[dialog|Dialog]].
When related to a [[Control]] the //Caption// property refers to the text associated with the control.
When the control belongs to a [[GridControl]] the //Caption// property specifies the column header.
When related to a [[CommandBarControl]] the //Caption// property refers to the text displayed in the button.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when in a Dialog |!Description |
|[[Form]] ||||An open form. |
|[[Dialog]] |~|~|~|An active dialog. |
|[[Control]] | ~CheckBox<br />~CommandButton<br />~FixedText<br />~GroupBox<br />[[RadioButton]] | All | ~CheckBox<br />~CommandButton<br />~FixedLine<br />~FixedText<br />~GroupBox<br />[[RadioButton]] |A control on an open form, dialog or within a [[GridControl]] of one of the listed types. |
|[[CommandBarControl]] ||||An element within a [[CommandBar]]. |
!!!Syntax
//form//{{{.Caption}}}
//form//{{{.Caption}}} = //value//
//dialog//{{{.Caption}}}
//dialog//{{{.Caption}}} = //value//
//control//{{{.Caption}}}
//control//{{{.Caption}}} = //value//
//commandbarcontrol//{{{.Caption}}}
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
When applied to a ~CommandBarControl, the //Caption// property is read-only.
!!!Error messages
|Form '...' is currently not open |
|Dialog '...' not active |
|Value '...' is invalid for property 'Caption' |
!!!Examples
<<tiddler "Caption examples">></pre>
</div>
<div title="Caption examples" modifier="Jean-Pierre Ledure" created="201107161808" modified="201603281008" tags="[[Snippets of Code]]" changecount="1">
<pre>Display and change form title bar
//{{{
Dim ofForm As Object
Set ofForm = Forms("myForm")
MsgBox ofForm.Caption
ofForm.Caption = "New title"
//}}}
Change a checkbox label
//{{{
Dim ocCheckBox As Object
ocCheckBox = getObject("Forms!myForm!myChkBox")
If ocCheckBox.Value Then
ocCheckBox.Caption = "Checked"
Else
ocCheckBox.Caption = "Unchecked"
End If
//}}}</pre>
</div>
<div title="CarryToNewRecord" modifier="Jean-PierreLedure" created="201212231039" modified="201308161123" tags="HowTo">
<pre>(Q) How do I carry forward the current value of a control so that it's automatically entered for all new records?
(R) To use the current control value for new records, you need to assign it to the defaultvalue of the control.
Consider next table:
<<tiddler "CustomersTable">>
Then if a form is built on above table, link next code to the "After record change" event of the form:
//{{{
Sub SetDefaultNewRec(poEvent As Object)
Dim ofForm As Object, ocControl As Object
Set ofForm = Events(poEvent).Source ' Get the current form
Set ocControl = ofForm.Controls("txtCountry")
ocControl.DefaultValue = ocControl.Value
End Sub
//}}}
The //country// field will appear initialized with its value in the current record if the user enters a new record.
!!!See also
[[Events Handler]]
[[DefaultValue]]
[[Value]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|~NewRec |~Customers_NewRec |After record change |||Go to whichever record, then click on the //new record// button. |</pre>
</div>
<div title="CategoriesTable" modifier="Jean-PierreLedure" created="201308161556" modified="201308161557" tags="HowTo">
<pre>*Categories table
| !Fields | !Field Type | !Primary |
|~CategoryName | Text ||
|Description | Text ||
|Picture | Binary ||
|~CategoryID | ~BigInt | Y |</pre>
</div>
<div title="Chunk example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201603121447" modified="201603121449" tags="[[Snippets of Code]]" changecount="3">
<pre>Copy a binary field to another, whatever its size
//{{{
Dim oTable As Object, oBinField1 As Object, oBinField2 As Object
Dim lFieldSize As Long, vBinary As Variant
Set oTable = Application.CurrentDb().OpenRecordset("myTable")
With oTable
.MoveFirst
Set oBinField1 = .Fields("myFld1")
Set oBinField2 = .Fields("myFld2")
lFieldSize = 0
.Edit
Do While lFieldSize < oBinField1.FieldSize
vBinary = oBinField1.GetChunk(lFieldSize, 100000)
lFieldSize = lFieldSize + UBound(vBinary) + 1
oBinField2.AppendChunk(vBinary)
Loop
.Update
.mClose
End With
//}}}</pre>
</div>
<div title="Clone" modifier="Jean-PierreLedure" created="201307201254" modified="201307201425" tags="Methods">
<pre>Creates a duplicate [[Recordset object|Recordset]] that refers to the original //Recordset// object..
!!!Applies to ...
| !Object | !Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.Clone()}}}
!!!Returned value
A {{{recordset}}} object.
!!!Remarks
*Use the //Clone// method to create multiple, duplicate //Recordset// objects. Each //Recordset// can have its own current record. Using //Clone// by itself doesn't change the data in the objects or in their underlying structures. When you use the //Clone// method, you can share bookmarks between two or more //Recordset// objects because their bookmarks are interchangeable.
*You can use the //Clone// method when you want to perform an operation on a //Recordset// that requires multiple current records. When created the current record of the clone is the first record if it exists.
*A cloned //Recordset// is always read-only.
*It is forbidden to use the //Clone// method on a cloned //Recordset//.
*The cloned //Recordset(s)// must be closed __before__ the original //Recordset//.
!!!Error Messages
|Cloning a cloned Recordset is forbidden |
!!!See also
[[Close|Close (method)]]
[[OpenRecordset]]
!!!Example
<<tiddler "Clone example">></pre>
</div>
<div title="Clone example" modifier="Jean-PierreLedure" created="201307201444" modified="201307201445" tags="[[Snippets of Code]]">
<pre>Use a cloned recordset to move to a bookmark without changing the current record
//{{{
Dim oRecordset1 As Object, oRecordset2 As Object, vBookmark As Variant
Set oRecordset1 = Application.CurrentDb().OpenRecordset("SELECT * FROM [PRODUCTS]")
oRecordset1.Move(300)
DebugPrint oRecordset1.Fields("DENOMINATION").Value
vBookmark = oRecordset1.Bookmark
Set oRecordset2 = oRecordset1.Clone() ' Bookmarks become interchangeable
oRecordset1.MoveLast ' Continue navigation
oRecordset2.Bookmark = vBookmark
DebugPrint orecordset2.Fields("DENOMINATION").Value
oRecordset2.mClose() ' First close clone
oRecordset1.mClose()
//}}}</pre>
</div>
<div title="Close" modifier="Jean-Pierre Ledure" created="201201021657" modified="201603190816" tags="Actions" changecount="5">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //Close// action closes an object (table, query, form or report).
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]mClose(}}}//{{{ObjectType, ObjectName, Save}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{ObjectType}}} | No | acTable<br />acQuery<br />acForm<br />acReport |The type of object to close. |
|{{{ObjectName}}} | No | String |The name of the object to close. This argument is NOT case-sensitive. |
|{{{Save}}} | Yes | acSavePrompt |Indicates if a prompt to the user will prevent from closing without saving. acSavePrompt is the only supported value. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acForm = 2
Const acQuery = 1
Const acReport = 3
Const acTable = 0
Const acSavePrompt = 0
//}}}
!!!Remarks
*The {{{ObjectName}}} object must exist in the database document (".odb" file). However if it is not open, the command has no effect.
*If the object is a table or a query, and the object is not open, running the //Close// action will open the Table or Query and close it immediately.
*The //Close// action is not allowed from a non-Base document containing [[standalone forms|Standalone Forms]].
!!!Error messages
|Table (or form or query or report) '...' could not be closed |
|Table (or form or query or report) '...' not found |
!!!See also
[[OpenForm]]
[[OpenQuery]]
[[OpenReport]]
[[OpenTable]]
!!!Example
//{{{
DoCmd.mClose(acTable, "myTable")
//}}}</pre>
</div>
<div title="Close (method)" modifier="Jean-Pierre Ledure" created="201212291505" modified="201405240739" tags="Methods" changecount="3">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //Close// method closes the targeted object.
!!!Applies to ...
| !Object | !Description |
|[[Database]] |The representation of a database opened with the [[OpenDatabase]] method. |
|[[Form]] |The representation of an open form. |
|[[Recordset]] |The representation of a set of records. |
!!!Syntax
//database//{{{.mClose()}}}
//form//{{{.mClose()}}}
//recordset//{{{.mClose()}}}
!!!Remarks
When applied to a __database object__:
*A database object opened with //~OpenDatabase// should not remain open longer than strictly needed.
*Recordsets derived from the database object should be closed __before__ the database object.
When applied to a __form object__:
*The //Close// method is equivalent to the [[Close]] action when applied to the same form.
*The //Close// method is not allowed from a [[standalone form|Standalone Forms]] contained in a non-Base (Calc, Writer, ...) document.
When applied to a __recordset object__:
*After processing a recordset should be closed as soon as possible.
*To close all open recordsets at once, use the [[CloseAllRecordsets]] method.
*Once a //recordset// has been closed, all [[Field objects|Field]] objects derived from its [[Fields collection|Fields]] must not be used anymore.
!!!Error messages
Processing is never interrupted when the //Close// method is invoked.
!!!See also
[[OpenDatabase]]
[[OpenForm]]
[[OpenRecordset]]
[[CloseAllRecordsets]]
!!!Example
//{{{
Dim ofForm As Object
ofForm = Forms("myForm")
ofForm.mClose()
//}}}
<<tiddler "OpenRecordset example">></pre>
</div>
<div title="CloseAllRecordsets" modifier="Jean-Pierre Ledure" created="201306291005" modified="201405240712" tags="Methods" changecount="1">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~CloseAllrecordsets// method closes all the currently open [[recordsets|Recordset]] in the current database.
After processing a recordset should be closed as soon as possible. To close all open recordsets at once, use the //~CloseAllRecordsets// method.
!!!Applies to ...
| !Object | !Description |
|[[Database]] |The representation of a connected database. |
!!!Syntax
//database//{{{.CloseAllrecordsets()}}}
!!!Remarks
The current database can be retrieved by using the [[CurrentDb]] method applied either to the [[Application]] object, or to a [[form|Form]] object
!!!Error messages
Processing is never interrupted when the //~CloseAllrecordsets// method is invoked.
!!!See also
[[OpenRecordset]]
[[Close (method)]]
!!!Example
//{{{
Application.CurrentDb().CloseAllrecordsets()
//}}}</pre>
</div>
<div title="CloseConnection" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201408311544" modified="201409111620" tags="Methods" changecount="10">
<pre>{{firstletter{
@@color:#930;T@@
}}}he invocation of the //~CloseConnection// as a Sub is ''recommended'' but not mandatory before closing a document invoking the //~Access2Base// API.
<<tiddler "ApplyApplication">>
!!!Syntax
{{{Call [Application.]CloseConnection ()}}}
!!!Remarks
*The invocation of //~CloseConnection// has next effects:
**All the [[recordsets|Recordset]] related to a database linked to the current document are closed.
**The [[database object(s)|Database]] is(are) released.
*It is recommended to have all open embedded forms closed before calling //~CloseConnection//.
*Calling //~CloseConnection// is best done from a //"View is going to be closed"// document event.
*After //~CloseConnection// the [[CurrentDb]] function returns {{{Nothing-}}} (to be tested with the {{{IsNull()}}} Basic function).
*If needed, __for database documents only__ ("*.odb" files) the connection can be re-established with the [[OpenConnection]] method. For [[Standalone Forms]] an //~OpenConnection// request invoked after a //~CloseConnection// invocation will be ignored.
<<tiddler "RunWithoutConnection">>
!!!See also
[[Database]]
[[CurrentDb]]
[[Install]]
{{OpenConnection]]
[[OpenDatabase]]
[[Standalone Forms]]
</pre>
</div>
<div title="Coding Conventions" modifier="Jean-Pierre Ledure" created="201106251413" modified="201405240738" tags="[[Snippets of Code]]" changecount="1">
<pre>This page details the conventions used in the coding of the //~Access2Base// API.
!!Library and Modules
*The acConstants module lists constants that are used in the API. They are defined as //Global//. Their name is identical as in ~MSAccess. Their value is in most cases identical to that of ~MSAccess, however not always. The scope of global constants is limited to one single library. As a consequence their definition may freely be copied and pasted to make them available in user libraries.
*The reserved words are //~Proper-Cased// showing the same appearance as in the IDE of ~MSAccess.
!!Functions and Subroutines
*~OpenOffice/~LibreOffice ignores the Private/Public attribute in Functions or Subs declarations. Nevertheless the attribute must be present. Rules for use are:
| !Attribute | !Sub/Function Naming | !When |
|Public |Starts with a letter |The Sub/Function belongs to the ~Access2Base API. As such it may be called from any other library developed by the user. |
|Public |Starts with an underscore "_" |The Sub/Function must be called only from within the ~Access2Base library. As such it MUST NOT be called from another library as there is no guarantee about the arguments, the logic or even the existence of that piece of code in a later release. |
|Private |The Sub/Function must start with an underscore "_" |The Sub/Function must be called only from the module in which it is located |
*Functions and Subroutines belonging to the API (= "standard" functions/Subs) are defined in their module in alphabetical order.
*Functions and Subroutines not belonging to the API are defined in their module in alphabetical order below the standard ones.
*The return value of a function is always declared explicitly.
*The parameters are always declared explicitly even if they're variants.
*The Function and Sub declarations start at the 1^^st^^ column of the line.
*The End Function/Sub statement is followed by a comment reminding the name of the function or sub.
!!Variable declarations
*The //Option Explicit// statement is mandatory in every module.
*The Global, Dim and Const statements always start in the first column of the line.
*The type (Dim ... As ..., Function ... As ...) is always declared explicitly, even if the type is Variant.
*Variables are //~Proper-Cased//. They are always preceded by a lower-case letter indicating their type. With next exception: variables i, j, k, l, m and n must be declared as integers.
| !First letter | !Type |
| b |Boolean |
| d |Date |
| v |Variant |
| o |Object |
| i |Integer |
| l |Long|
| s |String |
{{indent{Example:{{{ Dim sValue As String}}}
*Parameters are preceded by the letter //p// which itself precedes the single typing letter. Like in:<br />{{{Public Function MyFunction(psValue As String) As Variant}}}
*Object variables are preceded by the letter o followed by their type:
| !First letter | !Type |
| db |Database |
| f |Form or Subform |
| c |Control |
| e |Event |
| p |Property |
{{indent{like in:{{{ Dim ocControl As Object}}}
*Global variables in the ~Access2Base library are ALL preceded by an underscore "_" as NONE of them should be invoked from outside the library.
*Constant values with a local scope are //~Proper-Cased// and preceded by the letters //cst//.
*Constants with a global scope are //~UPPER-CASED//
Example
//{{{
Global Const ACONSTANT = "This is a global constant"
Function MyFunction(pocControl As Object, piValue) As Variant
Dim iValue As Integer
Const cstMyConstant = 3
//}}}
!Goto
The //Goto// statement is forbidden.
It is however highly recommended for __error__ and __exception__ handling.
</pre>
</div>
<div title="Collection" modifier="Jean-Pierre Ledure" created="201106251010" modified="201612181348" tags="Definitions" changecount="15">
<pre>A //Collection// contains a list of other objects.
The individual members of the collection are accessible either via their index or via their name. The name is NOT case-sensitive.
!!!Collections
A //Collection// object is returned by next functions
| !Function |!Description |
|[[AllDialogs]] |{{{AllDialogs()}}} without argument returns the //Collection// of all [[dialogs|Dialog]] present in any of the accessible dialog libraries |
|[[AllForms]] |{{{AllForms()}}} without argument returns the //Collection// of all [[forms|Form]] defined in the current Base or non-Base document |
|[[AllModules]] |{{{AllModules()}}} without argument returns the //Collection// of all [[ùodules|Module]] present in any of the accessible Basic libraries |
|[[CommandBars]] |{{{CommandBars()}}} without argument returns the //Collection// of all toolbars associated with the current ~LibO/AOO window. |
|[[CommandBarControls]] |{{{myCommandBar.CommandBarControls()}}} returns the //Collection// of all the controls of the //commandbar// designated by //~myCommandBar// |
|[[Controls]] |{{{myObject.Controls()}}} returns the //Collection// of all the controls of a //form//, a //dialog//, a [[subform|SubForm]] or a [[gridcontrol|GridControl]] designated by the object //myObject// |
|[[Events]] |{{{Events(event)}}} returns the current [[event|Event]] object |
|[[Fields]] |{{{myObject.Fields()}}} returns the //Collection// of all the [[fields|Field]] of a //table//, a //query// or a //recordset// designated by the object //myObject// |
|[[Forms]] |{{{Forms()}}} without argument returns the //Collection// of all open //forms// |
|[[Properties|Properties (collection)]] |{{{myObject.Properties()}}} returns the //Collection// of all [[properties|Property]] of the object //myObject// |
|[[QueryDefs]] |{{{CurrentDb().QueryDefs()}}} without argument returns the //Collection// of all [[queries|QueryDef]] in the database |
|[[Recordsets]] |{{{CurrentDb().Recordsets()}}} without argument returns the //Collection// of all currently open [[recordsets|Recordset]] |
|[[TableDefs]] |{{{CurrentDb().TableDefs()}}} without argument returns the //Collection// of all [[tables|TableDef]] in the database |
|[[TempVars]] |{{{Application.TempVars()}}} without argument returns the //Collection// of all [[temporary variables|TempVar]] in the current ~LibO/AOO session |
!!!Properties
| !Property |!Description |
|[[Count]] |Number of items in the //Collection//. The first item of the //Collection// has the range //0//; the last one has the range //Count - 1// |
|[[Item]] |Return the collection member identified by its //index// or its //name// |
!!!Remarks
Next pair of expressions are one by one equivalent:
//{{{
collection.Item(iIndex)
collection.Item(sName)
//}}}
and
//{{{
collection(iIndex)
collection(sName)
//}}}
!!!Methods
| !Method | !Collection |!Description |
|[[Add]] |[[TableDefs]]<br />[[TempVars]] |The Add method either<br />- finalizes the creation of a new table initiated with the [[CreateTableDef]] method,<br />- or creates a new //~TempVar// object. |
|[[Delete|Delete (table-query)]] |[[TableDefs]]<br />[[QueryDefs]] |The Delete method erases a table or a query object from the //~TableDefs// or //~QueryDefs// collections. |
|[[Remove]] | [[TempVars]] |The Remove method erases a tempvar object from the //~TempVars// collection. |
|[[RemoveAll]] | [[TempVars]] |The ~RemoveAll method erases all tempvar objects from the //~TempVars// collection. |
!!!Example
<<tiddler "Collection example">></pre>
</div>
<div title="Collection example" modifier="Jean-Pierre Ledure" created="201107030853" modified="201409271530" tags="[[Snippets of Code]]" changecount="6">
<pre>To display the name of all forms
//{{{
Dim i As Integer, oCollection As Object
Set oCollection = AllForms 'AllForms without argument returns a Collection object
For i = 0 To oCollection.Count - 1
Print oCollection.Item(i).Name, 'AllForms collects Form objects
Next i
Print
//}}}</pre>
</div>
<div title="Collections" modifier="Jean-Pierre Ledure" created="201106251410" modified="201107011456" tags="Menu">
<pre></pre>
</div>
<div title="Color example" modifier="Jean-PierreLedure" created="201107221351" modified="201212021537" tags="[[Snippets of Code]]">
<pre>Modify colors depending on value in field (typically in After Record Change form event)
//{{{
Dim ocControl As Object, vValue As Variant
Dim lBlack As Long, lRed As Long, lYellow As Long, lWhite As Long
Set ocControl = getObject("Forms!myForm!myControl")
vValue = getValue(ocControl)
If Not IsNull(vValue) Then
lRed = RGB(255, 0, 0)
lBlack = RGB(0, 0, 0)
lYellow = RGB(255, 255, 0)
lWhite = RGB(255, 255, 255)
With ocControl
If vValue > 100 Then
.BorderColor = lRed
.ForeColor = lRed
.BackColor = lYellow
.BorderStyle = 2
Else
.BorderColor = lBlack
.ForeColor = lBlack
.BackColor = lWhite
.BorderStyle = 0
End If
End With
End If
//}}}</pre>
</div>
<div title="ComboBox" modifier="Jean-Pierre Ledure" created="201108171019" modified="201405300636" tags="[[Special controls]]" changecount="4">
<pre>{{firstletter{
@@color:#930;A@@
}}} //~ComboBox// describes a combo box control. It has specific properties to manage the input list of potential values and to select one of them programmatically.
A ~ComboBox control is returned by the [[Controls]] collection or by the [[getObject]] shortcut.
!!!Specific properties for combo box management
| !Property | !Read only | !Description |
|[[ItemData]] | Y |Returns the data for the specified row in a ~ComboBox or [[ListBox]]. |
|[[ListCount]] | Y |Determines the number of rows in a [[ListBox]] or the list box portion of a ~ComboBox. |
|[[ListIndex]] ||Determines which item is selected in a [[ListBox]] or a ~ComboBox. |
|[[RowSource]] ||Specifies the source of the data in a [[ListBox]] or a ~ComboBox. |
|[[RowSourceType]] ||Specifies the source (tablename, queryname or SQL statement) of the data in a [[ListBox]] or a ~ComboBox. |
|[[Value]] ||Specifies the value currently selected in the ~ComboBox. |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the ~ComboBox has the given property. |
|[[Requery]] ||~|True if data reloaded in the ~ComboBox |
|[[SetFocus]] | none |~|Return True if focus set on Control successfully. |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
!!!Remarks
!!!See also
[[ListBox]]
!!!Example
<<tiddler "ComboBox example">></pre>
</div>
<div title="ComboBox example" modifier="Jean-PierreLedure" created="201108171112" modified="201303301231" tags="[[Snippets of Code]]">
<pre>Display the options of the combo
//{{{
Dim i As Integer, ocCombo As Object
Set ocCombo = getObject("Forms!myForm!myComboBox")
For i = 0 To ocCombo.ListCount - 1
Print i & " - " & ocCombo.ItemData(i),
Next i
Print
//}}}
Modify current selection position and find new value
//{{{
Dim ocCombo As Object
ocCombo.ListIndex = 2
Print ocCombo.Value
//}}}</pre>
</div>
<div title="CommandBar" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201503071346" modified="201507201615" tags="Objects" changecount="9">
<pre>{{firstletter{
@@color:#930;A@@
}}} //~CommandBar// [[object|Object Model]] describes a toolbar, the menubar or the statusbar.
!!!Functions returning a commandbar object
| !Parent object | !Function | !Type | !Argument |!Description |
|[[Application]] |[[CommandBars]] | [[Collection]] | Integer or String |{{{Application.CommandBars("myCommandbar")}}} returns an object corresponding with the {{{myCommandbar}}} custom toolbar. |
!!!Properties
| !Property | !Type | !Read only | !Description or UNO object |
|[[BuiltIn]] || Y |True if the toolbar is a system toolbar. |
|[[Name]] || Y |Specifies the real name of the toolbar |
|[[ObjectType]] || Y |Returns "COMMANDBAR" |
|[[Visible]] |||Shows or hides the coomandbar. |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[Reset]] || Boolean |Reset the tool- or menubar to its initial values. Return {{{True}}} if success.. |
!!!Remarks
Each //~CommandBar// [[object|Object Model]] has a ~CommandBarControls [[collection|Collection]], that contains all controls on the commandbar. You can refer to a specific control on a commandbar by referring either to the [[Controls]] or the [[CommandBarControls]] collections.
!!!Example
<<tiddler "CommandBar example">></pre>
</div>
<div title="CommandBar example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201503081702" tags="[[Snippets of Code]]" changecount="1">
<pre>Reset all built-in toolbars to their initial status
//{{{
Dim i As Integer, oCommandBar As Object
SelectObject(acForm, "myForm")
For i = 0 To Application.CommandBars().Count - 1
Set oCommandBar = Application.CommandBars(i)
If oCommandBar.BuiltIn Then oCommandBar.Reset
Next i
//}}}</pre>
</div>
<div title="CommandBarControl" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201507121304" modified="201507251220" tags="Objects" changecount="14">
<pre>{{firstletter{
@@color:#930;A@@
}}} //~CommandBarControl// object is a member of the [[CommandBarControls collection|CommandBarControls]] related to the [[CommandBar]] object.
!!!Function returning a control object
| !Parent object | !Function | !Type | !Arguments |!Short example |
|[[CommandBar]] | [[CommandBarControls]] | [[Collection]] | None<br />Integer, Long |{{{CommandBars("myToolbar").CommandBarControls("myControl")}}}<br />Returns an object of type {{{CommandBarControl}}} referring to the {{{myControl}}} element in the {{{myToolbar}}} toolbar. |
!!!Properties
| !Property | !Read only |!Description |
|[[BeginGroup]] | Y |Gets {{{True}}} if the specified command bar control appears at the beginning of a group of controls on the command bar. |
|[[BuiltIn]] | Y |Gets {{{True}}} if the specified command bar control is a built-in control of the container [[CommandBar]]. |
|[[Caption]] | Y |Gets the caption text for a command bar control. |
|[[Index]] | Y |Gets an {{{Integer}}} representing the index number for a ~CommandBarControl object in the collection. |
|[[ObjectType]] | Y |Returns "COMMANDBARCONTROL". |
|[[OnAction]] ||Gets or sets the name of a command or a Basic procedure that will run when the user clicks the ~CommandBarControl. |
|[[Parent]] | Y |Gets the Parent object for the ~CommandBarControl object. |
|[[TooltipText]] ||Gets or sets the text displayed in a ~CommandBarControl's ~ScreenTip.|
|[[Type]] | Y |Returns msoControlButton (=1). |
|[[Visible]] ||Specifies the visible/hidden status of the ~CommandBarControl. |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[Execute|Execute (commandbarcontrol)]] | None | Boolean |Runs the procedure or built-in command assigned to the specified ~CommandBarControl control. |
|[[hasProperty]] | property |~|Return True if the Control has the given property. |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
!!!Remarks
!!!Example
<<tiddler "CommandBarControl example">></pre>
</div>
<div title="CommandBarControl example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201507251220" modified="201507251408" tags="[[Snippets of Code]]" changecount="9">
<pre>List all the actions related to the targeted toolbar
Force a new //~OnAction// command and its tooltip in the 4th button of the MYFORMTOOLBAR toolbar
Execute that new action
//{{{
Dim i As Integer, j As Integer, oCommandBar As Object, oCommandBarControls As Object, oCommandBarControl As Object
DoCmd.SelectObject(acForm, "myForm")
For i = 0 To Application.CommandBars().Count - 1
Set oCommandBar = Application.CommandBars(i)
If oCommandBar.Name = "MYFORMTOOLBAR" And oCommandBar.Visible Then
Set oCommandBarControls = oCommandBar.CommandBarControls()
For j = 0 To oCommandBarControls.Count - 1
Set oCommandBarControl = oCommandBarControls.Item(j)
With oCommandBarControl
DebugPrint oCommandBar.Name, .Index, .OnAction
If .Index = 4 Then
.OnAction = "FullScreen"
.TooltipText = "Toggle full screen mode"
.Execute()
End If
End With
Next j
End If
Next i
//}}}</pre>
</div>
<div title="CommandBarControls" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201503141307" modified="201507211601" tags="Collections" changecount="7">
<pre>The //~CommandBarControls// collection describes instances of [[CommandBarControl]] objects present in a [[CommandBar]].
!!!Syntax
//commandbar//{{{.CommandBarControls()}}}
//commandbar//{{{.CommandBarControls(}}}//index//{{{)}}}
//commandbar//{{{.Controls()}}}
//commandbar//{{{.Controls(}}}//index//{{{)}}}
| !Argument #1 | !Type |!Returned value |
|| absent |A [[Collection]] object |
| index | integer<br>long |A [[CommandBarControl]] object corresponding to the index-th item in the {{{CommandBarControls()}}} collection. The 1st control is {{{CommandBarControls(0)}}}, the 2nd is {{{CommandBarControls(1)}}} and so on ... The last one has as index {{{CommandBarControls.Count - 1}}}.|
!!!Remarks
*The //~CommandBarControls// collection can not be browsed by name.
*An error message will be raised if the //~CommandBar// is the status bar (name = "statusbar") or if the //~CommandBar// is hidden.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size |
|Action not applicable in this context |
!!!See also ...
[[CommandBar]]
[[CommandBarControl]]
[[SelectObject]]
!!!Examples</pre>
</div>
<div title="CommandBars" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201502281443" modified="201507201612" tags="Collections" changecount="15">
<pre>The //~CommandBars// collection describes instances of all __toolbars__ or menu bars present in the currently selected document, whenever visible or hidden. The document might be any ~LibreOffice/~OpenOffice document, a Base form or report, etc. It is in fact the ~LibO/AOO window that is active at the moment the //~CommandBars()// method is invoked. The concerned commandbars might be system toolbars, the menu bar, the status bar or any user-defined toolbar.
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]CommandBars()}}} or {{{CommandBars()}}}
{{{[Application.]CommandBars(index)}}}
{{{[Application.]CommandBar(toolbarname)}}}
| !Argument #1 | !Type |!Returned value |
|| absent |A [[Collection]] object |
| index | integer<br>long |A [[CommandBar]] object corresponding to the index-th item in the ~CommandBars() collection. The 1st commandbar is ~CommandBars(0), the 2nd is ~CommandBars(1) and so on ... The last one is ~CommandBars.Count - 1.|
| toolbarname | string |A [[CommandBar]] object having the argument as name. The argument is NOT case-sensitive.|
!!!Remarks
*The //toolbarname// argument is not case sensitive.
*The current list of available toolbars and menu items is highly context-dependent. The context is very often determined by the prior execution of the [[SelectObject]] action on the targeted window or document.
*The purpose of the //~CommandBars// collection is first of all to allow making individual toolbars visible or hidden programmatically. Its purpose is NOT to modify toolbars or defining new ones. Toolbars are __static by design__. Use the {{{Tools + Customize}}} menu commands to modify them. Additionally, some properties of [[CommandBarControls|CommandBarControl]] are updatable.
*Most items returned by the //~CommandBars// collection are __toolbars__. Two items however are specific: their names are "menubar" and "statusbar". Their meaning is self-explanatory.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size |
|~CommandBar "..." not found |
!!!See also ...
[[CommandBar]]
[[CommandBarControl]]
[[SelectObject]]
!!!Examples
<<tiddler "CommandBars example">>
</pre>
</div>
<div title="CommandBars example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201502281521" modified="201503071343" tags="[[Snippets of Code]]" changecount="4">
<pre>List all builtin or custom toolbars, stored in ~LibO/AOO software or in document itself
//{{{
Dim i As Integer, oCommandBar As Object
SelectObject(acForm, "myForm")
For i = 0 To Application.CommandBars().Count - 1
Set oCommandBar = Application.CommandBars(i)
DebugPrint Right("0" & (i + 1), 2), oCommandBar.Name
Next i
//}}}</pre>
</div>
<div title="Connect" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201611111346" modified="201611111358" tags="Properties" changecount="5">
<pre>The //Version// property the connection string between the //Base document// and the effective database system.
That string appears in the status bar of the //database window// that appears when the //Base document// gets opened.
!!!Aplies to ...
| !Object | !Description |
|[[Database]] |A database object returned by the [[CurrentDb]] or [[OpenDatabase]] methods. |
!!!Syntax
{{{database.Connect}}}
!!!Returned values
{{{String}}}
!!!Remarks
The //Connect// property is read-only.
!!!Error messages
!!!See also
[[CurrentUser]]
[[ProductCode]]
[[Version]]
!!!Example
<<tiddler "Connect example">></pre>
</div>
<div title="Connect example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201611111355" tags="[[Snippets of Code]]" changecount="1">
<pre>//{{{
MsgBox Application.CurrentDb.Connect
//}}}</pre>
</div>
<div title="Contact" modifier="Jean-PierreLedure" created="201210051452" modified="201305090843" tags="NoTag">
<pre>*To contribute to this piece of software ...
*To search for help about its use ...
*For any question you could have ...
If your request is of public interest, post it on the [[OpenOffice Community forum|http://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=61447]] preferably in the proposed thread, or otherwise in the //Base// or //Macros and API// rubrics.
As a third option, send a private message to the user "JPL" on the same forum. Messages in english, french or dutch are welcome.
>Proposals for contributions to translations of ~Access2Base into other languages should be addressed via a private message.<br />(Translating into a new language takes +/- 2 hours ...)</pre>
</div>
<div title="Control" modifier="YourName" created="201107191447" modified="201802211017" tags="Objects" changecount="10">
<pre>{{firstletter{
@@color:#930;A@@
}}} //Control// [[object|Object Model]] describes one of the Controls of an open [[form|Form]], a [[subform|SubForm]], a [[dialog|Dialog]], a [[gridcontrol|GridControl]] or an [[options group|OptionGroup]]. Each control will be retrieved as a member of the [[Controls]] [[collection|Collection]] of its corresponding parent.
NB: Subforms and gridcontrols are themselves controls and retrieved like other controls as a member of a collection.
!!!Functions returning a control object
| !Parent object | !Function | !Type | !Arguments |!Short example |
|[[Form]]<br />[[SubForm]]<br />[[Control]]<br />[[OptionGroup]]<br />[[Dialog]] |[[Controls]] | [[Collection]] | None<br />Integer, Long<br />String |{{{Forms("myForm").Controls("myControl")}}}<br />Returns an object of type {{{Control}}} referring to the {{{myControl}}} control in the {{{myForm}}} form. {{{myForm}}} must be open. |
||[[getObject]] || String |{{{getObject("Forms!myForm!myControl")}}} returns an object referring to the {{{myControl}}} control in the {{{myForm}}} form. {{{myForm}}} must be open. |
!!!Control types
The distinct control types can be recognized thru the use either of the [[SubType]] (string) or the [[ControlType]] (integer) properties. The ~ControlType property is proposed in //~Access2Base// for compatibility with ~MSAccess.
See the correspondence table below.
<<tiddler "ControlTypesList">>
!!!Properties
| !Property | !Type | !Read only |!Description or UNO object |
|[[Name]] || Y |Specifies the exact name of the control |
|BackColor (*) |||Specifies the color of the interior of a control. |
|BorderColor (*) |||Specifies the color of a control's border. |
|BorderStyle (*) |||Specifies how a control's border appears. |
|[[Cancel]] (*) |||Specifies whether a command button is also the Cancel button on a form. |
|[[Caption]] |||Specifies the label associated with a control.<br />If the control is located within a ~GridControl, the Caption specifies the column heading. |
|[[ControlSource]] || Y |Specifies what data appears in a control. |
|[[ControlTipText]] |||Specifies the text that appears in a ~ScreenTip when you hold the mouse pointer over a control. |
|[[ControlType]] || Y |Specifies the type of a control. |
|[[Default]] (*) |||specifies whether a ~CommandButton is the default button on a form. |
|[[DefaultValue]] |||Specifies a value that is automatically entered in a field when a new record is created. |
|[[Enabled]] |||Specifies if the cursor can access the control. |
|[[FontBold]]<br />[[FontItalic]]<br />[[FontName]]<br />[[FontSize]]<br />[[FontUnderline]]<br />[[FontWeight]]<br />[[ForeColor]]<br />(*) |||Specify the font characteristics. |
|[[Form|Form (subform)]] (*) || Y |Returns the [[SubForm]] object corresponding with the ~SubForm control. |
|[[Format]] |||Returns the way numbers, dates, times, and text are displayed |
|[[ItemData]] || Y |Returns the data for the specified row in a [[ComboBox]] or a [[ListBox]]. |
|[[ListCount]] || Y |Determines the number of rows in a [[ListBox]] or the list box portion of a [[ComboBox]]. |
|[[ListIndex]] |||Determines which item is selected in a [[ListBox]] or a [[ComboBox]]. |
|[[Locked]] |||Specifies whether you can edit data in a control. |
|[[MultiSelect]] (*) |||Specifies whether a user can make multiple selections in a [[ListBox]] on a form. |
|[[ObjectType]] || Y |Returns "CONTROL" |
|[[On ... events|On (control event)]] |||Specifies which function is triggered when a control event occurs. |
|[[OptionValue]] (*) || Y |Specifies the value that is stored in the database when a [[RadioButton]] is selected and the record saved. |
|[[Page]] |||Defines the page on which the control is visible. |
|[[Parent]] || Y |Returns the parent object of the control. |
|[[Picture]] |||Specifies the image to be displayed in an ~ImageControl or ~ImageButton control. |
|[[Required]] |||Specifies whether a control must contain a value when the record is edited. |
|[[RowSource]] |||Specifies the source of the data in a [[ListBox]] or a [[ComboBox]]. |
|[[RowSourceType]] |||Specifies the source (tablename, queryname or SQL statement) of the data in a [[ListBox]] or a [[ComboBox]]. |
|[[Selected]] |||Specifies if an item in the data proposed by a [[ListBox]] is currently selected. |
|[[SubType]] || Y |Specifies the type of a control. |
|[[TabIndex]] (*) |||Specifies a control's place in the tab order on a form. |
|[[TabStop]] (*) |||Specifies whether you can use the TAB key to move the focus to a control. |
|[[Tag]] |||Stores extra information about a control. |
|[[Text]] || Y |Sets or returns the text contained in a text box (or similar). |
|[[TextAlign]] |||Specifies the alignment of the text in a control. |
|[[TripleState]] |||Specifies how a //~CheckBox// wll display Null values. |
|[[Value]] |||Specifies the value contained in a control. |
|[[Visible]] (*) |||Specifies if a control is visible or hidden. |
|~ControlModel | UNO | Y |com.sun.star.comp.forms.~XXXModel |
|~ControlView | UNO | Y |com.sun.star.comp.forms.~XXXControl |
|~BoundField | UNO | Y |com.sun.star.sdb.~ODataColumn |
|~LabelControl | UNO | Y |com.sun.star.form.component.~FixedText<br />com.sun.star.form.component.~GroupBox |
(*) Not applicable to controls belonging to a [[GridControl]].
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the Control has the given property. |
|[[SetFocus]] | none |~|Return True if focus set on Control successfully. |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
!!!Remarks
!!!Example
<<tiddler "Control example">></pre>
</div>
<div title="Control example" modifier="Jean-PierreLedure" created="201107221017" modified="201212021650" tags="[[Snippets of Code]]">
<pre>List all the controls of a form having the Visible property
//{{{
Dim ofForm As Object, ocControl As Object, i As Integer, iCount As Integer
Set ofForm = Forms("myForm")
iCount = ofForm.Controls.Count
For i = 0 To iCount - 1
Set ocControl = ofForm.Controls(i)
If ocControl.hasProperty("Visible") Then Print ocControl.Name & ":" & ocControl.SubType
Next i
Print
//}}}</pre>
</div>
<div title="ControlSource" modifier="Jean-Pierre Ledure" created="201107221516" modified="201603271529" tags="Properties" changecount="2">
<pre>The //~ControlSource// property specifies the database field bound to the [[Control]].
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl |!Description |
|[[Control]] | ~CheckBox<br />~ComboBox<br />~CurrencyField<br />~DateField<br />~FormattedField<br />~ImageControl<br />[[ListBox]]<br />~NumericField<br />~PatternField<br />[[RadioButton]]<br />~TextField<br />~TimeField | All |A control on an open form or within a [[GridControl]] of one of the allowed types |
!!!Syntax
//control//{{{.ControlSource}}}
!!!Returned value
{{{String}}}
!!!Remarks
The //~ControlSource// property is read-only.
It returns a zero-length string ({{{""}}}) if the control is not bound to any database field.
!!!Error messages
|Property '~ControlSource' not applicable in this context |
!!!See also
[[RecordSource]]
!!!Example
<<tiddler "ControlSource example">></pre>
</div>
<div title="ControlSource example" modifier="Jean-PierreLedure" created="201107221533" modified="201212021737" tags="[[Snippets of Code]]">
<pre>Display the bound database field
//{{{
Dim ocControl As Object
Set ocControl = getObject("Forms!myForm!myGridControl!myTextField")
MsgBox ocControl.ControlSource
//}}}</pre>
</div>
<div title="ControlTipText" modifier="Jean-Pierre Ledure" created="201107221256" modified="201507251400" tags="Properties" changecount="1">
<pre>The //~ControlTipText// property specifies the text that appears in a ~ScreenTip when you hold the mouse pointer over a control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~HiddenControl<br />[[SubForm]]-- | All | All |A control on an open form, a dialog or within a [[GridControl]] of one of the listed types |
!!!Syntax
//control//{{{.ControlTipText}}}
//control//{{{.ControlTipText}}} = //value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
!!!Error messages
|Property '~ControlTipText' not applicable in this context |
|Value '...' is invalid for property '~ControlTipText' |
!!!See also
!!!Example
<<tiddler "ControlTipText example">></pre>
</div>
<div title="ControlTipText example" modifier="Jean-PierreLedure" created="201107311101" modified="201212021741" tags="[[Snippets of Code]]">
<pre>Change the tip text of a control
//{{{
Dim ocControl As Object
Set ocControl = getObject("Forms!myForm!myControl")
ocControl.ControlTipText = "This is a new tip !"
//}}}</pre>
</div>
<div title="ControlType" modifier="Jean-Pierre Ledure" created="201107311639" modified="201707081110" tags="Properties" changecount="1">
<pre>The types of control can be recognized thru the use either of the [[SubType]] or the //~ControlType// properties. The ~ControlType property is there for compatibility with ~MSAccess but has the disadvantage to not discriminate control types 100%, e.g. a ~TextField cannot be distinguished from a ~FormattedField control type.
See the correspondence table below.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] | All | All | All |A control on an open form or dialog |
!!!Syntax
//control//{{{.ControlType}}}
!!!Returned values
{{{Integer}}}
Table of values:
<<tiddler "ControlTypesList">>
Instead of using the numeric values for ~ControlType, one may copy next code and paste it in his/her own code. This allows to use symbolic names, more or less compatible with those existing in ~MSAccess. "More or less" because many control types do not match: e.g. a "spin button" is unknown in ~MSAccess.
//{{{
REM Control Types
REM -----------------------------------------------------------------
Const acCheckBox = 5
Const acComboBox = 7
Const acCommandButton = 2 : Const acToggleButton = 122
Const acCurrencyField = 18
Const acDateField = 15
Const acFileControl = 12
Const acFixedLine = 24
Const acFixedText = 10 : Const acLabel = 10
Const acFormattedField = 1
Const acGridControl = 11
Const acGroupBox = 8 : Const acOptionGroup = 8
Const acHiddenControl = 13
Const acImageButton = 4
Const acImageControl = 14 : Const acImage = 14
Const acListBox = 6
Const acNavigationBar = 22
Const acNumericField = 17
Const acPatternField = 19
Const acProgressBar = 23
Const acRadioButton = 3 : Const acOptionButton = 3
Const acScrollBar = 20
Const acSpinButton = 21
Const acSubform = 112
Const acTextField = 9 : Const acTextBox = 9
Const acTimeField = 16
//}}}
!!!Remarks
The ~ControlType property is read-only.
!!!Error messages
!!!See also
[[SubType]]
!!!Example
<<tiddler "ControlType example">></pre>
</div>
<div title="ControlType example" modifier="Jean-PierreLedure" created="201107311701" modified="201212021747" tags="[[Snippets of Code]]">
<pre>List name, controltype and subtype of all controls on an open form
//{{{
Dim ofForm As Object, ocControl As Object, i As Integer, iCount As Integer
Set ofForm = Forms("myForm")
iCount = ofForm.Controls.Count
For i = 0 To iCount - 1
Set ocControl = ofForm.Controls(i)
Print ocControl.Name & "/" & ocControl.SubType & "/" & ocControl.ControlType
Next i
Print
//}}}</pre>
</div>
<div title="ControlTypesList" modifier="Jean-PierreLedure" created="201107311638" modified="201303231228" tags="NoTag">
<pre>|!~SubType | !~ControlType |!Control type available in ... |>|>|>|
|~|~| [[Forms|Form]] / [[SubForms|SubForm]] | [[GridControls|GridControl]] | [[Dialogs|Dialog]] | [[Option Groups|OptionGroup]] |
|CHECKBOX | 5 | X | X | X | |
|[[COMBOBOX|ComboBox]] | 7 | X | X | X | |
|COMMANDBUTTON | 2 | X | | X | |
|CURRENCYFIELD | 18 | X | X | X | |
|DATEFIELD | 15 | X | X | X | |
|FILECONTROL | 12 | X | | X | |
|FIXEDLINE | 24 | | | X | |
|FIXEDTEXT | 10 | X | | X | |
|FORMATTEDFIELD | 1 | X | X | X | |
|[[GRIDCONTROL|GridControl]] | 11 | X | | | |
|GROUPBOX | 8 | X | | X | |
|HIDDENCONTROL | 13 | X | | | |
|IMAGEBUTTON | 4 | X | | | |
|IMAGECONTROL | 14 | X | | X | |
|[[LISTBOX|ListBox]] | 6 | X | X | X | |
|NAVIGATIONBAR | 22 | X | | | |
|NUMERICFIELD | 17 | X | X | X | |
|PATTERNFIELD | 19 | X | X | X | |
|PROGRESSBAR | 23 | | | X | |
|[[RADIOBUTTON|RadioButton]] | 3 | X | | X | X |
|SCROLLBAR | 20 | X | | X | |
|SPINBUTTON | 21 | X | | | |
|[[SUBFORMCONTROL|SubForm]] | 112 | X | | | |
|TEXTFIELD | 9 | X | X | X | |
|TIMEFIELD | 16 | X | X | X | |</pre>
</div>
<div title="Controls" modifier="Jean-Pierre Ledure" created="201107011641" modified="201503071450" tags="Collections" changecount="3">
<pre>The //Controls// collection describes instances of all __[[controls|Control]]__ present either
*in an open [[form|Form]]
*in a [[subform|SubForm]] of an open form of or another subform
*in a started [[dialog|Dialog]]
*in a [[GridControl]] part of an open form or one of its subforms
*or in an [[OptionGroup]] (i.e. a set of [[radio buttons|RadioButton]])
The //Controls// collection may also refer (as a synonym) to the collection of [[CommandBarControl]] objects of a [[CommandBar]]. To know more about this option, read the page about the [[CommandBarControls]] collection.
!!!Syntax
//form//{{{.Controls}}}
//form//{{{.Controls(}}}//index//{{{)}}}
//form//{{{.Controls(}}}//controlname//{{{)}}}
//subform//{{{.Controls}}}
//subform//{{{.Controls(}}}//index//{{{)}}}
//subform//{{{.Controls(}}}//controlname//{{{)}}}
//dialog//{{{.Controls}}}
//dialog//{{{.Controls(}}}//index//{{{)}}}
//dialog//{{{.Controls(}}}//controlname//{{{)}}}
//gridcontrol//{{{.Controls}}}
//gridcontrol//{{{.Controls(}}}//index//{{{)}}}
//gridcontrol//{{{.Controls(}}}//controlname//{{{)}}}
//optiongroup//{{{.Controls}}}
//optiongroup//{{{.Controls(}}}//index//{{{)}}}
| !Object | !Type | !Argument | !Type |!Returned value |
|form | [[Form object|Form]] || absent |A [[Collection]] of the controls of the form |
|~|~| index | integer<br />long |A [[control object|Control]] |
|~|~| controlname | string |~|
|subform | [[Subform object|SubForm]] || absent |A [[Collection]] of the controls of the subform |
|~|~| index | integer<br />long |A [[control object|Control]] |
|~|~| controlname | string |~|
|dialog | [[Dialog object|Dialog]] || absent |A [[Collection]] of the controls of the dialog |
|~|~| index | integer<br />long |A [[control object|Control]] |
|~|~| controlname | string |~|
|gridcontrol | [[Gridcontrol object|GridControl]] || absent |A [[Collection]] of the controls of the gridcontrol |
|~|~| index | integer<br />long |A [[control object|Control]] |
|~|~| controlname | string |~|
|optiongroup | [[Optiongroup object|OptionGroup]] || absent |A [[Collection]] of the controls of the optiongroup |
|~|~| index | integer<br />long |A [[control object|Control]] of [[SubType]] = [[RadioButton]]. |
!!!Remarks
*Control [[collections|Collection]] are numbered from 0 to {{{Controls(...).Count - 1}}}
*The //controlname// argument is not case sensitive.
*A form must be opened, either manually by the user or [[programmatically|OpenForm]] to give access to its controls.
*A dialog must be [[started|Start]] to give access to its controls.
*The //index// of an [[OptionGroup]] is determined by its position (~X-Y coordinates) on the screen: 1) top to bottom 2) left to right.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection Controls() |
|Form '...' is currently not open|
|Dialog '...' not active|
|Control '...' not found in parent (form, grid or dialog) '...' |
!!!Examples
<<tiddler "Controls examples">>
</pre>
</div>
<div title="Controls examples" modifier="Jean-Pierre Ledure" created="201107021311" modified="201405210824" tags="[[Snippets of Code]]" changecount="1">
<pre>To identify the last control of an open form
//{{{
Dim ofForm As Object, iCount As Integer
Set ofForm = Forms("myForm")
iCount = ofForm.Controls.Count
MsgBox "The form " & ofForm.Name & " has " & iCount & " controls." _
& "The last one is " & ofForm.Controls(iCount - 1).Name
//}}}
To know the controls present in a gridcontrol (datagrid)
//{{{
Dim ocGrid As Object, i As Integer, iCountGrid As Integer
Set ocGrid = Forms("myForm").Controls("myGridControl")
iCountGrid = ocGrid.Controls.Count
For i = 0 To iCountGrid - 1
Print ocGrid.Controls(i).Name
Next i
Print
//}}}
To know the number of controls in a dialog
//{{{
Dim oDialog As Object, iCount As Integer
Set oDialog = Dialogs("myDialog")
oDialog.Start
iCount = oDialog.Controls.Count
oDialog.Terminate
MsgBox "Number of controls in " & oDialog.Name & " = " & iCount
//}}}</pre>
</div>
<div title="CopyObject" modifier="YourName" created="201312281344" modified="201807231407" tags="Actions" changecount="21">
<pre>The //~CopyObject// action copies an existing query or table within the current database or from an external database to the current database.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]CopyObject(}}}//{{{SourceDatabase, NewName, SourceObjectType, SourceObjectName}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description | !Returned Value |
|{{{SourceDatabase}}} | Yes | String<br />[[Database]] |The null-string "" (default value) designates the current database. | True if sucess |
|{{{NewName}}} | No | String |The name of the target copy. |~|
|{{{SourceObjectType}}} | No | acTable<br />acQuery |The type of object to copy. |~|
|{{{SourceObjectName}}} | No | String |The name of the object to copy. This argument is NOT case-sensitive. |~|
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acQuery = 1
Const acTable = 0
//}}}
!!!Remarks
*In ~MSAccess the first argument is the //target// database, not the //source// database.<br />The inversion in ~Access2Base is an intentional design choice. Indeed the //~CopyObject// action __imports__ an object in ~Access2Base, while it __exports__ it in ~MSAccess.
*If an object (table or query) of the same type and with the same name exists already, it is __dropped without warning__.
*To designate the source database, use either a string containing the full path (URL or ~OS-specific) of the database or a database object returned by the [[OpenDatabase]] method. Use the latter when the external database requires a user/password security check.<br />If a database object is given, the programmer must care for the [[closure of the database|Close (method)]].
*A new copy of an //acQuery// object contains only its description and its SQL statement.<br />If the databases are not based on the same relational database system, it is very likely that the respective SQL dialects are not compatible. This is not checked by the //~CopyObject// action.
*A new copy of an //acTable// object contains
**the table columns with their types
**the table data
**the same primary key as the source table. If the source primary key is an //~AutoIncrement// field, the value of the field is copied into an //long// field of the same name without the //~AutoIncrement// behaviour.
*Other table elements are NOT copied: e.g. indexes. To build them use the [[RunSQL]] action with the appropriate {{{CREATE INDEX ...}}} statement.
*The copy of the table structure is done
**When both databases are based on an identical database management system simply by copying field types and precisions.
**Otherwise by searching among the available datatypes within the target database the datatypes fitting best the input datatypes and precisions. This can lead to
***either the non-existence of a compatible datatype (error message),
***or a loss of data when the target field is too short (warning message).
*The copy of the table data is done
**When the source database is the current database, via one single {{{INSERT}}} SQL statement.
**Otherwise by copying the data row by row and field by field. This is obviously __much slower__ than using an {{{INSERT}}} statement. A progress meter will be displayed when the active window is a form or the Basic IDE.
*The //~CopyObject// action is forbidden from a [[standalone form|Standalone Forms]].
!!!Error messages
|Arguments are missing or are not initialized |
|Argument nr. ... [Value = '...'] is invalid |
|Object '...' not found |
|Method '~CopyObject' not applicable in this context |
|Field '...' could not be converted due to incompatibility of field types between database systems |
|Field '...' could not be loaded in record #N due to capacity shortage |
!!!See also
[[OpenDatabase]]
[[RunSQL]]
[[SelectObject]]
!!!Example
<<tiddler "CopyObject example">></pre>
</div>
<div title="CopyObject example" modifier="Jean-Pierre Ledure" created="201312281403" modified="201408011454" tags="[[Snippets of Code]]" changecount="1">
<pre>Copy a table (design and data)
//{{{
DoCmd.CopyObject(, "COMPANIES_BACKUP", acTable, "COMPANIES")
//}}}
</pre>
</div>
<div title="Count" modifier="Jean-Pierre Ledure" created="201107091012" modified="201405291555" tags="Properties" changecount="6">
<pre>The //Count// property identifies the number of items present in a [[collection|Collection]] or in an [[OptionGroup]] control.
!!!Applies to ...
| !Collection |!Description |
|[[AllDialogs]] |All dialogs present in any of the accessible dialog libraries |
|[[AllForms]] |All forms, open or closed, in the current database document (".odb" file) |
|[[Controls]] |All the controls of a //form//, a //dialog//, a //subform// or a //gridcontrol// |
|[[Fields]] |All the fields of a //table//, a //query// or a //recordset// designated by the object //myObject// |
|[[Forms]] |All open forms |
|[[Properties|Properties (collection)]] |All properties of an [[object|Object Model]] |
|[[QueryDefs]] |All queries in the database |
|[[Recordsets]] |All recordsets currently open |
|[[TableDefs]] |All tables in the database |
| !Control |!Description |
|[[OptionGroup]] |Groups either<br />- the [[Radio buttons|RadioButton]] with the same name within a (sub)form,<br />- the //Radio buttons// having contiguous ~TabIndexes (= "Order" in the control's property sheet) in a dialog. |
!!!Syntax
//collection//{{{.Count}}}
//optiongroup//{{{.Count}}}
!!!Returned values
{{{Integer}}} >= 0
!!!Remarks
*The //Count// property is read-only.
*The items of a [[collection|Collection]] or of an [[OptionGroup]] control are always numbered from 0 to {{{Count - 1}}}
!!!Error messages
!!!See also
[[Item]]
!!!Example
<<tiddler "Count example">></pre>
</div>
<div title="Count example" modifier="Jean-PierreLedure" created="201107091102" modified="201212021752" tags="[[Snippets of Code]]">
<pre>The following example uses the Count property to control a loop that prints information about all open forms and their controls.
//{{{
Dim ofForm As Object, i As Integer
Dim j As Integer
Dim iControls As Integer, iForms As Integer
iForms = Forms.Count ' Number of open forms.
If iForms > 0 Then
For i = 0 To iForms - 1
Set ofForm = Forms(i)
_Print ofForm.Name
iControls = ofForm.Controls().Count
If iControls > 0 Then
For j = 0 To iControls - 1
Print ofForm.Controls(j).Name
Next j
End If
Next i
End If
Print
//}}}</pre>
</div>
<div title="CountOfDeclarationLines" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181400" modified="201612181404" tags="Properties" changecount="3">
<pre>The //~CountOfDeclarationLines// property indicates the number of lines of code in the Declarations section in a standard or class [[module|Module]].
!!!Applies to ...
| !Object |!Description |
|[[Module]] |The representation of a Basic script. |
!!!Syntax
//module//{{{.CountOfDeclarationLines}}}
!!!Returned values
{{{Long}}}
!!!Remarks
Lines in a module are numbered beginning with 1.
The value of the //~CountOfDeclarationLines// property is equal to the line number of the last line of the Declarations section. You can use this property to determine where the Declarations section ends and the first procedure of the module begins.
!!!Error messages
|Property '~CountOfDeclarationLines' not applicable in this context |
!!!See also
[[CountOfLines]]
[[Lines]]
!!!Example
<<tiddler "Module example">></pre>
</div>
<div title="CountOfLines" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181351" modified="201612181357" tags="Properties" changecount="3">
<pre>The //~CountOfLines// property indicates the number of lines of code in a class or standard [[module|Module]].
!!!Applies to ...
| !Object |!Description |
|[[Module]] |The representation of a Basic script. |
!!!Syntax
//module//{{{.CountOfLines}}}
!!!Returned values
{{{Long}}}
!!!Remarks
Lines in a module are numbered beginning with 1.
The line number of the last line in a module is the value of the //~CountOfLines// property.
!!!Error messages
|Property '~CountOfLines' not applicable in this context |
!!!See also
[[CountOfDeclarationLines]]
[[Lines]]
!!!Example
<<tiddler "Module example">></pre>
</div>
<div title="CountRecordsRecordset" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201405311259" modified="201406161357" tags="HowTo" changecount="6">
<pre>(Q) How can I know the number of records in a //Recordset// object ? For example, I may want to create a form that shows how many records are in each of the tables in a database. Or I may want to change the appearance of a form or report based on the number of records it includes.
(R) The [[RecordCount]] property contains the number of records in a [[Recordset]]. A //Recordset object// with no records has a //~RecordCount// property value of 0.
However:
>The value of the //~RecordCount// property equals the number of records that have actually been accessed. To visit all the records, use the [[MoveLast|Move (recordset)]] method immediately after opening the //Recordset//, then use [[MoveFirst|Move (recordset)]] to return to the first record. This is not done automatically because it may be slow, especially for large result sets.
The following code example creates a //Recordset// object, and then determines the number of records in the //Recordset//.
//{{{
Function FindRecordCount(sSQL As String) As Long
Dim odbNorthwind As Object
Dim orsRecords As Object
On Local Error GoTo ErrorHandler
Set odbNorthwind = Application.CurrentDb
Set orsRecords = odbNorthwind.OpenRecordset(sSQL)
With orsRecords
If .EOF Then
FindRecordCount = 0
Else
.MoveLast
FindRecordCount = .RecordCount
End If
.mClose
End With
Set orsRecords = Nothing
Set odbNorthwind = Nothing
Exit Function
ErrorHandler:
TraceError("ERROR", Err, "FindRecordCount", Erl)
End Function
//}}}
As your application deletes records in a //Recordset//, the value of the //~RecordCount// property decreases. However, in a multiuser environment, records deleted by other users are not reflected in the value of the //~RecordCount// property. Using the //~MoveFirst// method on a //Recordset//, followed by the //~MoveLast// method, resets the //~RecordCount// property to the current total number of records in the //Recordset//.
!!!See also
[[BOF, EOF]]
[[MoveFirst, MoveLast, MoveNext, MovePrevious|Move (recordset)]]
[[OpenRecordset]]
[[TraceError]]
!!!Refer to ...
| !Basic module | !Sub |!Comments |
|~HowTo |~FindRecordCount ||</pre>
</div>
<div title="CreateField" modifier="Jean-Pierre Ledure" created="201401181049" modified="201405240716" tags="Methods" changecount="3">
<pre>Appends a new [[Field object|Field]] to a [[table|TableDef]].
This method offers the capacity to create from the Basic code a new table field independently from the underlying RDBMS. Thus without using SQL. However only a limited set of options are available for field descriptions.
!!!Applies to ...
| !Object | !Description |
|[[TableDef]] |The representation of a table in the currently connected database. |
!!!Syntax
Set //field// = //tabledef//.{{{CreateField(}}}//name, type, size, attributes//{{{)}}}
!!!Arguments - Returned value
| !Argument | !Type | !Optional | !Description | !Returned value |
|name | String ||The name of the new field | A [[field|Field]] object |
|type | dbInteger<br />dbLong<br />dbBigInt<br />dbFloat<br />vbSingle<br />dbDouble<br />dbNumeric<br />dbDecimal<br />dbText<br />dbChar<br />dbMemo<br />dbDate<br />dbTime<br />dbTimeStamp<br />dbBinary<br />dbVarBinary<br />dbLongBinary<br />dbBoolean | Y |The [[database type ("DbType")|DataType]] of the new field |~|
|size | numeric | Y |The length of the field. It is ignored when not relevant.<br />If //size// has a non-integer value, the first decimal digit at the right of the decimal point determines the number of decimal digits. |~|
|attributes | dbAutoIncrField | Y |Indicates if present that the field is a primary key and is incremented by the RDBMS at each new record insertion. |~|
!!!List of available field types
<<tiddler "FieldTypesList">>
!!!Remarks
*The //dbAutoIncrField// attribute MUST NOT be set when the //~CreateField// method is applied on an existing table. It is valid only between the [[CreateTableDef]] and [[Add]] methods.
*When the //dbAutoIncrField// attribute is present (for a new table only ...) the field is created and becomes the primary key of the table. The __auto-increment__ attribute of the newly created primary key will be applied only if the RDBMS and the currently used driver allow it. As an example, for the embedded HSQLDB database, the attribute will be applied, for a [["splitted" HSQLDB database|http://www.oooforum.org/forum/viewtopic.phtml?p=396523#396523]], it might not be applied.
*When the //dbAutoIncrField// attribute is not present the newly created field is "nullable", i.e. when not initialized it gets the {{{Null}}} value as default.
*If additional attributes are needed to specify the new field more accurately, use an SQL statement given as argument to the [[RunSQL action|RunSQL]].
*The //~CreateField// method must not be invoked from a [[standalone form|Standalone Forms]] defined in a non-Base (Writer, Calc, ...) document.
*Instead of using the numeric values for ~DbType, one may copy next code and paste it in his/her own code. This allows to use symbolic names, close to or identical with the field types existing in ~MSAccess.
//{{{
REM Types
REM -----------------------------------------------------------------
Const dbBigInt = 16
Const dbBinary = 9
Const dbBoolean = 1
Const dbByte = 2
Const dbChar = 18
Const dbCurrency = 5
Const dbDate = 8
Const dbDecimal = 20
Const dbDouble = 7
Const dbFloat = 21
Const dbGUID = 15
Const dbInteger = 3
Const dbLong = 4
Const dbLongBinary = 11 ' (OLE Object)
Const dbMemo= 12
Const dbNumeric = 19
Const dbSingle = 6
Const dbText = 10
Const dbTime = 22
Const dbTimeStamp = 23
Const dbVarBinary = 17
Const dbUndefined = -1
REM Attributes
REM -----------------------------------------------------------------
Const dbAutoIncrField = 16
//}}}
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Field '...' could not be created |
|Method '~TableDef.~CreateField' not applicable in this context |
!!!See also
[[Add]]
[[CreateQueryDef]]
[[CreateTableDef]]
[[TableDefs]]
[[TableDef]]
[[QueryDefs]]
[[QueryDef]]
!!!Example
<<tiddler "CreateTableDef example">></pre>
</div>
<div title="CreateQueryDef" modifier="Jean-Pierre Ledure" created="201308110731" modified="201405240718" tags="Methods" changecount="2">
<pre>Creates a new [[QueryDef object|QueryDef]] in the current [[database|Database]].
!!!Applies to ...
| !Object | !Description |
|[[Database]] |The representation of the currently connected database. |
!!!Syntax
Set //querydef// = //database//.{{{CreateQueryDef}}} (//name, sqltext, [option]//)
!!!Arguments - Returned value
| !Argument | !Type | !Optional | !Description | !Returned value |
|name | String | N |The name of the new query | A [[querydef|QueryDef]] object |
|sqltext | String | N |The SQL statement to be executed when the query if fired. |~|
|option | Integer<br />Long | Y |If the argument is present its only allowed value = //dbSQLPassThrough//.<br />Forces escape substitution before sending the SQL statement to the database. |~|
!!!Remarks
*The //~CreateQueryDef// method must not be applied to a //Database// object created with the [[OpenDatabase]] method.
*The resulting //~QueryDef// object is automatically appended to the [[QueryDefs collection|QueryDefs]].
*If the object specified by //name// is already a member of the //~QueryDefs// collection (the comparison is NOT case-sensitive !!), the existing query is erased without warning.
*The //~CreateQueryDef// method must not be invoked from a [[standalone form|Standalone Forms]] defined in a non-Base (Writer, Calc, ...) document.
*To include the constant in your own code, copy and paste next line:
//{{{
Const dbSQLPassThrough = 64
//}}}
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Method 'Database.~CreateQueryDef' not applicable in this context |
!!!See also
[[CreateTableDef]]
[[TableDefs]]
[[TableDef]]
[[QueryDefs]]
[[QueryDef]]
!!!Example
<<tiddler "CreateQueryDef example">></pre>
</div>
<div title="CreateQueryDef example" modifier="Jean-PierreLedure" created="201308111047" modified="201308111049" tags="[[Snippets of Code]]">
<pre>Create new Query in the database. If it exists already it will be overwritten.
//{{{
Dim oQueryDef As Object
Const dbSQLPassThrough = 64
Set oQueryDef = Application.CurrentDb().CreateQueryDef("NewQuery" _
, "SELECT * FROM [Products] ORDER BY [ManufacturingCost] DESC" _
, dbSQLPassThrough _
)
//}}}</pre>
</div>
<div title="CreateRecordsetFrom" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201406220916" modified="201511211707" tags="HowTo" changecount="15">
<pre>(Q) Are there different means to access data stored in a database ?
(R) The simplest mean to get data from a database is to create a [[recordset object|Recordset]] from an existing [[table|TableDef]] name, an existing [[query|QueryDef]] name or derived from an existing [[form|Form]].
Such a resulting recordset object must always be [[closed|Close (method)]] after usage.
!!!From a table
Use the [[OpenRecordset]] method with the table name as argument. The name is NOT case-sensitive.
//{{{
Sub CreateRecordsetFromTable
Dim odbNorthwind As Object
Dim orsShippers As Object ' Will contain the future Recordset object
Set odbNorthwind = Application.CurrentDb
Set orsShippers = odbNorthwind.OpenRecordset("Shippers")
' ... do whatever is needed
orsShippers.mClose()
End Sub
//}}}
!!!From a query
Use the [[OpenRecordset]] method with the query name as argument. The name is NOT case-sensitive.
//{{{
Sub CreateRecordsetFromQuery
Dim odbNorthwind As Object
Dim orsCustomers As Object ' Will contain the future Recordset object
Set odbNorthwind = Application.CurrentDb
Set orsCustomers = odbNorthwind.OpenRecordset("Customers union All")
' ... do whatever is needed
orsCustomers.mClose()
End Sub
//}}}
!!!From a form
Use the [[Recordset property|Recordset (property)]] applied to a form object to get its recordset. The same property is applicable, if needed, to a [[subform object|SubForm]].
//{{{
Sub CreateRecordsetFromForm
Dim odbNorthwind As Object
Dim ofOrders As Object
Dim orsOrders As Object ' Will contain the future Recordset object
Set odbNorthwind = Application.CurrentDb
Set ofOrders = Application.OpenForm("Orders_Tabbed")
Set orsOrders = ofOrders.Recordset
' ... do whatever is needed
orsOrders.mClose()
End Sub
//}}}
!!!See also
[[Close|Close (method)]]
[[OpenRecordset]]
[[Recordset|Recordset (property)]]
!!!Refer to ...
| !Basic module | !Sub |!Comments |
|~HowTo |~CreateRecordsetFromTable ||
|~|~CreateRecordsetFromQuery ||
|~|~CreateRecordsetFromForm ||</pre>
</div>
<div title="CreateTableDef" modifier="Jean-Pierre Ledure" created="201401170845" modified="201409141659" tags="Methods" changecount="5">
<pre>Creates a new [[TableDef object|TableDef]] in the current [[database|Database]].
This method offers the capacity to create from the Basic code a new table independently from the underlying RDBMS. Thus without using SQL. However only a limited set of options are available for field descriptions.
!!!Applies to ...
| !Object | !Description |
|[[Database]] |The representation of the database currently connected to a Base (".odb") document. |
!!!Syntax
Set //tabledef// = //database//.{{{CreateTableDef(}}}//name//{{{)}}}
!!!Arguments - Returned value
| !Argument | !Type | !Optional | !Description | !Returned value |
|name | String | N |The name of the new table | A [[tabledef|TableDef]] object |
!!!Remarks
*The //~CreateTableDef// method may be applied ONLY from a macro executed from a Base ("*.odb") document, said otherwise, __not from a [[standalone form|Standalone Forms]]__. The //database// object should be returned by the [[Application.CurrentDb|CurrentDb]] method.
*To become fully viable the new //~TableDef// object has to be [[added|Add]] explicitly to the [[TableDefs collection|TableDefs]].
*Between the execution of the //~CreateTableDef// and the //Add// methods one or more fields should have been created thru the [[CreateField]] method.
*If the object specified by //name// is already a member of the //~TableDefs// collection (the comparison is NOT case-sensitive !!), the __existing table is erased without warning__.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Method 'Database.~CreateTableDef' not applicable in this context |
!!!See also
[[Add]]
[[CreateField]]
[[CreateQueryDef]]
[[TableDefs]]
[[TableDef]]
[[QueryDefs]]
[[QueryDef]]
!!!Example
<<tiddler "CreateTableDef example">></pre>
</div>
<div title="CreateTableDef example" modifier="Jean-Pierre Ledure" created="201401171408" modified="201405240642" tags="[[Snippets of Code]]" changecount="2">
<pre>Build a new table in the database without using SQL
//{{{
Dim oDatabase As Object, oTable As Object
Set oDatabase = Application.CurrentDb()
Set oTable = oDatabase.CreateTableDef("myNewTable") ' Create "empty" table
With oTable
.CreateField("myAutoIncrFld", dbLong, , dbAutoIncrField) ' Create 2 fields
.CreateField("myDecimalFld", dbDecimal, 10.4)
End With
oDatabase.TableDefs().Add(oTable) ' Finalize table creation
//}}}
Add a field to an existing table
//{{{
Set oTable = oDatabase.TableDefs("myExistingTable")
oTable.CreateField("myBinaryFld", dbBinary)
//}}}</pre>
</div>
<div title="CrossTabQuery" modifier="Jean-Pierre Ledure" created="201308241500" modified="201405240735" tags="HowTo" changecount="1">
<pre>(Q) How can I write a query similar to the crosstab queries I find in ~MSAccess (also elsewhere) ? To produce something like:
| No. Sales per year | 1996 | 1997 | 1998 | Total |
|Margaret Peacock | 31 | 81 | 44 | 156 |
|Janet Leverling | 18 | 71 | 38 | 127 |
|Nancy Davolio | 26 | 55 | 42 | 123 |
|Laura Callahan | 19 | 54 | 31 | 104 |
|Andrew Fuller | 16 | 41 | 39 | 96 |
|etc ... |||||
(R) A crosstab query aggregates data in the form of a matrix. Example: products sales by period. The issue is that the periods to be considered are in the database and can vary over time. Additionally periods can be years, quarters, months, ...
Doing this is feasible by //generating// with a Basic function the appropriate SQL statement.
The solution presented here will work for the SUM() and COUNT() aggregate functions.
Let's consider next tables:
<<tiddler "ProductsTable">>
<<tiddler "CustomersTable">>
<<tiddler "OrdersTable">>
<<tiddler "OrderDetailsTable>>
A crosstab query needs at least next inputs:
*One or more __row headings__: several database fields which will appear in front of each row and on which the aggregation function will be applied => [Rowheadings]] or their aliases
*One __column heading__: the field varying horizontally (periods, ...) => (~ColHeading] or its alias
*The (numeric) __value__ which will be aggregated => [Aggregate]
*The __FROM expression__ listing the concerned tables and the associated WHERE clause => [~FromExpression]
*and, optionally, one or more sort keys.
The target is to produce an SQL statement which will look like:
//{{{
SELECT
[RowheadingAlias(0)],
[RowheadingAlias(1)],
...
SUM( CASE [ColHeadingAlias] WHEN 'ColValue0' THEN [Data] ELSE 0 END ) As [ColValue0],
SUM( CASE [ColHeadingAlias] WHEN 'ColValue1' THEN [Data] ELSE 0 END ) As [ColValue1],
SUM( CASE [ColHeadingAlias] WHEN 'ColValue2' THEN [Data] ELSE 0 END ) As [ColValue2],
...
SUM( [Data] ) As [All]
FROM
(SELECT RowHeading(0),
RowHeading(1),
...
ColHeading,
Aggregate As [Data]
FROM FromExpression
GROUP BY RowHeadingAlias(0),RowHeadingAlias(1), ColHeadingAlias
)
GROUP BY RowHeadingAlias(0),RowHeadingAlias(1)
ORDER BY [All] | OrderBy
//}}}
The resulting SQL statement could be afterwards:
*displayed with the [[OpenSQL]] action
*browed as a [[Recordset]]
*stored as a new Query with [[CreateQueryDef]]
!!!Examples:
//{{{
Dim sSql As String
sSql = MakeCrossTab( _
"[FirstName] || ' ' || [LastName] As [Name]" _
, "YEAR([OrderDate]) || 'Q' || QUARTER([OrderDate]) As [Quarter]" _
, "Count(*)" _
, "[Employees] INNER JOIN [Orders] ON ([Employees].[EmployeeID]=[Orders].[EmployeeID])" _
, "DESC" _
)
OpenSQL(sSql, dbSQLPassThrough)
//}}}
will produce:
| Name | 1996Q3 | 1996Q4 | 1997Q1 | 1997Q2 | 1997Q3 | 1997Q4 | 1998Q1 | 1998Q2 | All |
|Margaret Peacock | 15 | 16 | 18 | 18 | 22 | 23 | 32 | 12 | 156 |
|Janet Leverling | 7 | 11 | 19 | 16 | 10 | 26 | 28 | 10 | 127 |
|Nancy Davolio | 11 | 15 | 10 | 10 | 18 | 17 | 29 | 13 | 123 |
|Laura Callahan | 11 | 8 | 19 | 9 | 14 | 12 | 19 | 12 | 104 |
|Andrew Fuller | 8 | 8 | 9 | 10 | 11 | 11 | 19 | 20 | 96 |
|Robert King | 3 | 8 | 6 | 12 | 13 | 5 | 14 | 11 | 72 |
|Michael Suyama | 9 | 6 | 6 | 8 | 5 | 14 | 14 | 5 | 67 |
|Anne Dodsworth | 2 | 3 | 2 | 6 | 4 | 7 | 15 | 4 | 43 |
|Steven Buchanan | 4 | 7 | 3 | 4 | 6 | 5 | 12 | 1 | 42 |
Similarly:
//{{{
Dim sSql As String
Const dbSQLPassThrough = 64
sSql = MakeCrossTab( _
"[Customers].[CompanyName] As [Customer], [Products].[ProductName] AS [Name]" _
, "YEAR([OrderDate]) || 'Q' || QUARTER([OrderDate]) As [Quarter]" _
, "SUM([Order Details].[UnitPrice]*[Quantity]*(1-[Discount]))" _
, "[Order Details], [Products], [Orders], [Customers] " _
& "WHERE [Order Details].[ProductID] = [Products].[ProductID] " _
& "AND [Order Details].[OrderID] = [Orders].[OrderID] " _
& "AND [Customers].[CustomerID] = [Orders].[CustomerID] " _
& "AND YEAR([Orders].[OrderDate]) = 1997" _
, "[Customer]" _
)
OpenSQL(sSql, dbSQLPassThrough)
//}}}
will produce next result:
| Customer | Name | 1997Q1 | 1997Q2 | 1997Q3 | 1997Q4 | All |
|Alfreds Futterkiste | Lakkalikööri | 0 | 0 | 0 | 270 | 270 |
|Alfreds Futterkiste | Aniseed Syrup | 0 | 0 | 0 | 60 | 60 |
|Alfreds Futterkiste | Vegie-spread | 0 | 0 | 0 | 878 | 878 |
|Alfreds Futterkiste | Spegesild | 0 | 0 | 18 | 0 | 18 |
|Alfreds Futterkiste | Chartreuse verte | 0 | 0 | 283,5 | 0 | 283,5 |
|Alfreds Futterkiste | Rössle Sauerkraut | 0 | 0 | 513 | 0 | 513 |
|Ana Trujillo Emparedados y helados | Mascarpone Fabioli | 0 | 0 | 0 | 320 | 320 |
|Ana Trujillo Emparedados y helados | Camembert Pierrot | 0 | 0 | 340 | 0 | 340 |
|Ana Trujillo Emparedados y helados | Singaporean Hokkien Fried Mee | 0 | 0 | 70 | 0 | 70 |
|etc ... |||||||
Note that in the context of HSQLDB as database management system:
*the readability of the arguments is strongly improved by using the square brackets [] as delimitors of table- and fieldnames instead of double quotes;
*either the double quotes or the square brackets are MANDATORY;
*the table- and fieldnames are case-sensitive.
!!!Code
Next function will do the job:
//{{{
Public Function MakeCrossTab( _
Byval psRowHeading As String _
, Byval psColHeading As String _
, Byval psAggregate As String _
, Byval psFromExpression As String _
, Byval psSortBy As String _
) As String
Dim sQuery As String, sSubQuery As String, vRowHeading() As Variant, sGroupBy As String, sSortBy As String
Dim sDataQuery As String, oData As Object, oField As Object, sCase As String, sValue As String
Dim i As Integer
vRowHeading() = Split(psRowHeading, ",")
If UBound(vRowHeading) < 0 Then Exit Function
' SUBQUERY
sSubQuery = "SELECT " & vRowHeading(0)
For i = 1 To UBound(vRowHeading)
sSubQuery = sSubQuery & "," & vRowheading(i)
Next i
sSubQuery = sSubQuery & ", " & psColHeading & ", " & psAggregate & " AS [Data] FROM " & psFromExpression & " GROUP BY "
sGroupBy = AliasOf(vRowHeading(0))
For i = 1 To UBound(vRowHeading)
sGroupBy = sGroupBy & ", " & AliasOf(vRowHeading(i))
Next i
sSubQuery = sSubQuery & sGroupBy & "," & AliasOf(psColHeading)
' MAIN QUERY
' Identify all distinct column headings
sDataQuery = "SELECT DISTINCT " & psColHeading & " FROM " & psFromExpression & " ORDER BY " & AliasOf(psColHeading)
Set oData = CurrentDb().OpenRecordset(sDataQuery,, dbSQLPassThrough, dbReadOnly)
Set oField = oData.Fields(0)
' Build CASE sentences
sCase = ""
For i = 0 To UBound(vRowHeading)
scase = sCase & AliasOf(vRowHeading(i)) & ", "
Next i
With oData ' Recordset
Do While Not .EOF
sValue = CStr(oField.Value) ' Force string
sCase = sCase & "SUM( CASE " & AliasOf(psColHeading) & " WHEN '" & sValue & "' THEN [Data] ELSE 0 END ) As [" & sValue & "],"
.MoveNext
Loop
.mClose()
End With
sCase = sCase & "SUM( [Data] ) As [All]"
' Final query
Select Case UCase(psSortBy)
Case "", "ASC" : sSortBy = "ORDER BY [All] ASC"
Case "DESC" : sSortBy = "ORDER BY [All] DESC"
Case Else : sSortBy = "ORDER BY " & psSortBy
End Select
sQuery = "SELECT " & sCase & " FROM (" & sSubQuery & ") GROUP BY " & sGroupBy & sSortBy
' Store SQL
MakeCrossTab = sQuery
End Function
//}}}
It calls next small function:
//{{{
Function AliasOf(ByVal psString As String) As String
Dim iPos As Integer
iPos = InStr(psString, " AS ")
If iPos > 0 Then AliasOf = Right(psString, Len(psString) - iPos - 3) Else AliasOf = psString
End Function
//}}}
!!!See also
[[CreateQueryDef]]
[[Execute|Execute (query)]]
[[OpenSQL]]
[[Recordset]]
!!!Refer to ...
| !Basic module |
|~CrossTab |</pre>
</div>
<div title="CurrentDb" modifier="Jean-Pierre Ledure" created="201108131501" modified="201408311702" tags="Methods" changecount="3">
<pre>The //~CurrentDb// method returns either
*the [[database|Database]] object related to a Base (".odb") document,
*the database object related to a [[standalone form|Standalone Forms]] contained in a non-Base (Writer Calc, ...) document.
<<tiddler "ApplyApplication">>
or to ...
| !Object | !Description |
|[[Form]] |The database object related to a standalone form. |
!!!Syntax
{{{[Application.]CurrentDb()}}}
{{{form.CurrentDb()}}}
!!!Returned values / Arguments
{{{Database}}} object or {{{Nothing}}}
!!!Remarks
*The ~CurrentDb method returns {{{Nothing}}} (to be tested with the {{{IsNull()}}} Basic builtin function) if the database connection is undefined or is currently unavailable. In case of wanted (by using the [[CloseConnection]] method) or unwanted disconnection the [[OpenConnection]] //Sub// may be (re)executed to (re)create a valid connection.
*When applied to a non-Base document containing at least one //standalone// form, the statements
//{{{
Application.CurrentDb()
//}}}
and
//{{{
Forms(0).CurrentDb()
//}}}
are equivalent.
!!!Error messages
None
!!!See also
[[CloseConnection]]
[[Database]]
[[Form]]
[[OpenConnection]]
!!!Example
<<tiddler "CurrentDb example">></pre>
</div>
<div title="CurrentDb example" modifier="Jean-Pierre Ledure" created="201108131510" modified="201408011509" tags="[[Snippets of Code]]" changecount="1">
<pre>Reconnect database after unwanted disconnection
//{{{
If IsNull(Application.CurrentDb) Then Call Application.OpenConnection(ThisDatabaseDocument)
//}}}</pre>
</div>
<div title="CurrentRecord" modifier="Jean-PierreLedure" created="201306131021" modified="201306151429" tags="Properties">
<pre>You can use the //CurrentRecord// property to specify the current record in the recordset being viewed on a form.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
|[[SubForm]] |A subform in an open form |
!!!Syntax
//form//{{{.CurrentRecord}}}
//form//{{{.CurrentRecord = }}}//value//
//subform//{{{.CurrentRecord}}}
//subform//{{{.CurrentRecord = }}}//value//
!!!Returned values / Arguments
{{{Long}}}
!!!Remarks
The value specified by this property corresponds to the value shown in the record number box found in the lower-left corner of the form.
!!!Error messages
|Form '...' is currently not open|
|Value '...' is invalid for property '~CurrentRecord' |
!!!See also
[[Recordset|Recordset (property)]]
!!!Example
<<tiddler "CurrentRecord example">></pre>
</div>
<div title="CurrentRecord example" modifier="Jean-PierreLedure" created="201306141331" modified="201306141340" tags="[[Snippets of Code]]">
<pre>Go to the 100th record
//{{{
Dim oForm As Object
Set oForm = Forms("myForm")
oForm.CurrentRecord = 100
//}}}</pre>
</div>
<div title="CurrentUser" modifier="Jean-Pierre Ledure" created="201312261107" modified="201510031311" tags="Properties" changecount="3">
<pre>The //~CurrentUser// property returns the logon name of the current user.
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]CurrentUser}}}
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
!!!Error messages
!!!See also
[[ProductCode]]
[[Version]]
!!!Example
<<tiddler "Identification example">></pre>
</div>
<div title="CustomersTable" modifier="Jean-PierreLedure" created="201212221717" modified="201212281639" tags="HowTo">
<pre>*Customers table
| !Fields | !Field Type | !Primary |
|Address | Text ||
|City | Text ||
|~CompanyName | Text ||
|~ContactName | Text ||
|Country | Text ||
|~CustomerID | Text | Y |
|Fax | Text ||
|Phone | Text ||
|~PostalCode | Text ||
|Region | Text ||</pre>
</div>
<div title="DAvg" modifier="Jean-Pierre Ledure" created="201108061256" modified="201605011507" tags="[[Database Functions]]" changecount="5">
<pre>You can use the ~DAvg function to determine the average of a set of values in a specified set of records (a domain).
<<tiddler "ApplyApplication">>
or to ...
| !Object | !Description |
|[[Database]] |A database object opened with the [[OpenDatabase]] or returned by the [[CurrentDb]] methods. |
!!!Syntax
{{{[Application.]DAvg(expression, domain[, criteria])}}}
{{{database.DAvg(expression, domain[, criteria])}}}
!!!Arguments
| !Argument | !Type | !Optional |!Description |
|database | Object | Y |A database object opened with the //~OpenDatabase// or returned by the //~CurrentDb// methods. |
|expression | String ||An expression that identifies the field whose value you want to return. It can be a string expression identifying a field in a table or query, or it can be a SQL expression that performs a calculation on data in that field. However the SQL expression must not include any SQL aggregate function. |
|domain | String ||A string expression identifying the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter. |
|criteria | String | Y |An optional string expression used to restrict the range of data on which the ~DAvg function is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the ~DAvg function evaluates expr against the entire domain. Any field that is included in criteria must also be a field in domain. |
!!!Returned value
{{{Variant}}}
!!!Remarks
*In all the //expression//, //domain//, //criteria// and //orderclause// arguments, database table- and fieldnames should be surrounded with square brackets []. Additionally, if in the current RDBMS (Relational ~DataBase Management System) table- and fieldnames used in SQL statements are case-sensitive - like in ~MySQL -, the same rule applies when used in database functions.
*If no record satisfies //criteria// or if //domain// contains no records, the ~DAvg function returns a ''Null''.
*Construct the //criteria// argument carefully to ensure that it will be evaluated correctly as a valid WHERE clause.
!!!Error messages
|~DFunction execution failed SQL='...' |
!!!See also
[[DCount]]
[[DLookup]]
[[DMin, DMax]]
[[DStDev, DStDevP]]
[[DSum]]
[[DVar, DVarP]]
!!!Example
<<tiddler "Dfunctions example">></pre>
</div>
<div title="DCount" modifier="Jean-Pierre Ledure" created="201108061247" modified="201605011508" tags="[[Database Functions]]" changecount="4">
<pre>You can use the ~DCount function to determine the number of records that are in a specified set of records (a domain).
<<tiddler "ApplyApplication">>
or to ...
| !Object | !Description |
|[[Database]] |A database object opened with the [[OpenDatabase]] or returned by the [[CurrentDb]] methods. |
!!!Syntax
{{{[Application.]DCount(expression, domain[, criteria])}}}
{{{database.DCount(expression, domain[, criteria])}}}
!!!Arguments
| !Argument | !Type | !Optional |!Description |
|database | Object | Y |A database object opened with the //~OpenDatabase// or returned by the //~CurrentDb// methods. |
|expression | String ||An expression that identifies the field whose value you want to return. It can be a string expression identifying a field in a table or query, or it can be a SQL expression that performs a calculation on data in that field. However the SQL expression must not include any SQL aggregate function. |
|domain | String ||A string expression identifying the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter. |
|criteria | String | Y |An optional string expression used to restrict the range of data on which the ~DAvg function is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the ~DAvg function evaluates expr against the entire domain. Any field that is included in criteria must also be a field in domain. |
!!!Returned value
{{{Integer}}} or {{{Long}}}
!!!Remarks
*In all the //expression//, //domain//, //criteria// and //orderclause// arguments, database table- and fieldnames should be surrounded with square brackets []. Additionally, if in the current RDBMS (Relational ~DataBase Management System) table- and fieldnames used in SQL statements are case-sensitive - like in ~MySQL -, the same rule applies when used in database functions.
*If no record satisfies //criteria// or if //domain// contains no records, the ~DCount function returns a ''Null''.
*Construct the //criteria// argument carefully to ensure that it will be evaluated correctly as a valid WHERE clause.
!!!Error messages
|~DFunction execution failed SQL='...' |
!!!See also
[[DAvg]]
[[DLookup]]
[[DMin, DMax]]
[[DStDev, DStDevP]]
[[DSum]]
[[DVar, DVarP]]
!!!Example
<<tiddler "Dfunctions example">></pre>
</div>
<div title="DLookup" modifier="Jean-Pierre Ledure" created="201108060748" modified="201605011507" tags="[[Database Functions]]" changecount="3">
<pre>You can use the ~DLookup function to get the value of a particular field from a specified set of records (a domain).
You can use the ~DLookup function to display the value of a field that isn't in the record source for your form. For example, suppose you have a form based on an Order Details table. The form displays the ~OrderID, ~ProductID, ~UnitPrice, Quantity, and Discount fields. However, the ~ProductName field is in another table, the Products table. You could use the ~DLookup function in an event to display the ~ProductName on the same form.
<<tiddler "ApplyApplication">>
or to ...
| !Object | !Description |
|[[Database]] |A database object opened with the [[OpenDatabase]] or returned by the [[CurrentDb]] methods. |
!!!Syntax
{{{[Application.]DLookup(expression, domain[, criteria][, orderclause]))}}}
{{{database.DLookup(expression, domain[, criteria][, orderclause]))}}}
!!!Arguments
| !Argument | !Type | !Optional |!Description |
|database | Object | Y |A database object opened with the //~OpenDatabase// or returned by the //~CurrentDb// methods. |
|expression | String ||An expression that identifies the field whose value you want to return. It can be a string expression identifying a field in a table or query, or it can be a SQL expression that performs a calculation on data in that field. However the SQL expression must not include any SQL aggregate function. |
|domain | String ||A string expression identifying the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter. |
|criteria | String | Y |An optional string expression used to restrict the range of data on which the ~DAvg function is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the ~DAvg function evaluates expr against the entire domain. Any field that is included in criteria must also be a field in domain. |
|orderclause | String | Y |A string expression specifying the sequence of the returned records. It is a SQL ORDER BY clause without the words ORDER BY. It can include the ASC or DESC keywords. |
!!!Returned value
{{{Variant}}}
!!!Remarks
*In all the //expression//, //domain//, //criteria// and //orderclause// arguments, database table- and fieldnames should be surrounded with square brackets []. Additionally, if in the current RDBMS (Relational ~DataBase Management System) table- and fieldnames used in SQL statements are case-sensitive - like in ~MySQL -, the same rule applies when used in database functions.
*The ~DLookup function returns a single field value based on the information specified in //criteria//. If more than one record meet //domain// and //criteria//, the DLookup function returns a __random__ value in the domain. If a //orderclause// is present the ~DLookup function will return the __first__ value that meets the criteria.
*If no record satisfies //criteria// or if //domain// contains no records, the ~DLookup function returns a ''Null''.
*Construct the //criteria// argument carefully to ensure that it will be evaluated correctly as a valid WHERE clause.
!!!Error messages
|~DFunction execution failed SQL='...' |
!!!See also
[[DAvg]]
[[DCount]]
[[DMin, DMax]]
[[DStDev, DStDevP]]
[[DSum]]
[[DVar, DVarP]]
!!!Example
<<tiddler "Dfunctions example">></pre>
</div>
<div title="DLookupSamples" modifier="Jean-PierreLedure" created="201212301328" modified="201212301416" tags="HowTo">
<pre>Note that the same logic applies to most Domain Aggregate Functions ([[DMin, DMax]] etc.)
!!!Normal usage
*For numerical values:
//{{{
DLookup("FieldName" , "TableName" , "Criteria=" & num)
//}}}
*For strings: (note the single quote before and after the value)
//{{{
DLookup("FieldName" , "TableName" , "Criteria='" & string & "'")
//}}}
*For dates: ISO notation => ''~YYYY-MM-DD''
//{{{
DLookup("FieldName" , "TableName" , "Criteria='" & Format(date, "YYYY-MM-DD") & "'")
//}}}
!!!Refering to a form control
*For numerical values
//{{{
DLookup("FieldName", "TableName", "Criteria=" & getValue("Forms!FormName!ControlName")
//}}}
*For strings: (note the single quote before and after the value)
//{{{
DLookup("FieldName", "TableName", "Criteria='" & getValue("Forms!FormName!ControlName") & "'")
//}}}
*For dates:
//{{{
DLookup("FieldName", "TableName", "Criteria='" & Format(getValue("Forms!FormName!ControlName")) & "'")
//}}}
!!!~Mix-n-Match
//{{{
DLookup("FieldName", "TableName", "Criteria1=" & Forms!FormName!Control1 _
& " AND Criteria2='" & getValue(Forms!FormName!Control2) & "'" _
& " AND Criteria3='" & Format(getValue(Forms!FormName!Control3), "YYYY-MM-DD") & "'")
//}}}</pre>
</div>
<div title="DMedian function" modifier="Jean-PierreLedure" created="201308041425" modified="201308161422" tags="HowTo">
<pre>(Q) How can I write a function that computes the //median// value of a range of data ?
(R) The median is the numerical value separating the higher half of a data sample from the lower half. The median of a finite list of numbers can be found by arranging all the observations from lowest value to highest value and picking the middle one. If there is an even number of observations, then there is no single middle value; the median is then usually defined to be the mean of the two middle values. (Wikipedia)
Easily feasible with a [[Recordset]] object.
The function:
//{{{
Public Function DMedian( _
psField As String _
, psTable As String _
, Optional psWhere As String _
) As Variant
Dim sSql As String, oRecordset As Object, vValue1 As variant, oField As Object
Const cstQuote = """"
DMedian = Null
sSql = "SELECT " _
& cstQuote & psField & cstQuote _
& " FROM " & cstQuote & psTable & cstQuote _
& Iif(IsMissing(psWhere), "", " WHERE " & psWhere) _
& " ORDER BY " & cstQuote & psField & cstQuote
Set oRecordset = CurrentDb().OpenRecordset(sSql)
With oRecordset
.MoveLast() ' Necessary to know the exact number of records
If Not .EOF() Then ' At least 1 record ?
Select Case .RecordCount Mod 2
Case 0 ' Even
.AbsolutePosition = .RecordCount / 2
Set oField = .Fields(psField)
vValue1 = oField.Value
.MoveNext
DMedian = (oField.Value + vValue1) / 2
Case 1 ' Odd
.AbsolutePosition = Int(.RecordCount / 2) + 1 ' Works also if only 1 record
DMedian = .Fields(psField).Value
End Select
End If
.mClose()
End With
End Function
//}}}
!!!Example
With next table:
<<tiddler "ProductsTable">>
//{{{
MsgBox DMedian("UnitPrice", "Products")
//}}}
computes the median value of the //~UnitPrice// range of values
!!!See also
[[Move (recordset)]]
[[AbsolutePosition]]
!!!Refer to ...
| !Basic module |
|Records |</pre>
</div>
<div title="DMin, DMax" modifier="Jean-Pierre Ledure" created="201108061258" modified="201605011507" tags="[[Database Functions]]" changecount="2">
<pre>You can use the ~DMin and ~DMax functions to determine the minimum and maximum values of a set of values in a specified set of records (a domain).
<<tiddler "ApplyApplication">>
or to ...
| !Object | !Description |
|[[Database]] |A database object opened with the [[OpenDatabase]] or returned by the [[CurrentDb]] methods. |
!!!Syntax
{{{[Application.]DMin(expression, domain[, criteria])}}}
{{{[Application.]DMax(expression, domain[, criteria])}}}
{{{database.DMin(expression, domain[, criteria])}}}
{{{database.DMax(expression, domain[, criteria])}}}
!!!Arguments
| !Argument | !Type | !Optional |!Description |
|database | Object | Y |A database object opened with the //~OpenDatabase// or returned by the //~CurrentDb// methods. |
|expression | String ||An expression that identifies the field whose value you want to return. It can be a string expression identifying a field in a table or query, or it can be a SQL expression that performs a calculation on data in that field. However the SQL expression must not include any SQL aggregate function. |
|domain | String ||A string expression identifying the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter. |
|criteria | String | Y |An optional string expression used to restrict the range of data on which the ~DAvg function is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the ~DAvg function evaluates expr against the entire domain. Any field that is included in criteria must also be a field in domain. |
!!!Returned value
{{{Variant}}}
!!!Remarks
*In all the //expression//, //domain//, //criteria// and //orderclause// arguments, database table- and fieldnames should be surrounded with square brackets []. Additionally, if in the current RDBMS (Relational ~DataBase Management System) table- and fieldnames used in SQL statements are case-sensitive - like in ~MySQL -, the same rule applies when used in database functions.
*If no record satisfies //criteria// or if //domain// contains no records, the ~DMin (~DMax) function returns a ''Null''.
*Construct the //criteria// argument carefully to ensure that it will be evaluated correctly as a valid WHERE clause.
!!!Error messages
|~DFunction execution failed SQL='...' |
!!!See also
[[DAvg]]
[[DCount]]
[[DLookup]]
[[DStDev, DStDevP]]
[[DSum]]
[[DVar, DVarP]]
!!!Example
<<tiddler "Dfunctions example">></pre>
</div>
<div title="DPercentile" modifier="Jean-Pierre Ledure" created="201308170741" modified="201408011512" tags="HowTo" changecount="1">
<pre>(Q) How can I write a function that computes the value corresponding with a given //percentile// of a range of data ?
(R) A percentile is a measure used in statistics indicating the value below which a given percentage of observations in a group of observations fall. For example, the 20th percentile is the value (or score) below which 20 percent of the observations may be found. For example, if a score is in the 86th percentile, it is higher than 86% of the other scores. (Wikipedia)
Easily feasible with a [[Recordset]] object.
The function:
//{{{
Public Function DPercentile( _
pdPercentile As Double _
, psField As String _
, psTable As String _
, Optional psWhere As String _
) As Variant
Dim sSql As String, oRecordset As Object, vValue1 As variant, oField As Object
Const cstQuote = """"
DPercentile = Null
If pdPercentile < 0 Or pdPercentile > 1 Then Exit Function
sSql = "SELECT " _
& cstQuote & psField & cstQuote _
& " FROM " & cstQuote & psTable & cstQuote _
& Iif(IsMissing(psWhere), "", " WHERE " & psWhere) _
& " ORDER BY " & cstQuote & psField & cstQuote
Set oRecordset = Application.CurrentDb().OpenRecordset(sSql)
With oRecordset
.MoveLast() ' Necessary to know the exact number of records
If pdPercentile < 1 Then ' Else take current (highest) value
If Not .EOF() Then ' At least 1 record ?
.AbsolutePosition = Int(CDbl(.RecordCount * pdPercentile + 0.5) + 0.5)
Else
Exit Function
End If
End If
DPercentile = .Fields(psField).Value
.mClose()
End With
End Function
//}}}
!!!Example
With next table:
<<tiddler "ProductsTable">>
//{{{
MsgBox DPercentile(0.25, "UnitPrice", "Products")
//}}}
computes the 25th percentile of the //~UnitPrice// range of values
!!!See also
[[Move (recordset)]]
[[AbsolutePosition]]
!!!Refer to ...
| !Basic module |
|Records |</pre>
</div>
<div title="DStDev, DStDevP" modifier="Jean-Pierre Ledure" created="201108061308" modified="201605011508" tags="[[Database Functions]]" changecount="2">
<pre>You can use the ~DStDev and ~DStDevP functions to determine the standard deviation of a set of values in a specified set of records (a domain).
<<tiddler "ApplyApplication">>
or to ...
| !Object | !Description |
|[[Database]] |A database object opened with the [[OpenDatabase]] or returned by the [[CurrentDb]] methods. |
!!!Syntax
{{{[Application.]DStDev(expression, domain[, criteria])}}}
{{{[Application.]DStDevP(expression, domain[, criteria])}}}
{{{database.DStDev(expression, domain[, criteria])}}}
{{{database.DStDevP(expression, domain[, criteria])}}}
!!!Arguments
| !Argument | !Type | !Optional |!Description |
|database | Object | Y |A database object opened with the //~OpenDatabase// or returned by the //~CurrentDb// methods. |
|expression | String ||An expression that identifies the field whose value you want to return. It can be a string expression identifying a field in a table or query, or it can be a SQL expression that performs a calculation on data in that field. However the SQL expression must not include any SQL aggregate function. |
|domain | String ||A string expression identifying the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter. |
|criteria | String | Y |An optional string expression used to restrict the range of data on which the ~DAvg function is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the ~DAvg function evaluates expr against the entire domain. Any field that is included in criteria must also be a field in domain. |
!!!Returned value
{{{Variant}}}
!!!Remarks
*In all the //expression//, //domain//, //criteria// and //orderclause// arguments, database table- and fieldnames should be surrounded with square brackets []. Additionally, if in the current RDBMS (Relational ~DataBase Management System) table- and fieldnames used in SQL statements are case-sensitive - like in ~MySQL -, the same rule applies when used in database functions.
*If no record satisfies //criteria// or if //domain// contains no records, the ~DStDev (~DStDevP) function returns a ''Null''.
*Construct the //criteria// argument carefully to ensure that it will be evaluated correctly as a valid WHERE clause.
!!!Error messages
|~DFunction execution failed SQL='...' |
!!!See also
[[DAvg]]
[[DCount]]
[[DLookup]]
[[DMin, DMax]]
[[DSum]]
[[DVar, DVarP]]
!!!Example
<<tiddler "Dfunctions example">></pre>
</div>
<div title="DSum" modifier="Jean-Pierre Ledure" created="201111121452" modified="201605011508" tags="[[Database Functions]]" changecount="2">
<pre>You can use the ~DSum function to determine the sum of a set of numeric values in a specified set of records (a domain).
<<tiddler "ApplyApplication">>
or to ...
| !Object | !Description |
|[[Database]] |A database object opened with the [[OpenDatabase]] or returned by the [[CurrentDb]] methods. |
!!!Syntax
{{{[Application.]DSum(expression, domain[, criteria])}}}
{{{database.DSum(expression, domain[, criteria])}}}
!!!Arguments
| !Argument | !Type | !Optional |!Description |
|database | Object | Y |A database object opened with the //~OpenDatabase// or returned by the //~CurrentDb// methods. |
|expression | String ||An expression that identifies the field whose value you want to return. It can be a string expression identifying a field in a table or query, or it can be a SQL expression that performs a calculation on data in that field. However the SQL expression must not include any SQL aggregate function. |
|domain | String ||A string expression identifying the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter. |
|criteria | String | Y |An optional string expression used to restrict the range of data on which the ~DAvg function is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the ~DAvg function evaluates expr against the entire domain. Any field that is included in criteria must also be a field in domain. |
!!!Returned value
{{{Variant}}}
!!!Remarks
*In all the //expression//, //domain//, //criteria// and //orderclause// arguments, database table- and fieldnames should be surrounded with square brackets []. Additionally, if in the current RDBMS (Relational ~DataBase Management System) table- and fieldnames used in SQL statements are case-sensitive - like in ~MySQL -, the same rule applies when used in database functions.
*If no record satisfies //criteria// or if //domain// contains no records, the ~DSum function returns a ''Null''.
*Construct the //criteria// argument carefully to ensure that it will be evaluated correctly as a valid WHERE clause.
!!!Error messages
|~DFunction execution failed SQL='...' |
!!!See also
[[DAvg]]
[[DCount]]
[[DLookup]]
[[DMin, DMax]]
[[DStDev, DStDevP]]
[[DVar, DVarP]]
!!!Example
<<tiddler "Dfunctions example">></pre>
</div>
<div title="DVar, DVarP" modifier="Jean-Pierre Ledure" created="201108061305" modified="201605011508" tags="[[Database Functions]]" changecount="2">
<pre>You can use the ~DVar and ~DVarP functions to determine the variance of a set of values in a specified set of records (a domain).
<<tiddler "ApplyApplication">>
or to ...
| !Object | !Description |
|[[Database]] |A database object opened with the [[OpenDatabase]] or returned by the [[CurrentDb]] methods. |
!!!Syntax
{{{[Application.]DVar(expression, domain[, criteria])}}}
{{{[Application.]DVarP(expression, domain[, criteria])}}}
{{{database.DVar(expression, domain[, criteria])}}}
{{{database.DVarP(expression, domain[, criteria])}}}
!!!Arguments
| !Argument | !Type | !Optional |!Description |
|database | Object | Y |A database object opened with the //~OpenDatabase// or returned by the //~CurrentDb// methods. |
|expression | String ||An expression that identifies the field whose value you want to return. It can be a string expression identifying a field in a table or query, or it can be a SQL expression that performs a calculation on data in that field. However the SQL expression must not include any SQL aggregate function. |
|domain | String ||A string expression identifying the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter. |
|criteria | String | Y |An optional string expression used to restrict the range of data on which the ~DAvg function is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the ~DAvg function evaluates expr against the entire domain. Any field that is included in criteria must also be a field in domain. |
!!!Returned value
{{{Variant}}}
!!!Remarks
*In all the //expression//, //domain//, //criteria// and //orderclause// arguments, database table- and fieldnames should be surrounded with square brackets []. Additionally, if in the current RDBMS (Relational ~DataBase Management System) table- and fieldnames used in SQL statements are case-sensitive - like in ~MySQL -, the same rule applies when used in database functions.
*If no record satisfies //criteria// or if //domain// contains no records, the ~DVar (~DVarP) function returns a ''Null''.
*Construct the //criteria// argument carefully to ensure that it will be evaluated correctly as a valid WHERE clause.
!!!Error messages
|~DFunction execution failed SQL='...' |
!!!See also
[[DAvg]]
[[DCount]]
[[DLookup]]
[[DMin, DMax]]
[[DStDev, DStDevP]]
[[DSum]]
!!!Example
<<tiddler "Dfunctions example">></pre>
</div>
<div title="DataType" modifier="Jean-Pierre Ledure" created="201306291216" modified="201512271330" tags="Properties" changecount="3">
<pre>The type of a field pertaining to a [[table|TableDef]], a [[query|QueryDef]] or a [[recordset|Recordset]] can be recognized thru the use of any of next properties:
*//~DataType//
*//~DbType//
*//~TypeName//
The ~DbType property is there for compatibility with ~MSAccess.
See the correspondence table below.
!!!Applies to ...
| !Object |!Description |
|[[Field]] |The representation of a field of a table, a query or a recordset. |
!!!Syntax
//field//{{{.DataType}}}
//field//{{{.DbType}}}
//field//{{{.TypeName}}}
!!!Returned values
| !Property | !Returned value |
|~DataType | Long |
|~DbType | Integer |
|~TypeName | String |
!!!Correspondence table
<<tiddler "FieldTypesList">>
Instead of using the numeric values for ~DbType, one may copy next code and paste it in his/her own code. This allows to use symbolic names, close to or identical with the field types existing in ~MSAccess.
//{{{
REM Types
REM -----------------------------------------------------------------
Const dbBigInt = 16
Const dbBinary = 9
Const dbBoolean = 1
Const dbByte = 2
Const dbChar = 18
Const dbCurrency = 5
Const dbDate = 8
Const dbDecimal = 20
Const dbDouble = 7
Const dbFloat = 21
Const dbGUID = 15
Const dbInteger = 3
Const dbLong = 4
Const dbLongBinary = 11
Const dbMemo= 12
Const dbNumeric = 19
Const dbSingle = 6
Const dbText = 10
Const dbTime = 22
Const dbTimeStamp = 23
Const dbVarBinary = 17
Const dbUndefined = -1
//}}}
!!!Remarks
*The //~DataType//, //~DbType// and //~TypeName// properties are read-only.
*As you can see there is no bijection between the list of //~DataTypes// and the list of //~TyeNames//. Indeed different Relational Database Systems may return different names for their internal set of database fieldtypes. This can create ambiguity. It is always preferable to use the //~DataType// property wherever possible.
!!!Error messages
!!!See also
!!!Example
<<tiddler "DataType example">></pre>
</div>
<div title="DataType example" modifier="Jean-PierreLedure" created="201306291319" tags="[[Snippets of Code]]">
<pre>List all fields of a table with their types
//{{{
Dim i As Integer, oTable As Object, oField As Object
Set oTable = Application.CurrentDb().TableDefs("AllTypes")
For i = 0 To oTable.Fields().Count - 1
Set oField = oTable.Fields(i)
DebugPrint oField.Name, oField.DataType, oField.DbType, oField.TypeName
Next i
//}}}</pre>
</div>
<div title="DataUpdatable" modifier="Jean-PierreLedure" created="201307211200" modified="201307211404" tags="Properties">
<pre>Returns a value that indicates whether the data in the field represented by a [[Field object|Field]] in a [[recordset|Recordset]] is updatable.
!!!Applies to ...
| !Object |!Description |
|[[Field]] |The representation of a field of a recordset. |
!!!Syntax
//field//{{{.DataUpdatable}}}
!!!Returned values
{{{Boolean}}}
!!!Remarks
*An error message is produced when the //~DataUpdatable// property is invoked on a field belonging to the [[Fields collection|Fields]] of a [[TableDef]] or a [[QueryDef]].
*Use this property to determine whether you can change the [[Value|Value (field)]] property setting of a [[Field object|Field]]. This property is always {{{False}}} on a //auto-increment// field.
!!!Error messages
!!!See also
[[SourceTable]]
[[Value|Value (field)]]
!!!Example</pre>
</div>
<div title="Database" modifier="Jean-Pierre Ledure" created="201108121003" modified="201704011647" tags="Objects" changecount="11">
<pre>{{firstletter{
@@color:#930;A@@
}}} //Database// [[object|Object Model]] describes the database the application is currently connected to.
!!!Functions/Methods returning a database object
| !Parent object | !Function | !Type |!Description |
|[[Application]]<br />[[Form]] |[[CurrentDb]] | Method |The //~CurrentDb// method returns either<br />- the database object related to a Base (".odb") document,<br />- or the database object related to a [[standalone form|Standalone Forms]] contained in a non-Base (Writer Calc, ...) document. |
|[[Application]] |[[OpenDatabase]] | Method |{{{Application.OpenDatabase( ... )}}} returns an object from which SQL statements can be run or recordsets can be browsed. |
!!!Collections
| !Collection | !Description |
|[[QueryDefs]] |The collection of [[QueryDef]] objects. |
|[[TableDefs]] |The collection of [[TableDef]] objects. |
|[[Recordsets]] |The collection of __open__ [[Recordset]] objects. |
!!!Properties
| !Property | !Type | !Read only | !Description or UNO object |
|[[Connect]] || Y |The connection string as displayed on the statusbar |
|[[Name]] || Y |The name of the database |
|[[ObjectType]] || Y |Returns "DATABASE" |
|[[Version]] || Y |Something like 'HSQL Database Engine 1.8.0' |
|Document | UNO | Y |com.sun.star.comp.dba.~ODatabaseDocument |
|Connection | UNO | Y |com.sun.star.sdbc.drivers.~OConnectionWrapper |
|~MetaData | UNO | Y |interface ~XDatabaseMetaData |
!!!Methods
| !Method | !Description |
|[[Close|Close (method)]] |Close the database object. |
|[[CloseAllRecordsets]] |Housekeeping of eventual open recordsets |
|[[CreateQueryDef]] |Create a new query entry in the database |
|[[CreateTableDef]] |Create a new table entry in the database |
|[[DAvg]] |Invoke one of the "database functions" |
|[[DCount]] |~|
|[[DLookup]] |~|
|[[DMin, DMax]] |~|
|[[DStDev, DStDevP]] |~|
|[[DSum]] |~|
|[[DVar, DVarP]] |~|
|[[getProperty]] |Return the value of the given property. |
|[[hasProperty]] |Return {{{True}}} if the Database object has the given property. |
|[[OutputTo]] |Output the content of a table or a query to an HTML page. |
|[[OpenRecordset]] |Define and open a [[recordset|Recordset]] based on a SQL statement |
|[[OpenSQL]] |Open a datasheet containing the data described by the provided SELECT SQL statement |
|[[RunSQL]] |Execute the SQL statement given as argument |
!!!See also
[[CurrentDb]]
</pre>
</div>
<div title="Database Functions" modifier="Jean-Pierre Ledure" created="201108060748" tags="Menu">
<pre></pre>
</div>
<div title="DatabaseWindow" modifier="Jean-PierreLedure" created="201212301116" modified="201212301133" tags="HowTo">
<pre>(Q) Can I hide the database window ?
(R) No, the database window cannot be hidden. It can however be minimized.
What is called here the //database window// is the screen welcoming the user when (s)he opens a database front-end file (suffixed with ".odb") where the tables, queries, forms and reports are listed.
It can be desirable to hide that window and, instead, opening a form for example.
!!!Minimize the database window
Very easy code but it's as easy for the user to restore it with a mouse click. Nevertheless ... first select the //database window// then minimize it.
//{{{
Const acDatabaseWindow = 102
SelectObject(acDatabaseWindow)
Minimize()
//}}}
A variant:
//{{{
Const acDatabaseWindow = 102
SelectObject(acDatabaseWindow)
MoveSize ,,10,10
//}}}
!!!See also
[[SelectObject]]
[[Minimize]]
[[Maximize]]
[[MoveSize]]</pre>
</div>
<div title="Datadef example" modifier="Jean-PierreLedure" created="201306081306" modified="201306081535" tags="[[Snippets of Code]]">
<pre>List all tables and all queries
//{{{
Dim i As Integer, odbDatabase As Object
Set odbDatabase = Application.CurrentDb()
With odbDatabase
Print "TABLES",
For i = 0 To .TableDefs().Count - 1
Print .TableDefs(i).Name,
Next i
Print "QUERIES",
For i = 0 To .QueryDefs().Count - 1
Print .QueryDefs(i).Name,
Next i
End With
//}}}
</pre>
</div>
<div title="DbaccessFromCalc" modifier="YourName" created="201404051435" modified="201801051754" tags="HowTo" changecount="33">
<pre>(Q) How could I get data stored in a database from within a Calc cell formula ?
(R) Calc offers as a standard feature to insert data from database tables and queries via a specific browser that is invoked by using the {{{View}}} + {{{Data Sources}}} menu command or the {{{F4}}} function key.
The Help files describe in detail how to proceed.
However the question here is, as an example : how is it possible to enter a ''product code'' in a cell and get in another calculated cell its ''description'', knowing that the __correspondence between both fields is somewhere in a database table__ and not in the spreadsheet ?
Obviously, to not simplify the problem, we would appreciate to have things happen automatically, i.e. also when the sheet is configured to have its
>{{{Tools + Cell Contents}}}
set to ''{{{AutoCalculate}}}'', and __without useless database accesses__.
In the proposed solution we will go even further. The example shown will illustrate next 4 functionalities:
*Use database data to populate a dropdown listbox.
*Derive automatically the //description// from the selected item in the listbox.
*Prepare a report with the heading derived from the database table field names.
*Populate an array of data in the sheet extracted from the database and filtered by the choice in the dropdown box..
[img[Access data dynamically from a Calc spreadsheet|dbaccess_from_calc.png]]
!!A solution
Let's consider next tables:
<<tiddler "CategoriesTable">>
<<tiddler "ProductsTable">>
The final purpose of the spreadsheet is to list all products belonging to the category selected by the user.
!!!Preamble
The challenge will be to do next things apparently simultaneously without the user becoming aware of the underlying complexity:
*to load the ~Access2Base macro library, only once
*to open the database file (".odb") referring to the effective database, also only once
*to extract the needed data only when relevant and every time it is, i.e. when some input parameter has been modified.
When Calc recomputes a worksheet, it sequences its computations in function of the respective arguments present in each cell formula.
For example, if
**cell A1 is a number
**C1 contains the formula {{{"=A1*2"}}}
**and B1 contains the formula {{{"=C1*C1"}}}
the worksheet will not be recomputed from left to right, but in the sequence A1, C1, B1. In addition, C1 and B1 will be both recomputed automatically every time A1 receives another value.
Choosing in this matter either cells or "names" (defined by {{{Insert}}} + {{{Names}}}) does not make any difference. Names will be preferred if they do not need to be visible in the sheet.
The sequencing of computations done by Calc is the mean we will use to reach our challenge.
!!!Global
To access the database we have to make use of a database object. Let's define it as a {{{Global}}} variable.
Such variables remain in life as long as
*the AOO/~LibO session is lasting
*the module where it is declared is not edited.
Usually I declare {{{Global}}} variable in a separate module as such a module is unlikely to be modified often.
//{{{
Global oMyDatabase As Variant
//}}}
!!!Define Name
Define a {{{Name}}} called {{{IsConnected}}}. Store in it the formula
//{{{
=DBCONNECTED()
//}}}
DBCONNECTED is a user-defined function and behaves exactly like any builtin Calc function or expression. It has no argument.
The code of the function is here:
//{{{
Sub _Init()
Dim oLib As Object
Set oLib = GlobalScope.BasicLibraries
If oLib.hasByName("Access2BaseDev") Then
oLib.loadLibrary("Access2BaseDev")
ElseIf Not oLib.IsLibraryLoaded("Access2Base") Then
oLib.loadLibrary("Access2Base")
End If
If oLib.hasByName("XrayTool") Then oLib.loadLibrary("XrayTool")
Set oMyDatabase = Nothing
End Sub
Function DBConnected() As Variant
Dim sCalc As String, sDatabase As String
DBConnected = 0
If IsEmpty(oMyDatabase) Or IsNull(oMyDatabase) Then
Call _Init() ' Load Basic libraries
With ThisComponent
sCalc = Join(Split(.Title, " "), "%20") ' Replace " " by "%20" in current filename
sDatabase = Join(Split(.URL, sCalc), "TT%20NorthWind.odb") ' Build URL of database located in same directory as current file
End With
Set oMyDatabase = OpenDatabase(sDatabase)
End If
DBConnected = 1
End Function
//}}}
The result is that the loading of the library is put on the computation path. There is no reason why Calc would require recomputation several times of {{{IsConnected}}} except while loading the spreadsheet.
Now we can build other formulas, like:
//{{{
=IF(IsConnected;USERDEFINED(...);False)
//}}}
being sure that __such formulas will be evaluated by Calc only when the evaluation of {{{IsConnected}}} has been achieved__.
!!!Setup the dropdown box
Use the {{{Data}}} + {{{Validity}}} menu commands to define //Criteria// as being a //Cell range//, select the //Show selection list// checkbox and enter as //Source// next formula
//{{{
=IF(IsConnected;CATEGORIESLIST();"")
//}}}
The CATEGORIESLIST() function:
//{{{
Function CategoriesList() As Variant
' Return the list of available product categories as an array
Dim oRs As Object, sCatsRC() As Variant, sCats() As Variant, i As Integer
If Not IsNull(oMyDatabase) Then
Set oRs = oMyDatabase.OpenRecordset("SELECT [CategoryName] FROM [Categories] ORDER BY [CategoryName]")
sCatsRC = oRs.GetRows(1000) ' matrix (column, row)
sCats() = Array() ' Reduce to column only
ReDim sCats(0 To UBound(sCatsRC, 2))
For i = 0 To UBound(sCats)
sCats(i) = sCatsRC(0, i)
Next i
CategoriesList = sCats()
oRs.mClose()
End If
End Function
//}}}
!!!Find description
The dropdown box is in cell {{{B2}}}. We put in cell {{{D2}}} next formula:
//{{{
=IF(IsConnected;CATLOOKUP(B2);"")
//}}}
that will be recomputed by Calc each time the cell {{{B2}}} is modified by the user.
The CATLOOKUP function:
//{{{
Function CatLookup(ByVal pvArg As Variant) As Variant
If Not IsNull(oMyDatabase) Then CatLookup = oMyDatabase.DLookup("[Description]", "[Categories]", "[CategoryName]='" & pvArg & "'")
End Function
//}}}
!!!Fill the data
The data matrix will be inserted as an ''array formula'' ({{{Ctrl}}} + {{{Shift}}} + {{{Enter}}}) in cells {{{D6:H35}}}. Look at the AOO/~LibO help to know more about them.
//{{{
{=IF(IsConnected,PRODUCTSLOAD($B$2),"")}
//}}}
The PRODUCTSLOAD function:
//{{{
Function ProductsLoad(ByVal pvCat As Variant) As Variant
Dim oRS As Object, sSQL As String, vResult() As Variant, vTranspose() As Variant
Dim i As Integer, j As Integer
Const cstSize = 30
If Not IsNull(oMyDatabase) Then
sSQL = "SELECT [ProductName] AS [Product], [QuantityPerUnit] AS [Quantity], [UnitsInStock] AS [Stock], [UnitPrice] AS [Price]" _
& ", [CompanyName] AS [Company]" _
& " FROM [Products], [Categories], [Suppliers]" _
& " WHERE [Products].[CategoryID] = [Categories].[CategoryID]" _
& " AND [Suppliers].[SupplierID] = [Products].[SupplierID]" _
& " AND [Categories].[CategoryName] = '" & pvCat & "'" _
& " ORDER BY [Product] ASC"
Set oRS = oMydatabase.Openrecordset(sSQL)
' Enumerate field names
vFields() = Array() ' Mandatory before resizing a variant
ReDim vFields(0 To oRS.Fields.Count - 1)
For i = 0 To UBound(vFields)
vFields(i) = oRS.Fields(i).Name
Next i
' fetch recordset data
vResult() = oRS.GetRows(cstSize)
oRS.mClose()
' Transpose results
vTranspose = Array()
ReDim vTranspose(0 To cstSize, 0 To UBound(vResult, 1))
For i = 0 To cstSize
For j = 0 To UBound(vTranspose, 2)
'Set Empty to avoid #N/A
If i > UBound(vResult, 2) Then vTranspose(i, j) = Empty Else vTranspose(i, j) = vResult(j, i)
Next j
Next i
ProductsLoad = vTranspose()
End If
End Function
//}}}
A second {{{Global}}} variable is used here to store the field names in a more generic way:
//{{{
Global vFields() As Variant
//}}}
!!!Headings
The title of the data matrix is again an array formula, put in cells {{{D4:H4}}}.
The {{{G36>0}}} condition below makes that the heading cells are evaluated after the data cells. Indeed titles are extracted from the database in the same {{{Sub}}} as the data.
//{{{
{=IF(AND(IsConnected,G36>0),DBTITLE(),"")}
//}}}
associated with next code:
//{{{
Function DbTitle() As Variant
If Not IsNull(oMyDatabase) Then
DbTitle() = vFields()
End If
End Function
//}}}
!!!Close the connection
Finally it is always recommended to clean the connection to the database.
Associate next code
//{{{
Function DbClose()
If Not IsNull(oMyDatabase) Then oMyDatabase.mClose()
Set oMyDatabase = Nothing ' Reinitialize oMyDatabase to Null
End Function
//}}}
with the {{{Document closed}}} event ({{{Tools}}} + {{{Customize}}} - {{{Events}}} tab).
!!See also
[[Close|Close (method)]]
[[DLookup]]
[[GetRows]]
[[OpenDatabase]]
[[OpenRecordset]]
!!!Refer to ...
| !File | !Basic module |
|TT ~NorthWind Calc.ods | Connect<br />Globals |</pre>
</div>
<div title="DebugPrint" modifier="Jean-PierreLedure" created="201205041017" modified="201301251654" tags="[[Error handling]]">
<pre>!!!Role
Registers in the Traces circular buffer a new entry. The arguments will be presented in tabular form.
!!!Syntax
{{{DebugPrint([Value1[, Value2[, Value3[ ... ])}}}
!!!Arguments
| !Arguments | !Type | !Default | !When ... | !Result string |
|List of values separated by commas | Any | Empty string ("") | Empty<br />Object<br />Null<br />Variant<br />Array<br />Boolean<br />Numeric<br />Date<br />String<br />Other |{{{--EMPTY--}}}<br />[~Object-Type] ~Object-Name<br />{{{--NULL--}}}<br />{{{--VARIANT--}}}<br />{{{--ARRAY--}}}<br />True or False<br />The numeric value<br />The Date value<br />The string<br />(ERROR) |
!!!See also
[[Error Handler]]
[[TraceConsole]]
[[TraceError]]
[[TraceLevel]]
[[TraceLog]]
!!!Example
<<tiddler "DebugPrint example">></pre>
</div>
<div title="DebugPrint example" modifier="Jean-Pierre Ledure" created="201205041058" modified="201405221353" tags="[[Snippets of Code]]" changecount="3">
<pre>Display debug information.
Next code ...
//{{{
Dim oForm As Object, sString As String, dDate As Date
Set oForm = Application.AllForms("myForm")
sString = "a string"
dDate = DateSerial(2014,5,10)
DebugPrint dDate, sString, oForm, oForm.Name, oForm.IsLoaded
//}}}
... generates next entry in the console:
//{{{
15:08:31 ===> 10/05/2014 a string [FORM] myForm myForm False
//}}}
</pre>
</div>
<div title="Default" modifier="Jean-PierreLedure" created="201108050957" modified="201306151420" tags="Properties">
<pre>You can use the Default property to specify whether a command button is the default button on a form.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br /> in a dialog |!Description |
|[[Control]] |~CommandButton | None |~CommandButton |A control on an open form or dialog |
!!!Syntax
//control//{{{.Default}}}
//control//{{{.Default = }}}//value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
!!!Error messages
|Property 'Default' not applicable in this context |
|Value '...' is invalid for property 'Default' |
!!!See also
[[Cancel]]
!!!Example
<<tiddler "Cancel & Default example">></pre>
</div>
<div title="DefaultTiddlers" modifier="Jean-Pierre Ledure" created="201106250808" modified="201108061605" tags="excludeLists">
<pre>[[Home]]</pre>
</div>
<div title="DefaultValue" modifier="Jean-Pierre Ledure" created="201108051009" modified="201405291532" tags="Properties" changecount="2">
<pre>The //~DefaultValue// property specifies a value that is automatically entered in a field or a control when a new record is created.
!!!Applies to ...
| !Object | !Control type when<br />in a (sub)form | !Control type when<br />in a ~GridControl | !Field type |!Description |
|[[Control]] |~CheckBox<br />[[ComboBox]]<br />~CurrencyField<br />~DateField<br />~FileControl<br />~FormattedField<br />[[ListBox]]<br />~NumericField<br />~PatternField<br />[[RadioButton]]<br />~SpinButton<br />~TextField<br />~TimeField | All | NA |A control on an open form |
|[[Field]] | NA | NA | Not applicable on<br />~AutoNumber fields<br />Binary and ~LongBinary fields |A field in a [[table|TableDef]], a [[query|QueryDef]] or a [[recordset|Recordset]] |
!!!Syntax
//control//{{{.DefaultValue}}}
//control//{{{.DefaultValue = }}}//value//
//field//{{{.DefaultValue}}}
//field//{{{.DefaultValue = }}}//value//
!!!Returned values / Arguments
{{{Variant}}} when //~DefaultValue// is a property of a //Control// object
{{{String}}} when //~DefaultValue// is a property of a //Field// object
!!!Remarks
*The //~DefaultValue// property is not applicable to //controls// belonging to a dialog.
*The //~DefaultValue// property of a //field// returns a null-length string if there is no default value.
*The //~DefaultValue// property of a //field// is read-only except if the field pertains to a [[table|TableDef]].
!!!Error messages
|Property '~DefaultValue' not applicable in this context |
|Value '...' is invalid for property '~DefaultValue' |
!!!Example
<<tiddler "DefaultValue example">></pre>
</div>
<div title="DefaultValue example" modifier="Jean-PierreLedure" created="201108051101" modified="201212071417" tags="[[Snippets of Code]]">
<pre>List the default value of all controls - if relevant - on an open form
//{{{
Dim ofForm As Object, ocControl As Object, i As Integer, iCount As Integer
Set ofForm = Forms("myForm")
iCount = ofForm.Controls.Count
For i = 0 To iCount - 1
Set ocControl = ofForm.Controls(i)
If hasProperty(ocControl, "DefaultValue") Then Print ocControl.Name & "=" & ocControl.DefaultValue
Next i
Print
//}}}</pre>
</div>
<div title="Definitions" modifier="Jean-Pierre Ledure" created="201106251405" modified="201106251408" tags="Menu">
<pre></pre>
</div>
<div title="Delete" modifier="Jean-Pierre Ledure" created="201307191705" modified="201408011512" tags="Methods" changecount="1">
<pre>Deletes the current record in an updatable [[Recordset object|Recordset]].
!!!Applies to ...
| !Object | !Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.Delete()}}}
!!!Returned value
{{{True}}} if success.
!!!Remarks
*A //Recordset// must contain a current record before you use //Delete//; otherwise, a run-time error occurs.
*In an updatable //Recordset// object, //Delete// removes the current record and makes it inaccessible. Although you can't edit or use the deleted record, it remains current. Once you move to another record, however, you can't make the deleted record current again. Subsequent references to a deleted record in a //Recordset// are invalid and produce an error.
!!!Error Messages
|Recordset or field is not updatable |
|Current row has been deleted by another process or user |
|Recordset update sequence error |
!!!See also
[[AddNew]]
[[CancelUpdate]]
[[Close|Close (method)]]
[[CloseAllRecordsets]]
[[Edit]]
[[OpenRecordset]]
[[Update]]
!!!Example
<<tiddler "Delete example">></pre>
</div>
<div title="Delete (table-query)" modifier="Jean-Pierre Ledure" created="201401171635" modified="201408011513" tags="Methods" changecount="1">
<pre>Erases a [[table|TableDef]] or a [[query|QueryDef]] object from the [[TableDefs]] or [[QueryDefs]] collections.
!!!Applies to ...
| !Object | !Description |
|[[TableDefs]] |The set of tables of the database. |
|[[QueryDefs]] |The set of queries of the database document (".odb" file). |
!!!Syntax
//database.~TableDefs()//{{{.Delete(}}}//tablename//{{{)}}}
//database.~QueryDefs()//{{{.Delete(}}}//queryname//{{{)}}}
| !Collection | !Argument | !Type |!Returned value |
|~TableDef |tablename | String |True if success.|
|~QueryDef |queryname |~|~|
!!!Remarks
*The //tablename// and //queryname// arguments are NOT case-sensitive.
*The database document is automatically saved after the table or query deletion.
!!!Error Messages
|Table/Query '...' not found |
|Method 'Collection.Delete' not applicable in this context |
!!!See also
[[QueryDefs]]
[[TableDefs]]
!!!Example
<<tiddler "Delete (table-query) example">></pre>
</div>
<div title="Delete (table-query) example" modifier="Jean-Pierre Ledure" created="201401171655" modified="201408011513" tags="[[Snippets of Code]]" changecount="1">
<pre>Erase a table from the database and a query from the database document.
//{{{
Dim oCollection As Object
Set oCollection = Application.CurrentDb().TableDefs()
oCollection.Delete("TempTable")
Set oCollection = Application.CurrentDb().QueryDefs()
oCollection.QueryDefs().Delete("NewQuery")
//}}}</pre>
</div>
<div title="Delete example" modifier="Jean-Pierre Ledure" created="201307191710" modified="201408011514" tags="[[Snippets of Code]]" changecount="1">
<pre>Delete the last record in a table
//{{{
Dim oRecordset As Object
Set oRecordset = Application.CurrentDb().OpenRecordset("Expenses")
With oRecordset
.MoveLast
.Delete
.mClose
End With
//}}}</pre>
</div>
<div title="Description" modifier="Jean-Pierre Ledure" created="201307211058" modified="201408011515" tags="Properties" changecount="1">
<pre>Returns the description of a field pertaining to a [[table|TableDef]], a [[query|QueryDef]] or a [[recordset|Recordset]]
!!!Applies to ...
| !Object |!Description |
|[[Field]] |The representation of a field of a table, a query or a recordset. |
!!!Syntax
//field//{{{.Description}}}
//field//{{{.Description}}} = //Value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
The //Description// property is visible in the //Description// column of the //Table Design// view of Base.
It is read-only except if the field pertains to a [[table|TableDef]].
!!!Error messages
|Value '...' is invalid for property 'Description' |
!!!See also
[[Name]]
[[DataType]]
!!!Example</pre>
</div>
<div title="Dfunctions example" modifier="Jean-Pierre Ledure" created="201108060839" modified="201108201455" tags="[[Snippets of Code]]">
<pre>Database functions
//{{{
Dim sLabel As String, sKey As String, sCategory As String
Dim dblAverage As Double, iCount As Integer, dblSum As Double
Dim dblMin As Double, dblMax As Double
Dim dblStdev As Double, dblStdevP As Double, dblVar As Double, dblVarP As Double
sKey = "27165"
sLabel = DLookup("[DESCRIPTION]", "[PRODUCTS]", "[PRODUCT CODE]='" & sKey & "'") ' SQL expects single quotes
sCategory = "METALLIC"
dblAverage = DAvg("[SALES PRICE]", "[PRODUCTS]", "[CATEGORY]='" & sCategory & "' AND [SALES PRICE]>0")
iCount = DCount("[SALES PRICE]", "[PRODUCTS]", "[CATEGORY]='" & sCategory & "' AND [SALES PRICE]>0")
dblSum = DSum("[SALES PRICE]", "[PRODUCTS]", "[CATEGORY]='" & sCategory & "' AND [SALES PRICE]>0")
' dblAverage should be = dblSum/iCount !!!
dblMin = DMin("[SALES PRICE]", "[PRODUCTS]", "[CATEGORY]='" & sCategory & "' AND [SALES PRICE]>0")
dblMax= DMax("[SALES PRICE]", "[PRODUCTS]", "[CATEGORY]='" & sCategory & "' AND [SALES PRICE]>0")
dblStdev = DStdev("[SALES PRICE]", "[PRODUCTS]", "[CATEGORY]='" & sCategory & "' AND [SALES PRICE]>0")
dblStdevP = DStdevP("[SALES PRICE]", "[PRODUCTS]", "[CATEGORY]='" & sCategory & "' AND [SALES PRICE]>0")
dblVar = DVar("[SALES PRICE]", "[PRODUCTS]", "[CATEGORY]='" & sCategory & "' AND [SALES PRICE]>0")
dblVarP = DVarP("[SALES PRICE]", "[PRODUCTS]", "[CATEGORY]='" & sCategory & "' AND [SALES PRICE]>0")
' Sqr(dblVar) should be = dblStdev !!!
//}}}</pre>
</div>
<div title="Dialog" modifier="YourName" created="201302011601" modified="201802231450" tags="Objects" changecount="8">
<pre>{{firstletter{
@@color:#930;A@@
}}} //Dialog// [[object|Object Model]] describes a dialog located in one of the accessible Basic libraries.
If the property [[IsLoaded]] returns //True// then the dialog is active.
!!!Functions returning a dialog object
| !Parent object | !Function | !Type | !Argument |!Description |
|[[Application]] |[[AllDialogs]] | [[Collection]] | Integer or String |{{{Application.AllDialogs("myDialog")}}} returns an object corresponding with the {{{myDialog}}} dialog |
||[[getObject]] || String |{{{getObject("Dialogs!myDialog")}}} returns an object corresponding with the {{{myDialog}}} dialog. {{{myDialog}}} must be active. |
!!!Properties
| !Property | !Type | !Read only | !Description or UNO object |
|[[Caption]] |||Specifies the text that appears in the title bar. |
|[[Height]] |||Specifies the height of the dialog. |
|[[IsLoaded]] || Y |True if dialog is active. |
|[[Name]] || Y |Specifies the real name of the dialog |
|[[ObjectType]] || Y |Returns "DIALOG" |
|[[Visible]] |||Shows or hides the dialog without making it inactive. |
|[[Width]] |||Specifies the width of the dialog. |
|~UnoDialog | UNO | Y |com.sun.star.awt.~XControl<br />The output of the //~CreateUnoDialog// Basic function. |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[EndExecute]] | returnvalue | Long |Stop the execution of the dialog and return //returnvalue//. |
|[[Execute|Execute (dialog)]] |||Display the dialog and interact with the user. |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the Dialog has the given property. |
|[[Move]] | coordinates |~|Return True if Dialog has been moved successfully. |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
|[[Start]] |||Initialize the dialog. |
|[[Terminate]] |||Close all processing concerning the actual dialog. |
!!!Remarks
Each //Dialog// [[object|Object Model]] has a Controls [[collection|Collection]], that contains all controls on the dialog. You can refer to a specific control on a dialog by referring to the [[Controls]] collection.
!!!Examples
<<tiddler "Dialog example">></pre>
</div>
<div title="Dialog example" modifier="Jean-Pierre Ledure" created="201302021505" modified="201405241611" tags="[[Snippets of Code]]" changecount="1">
<pre>Display a dialog
//{{{
Dim oDialog As Object, lExecute As Long
Const dlgOK = 1
Const dlgCancel = 0
oDialog = Application.AllDialogs("myDialog")
oDialog.Start
lExecute = oDialog.Execute
Select Case lExecute
Case dlgCancel ' Cancel button pressed
' ... do probably nothing ...
Case dlgOK ' OK button pressed
' ... process the dialog, all controls are still available
Case Else ' Dialog interrupted programmatically
' ... process the dialog based on the returned value
End Select
oDialog.Terminate
//}}}</pre>
</div>
<div title="DoCmd" modifier="Jean-Pierre Ledure" created="201301121050" modified="201510031305" tags="Objects" changecount="9">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~DoCmd// class is a secondary root class from which actions or commands are initiated..
The //~DoCmd// class must not be instantiated. The only preset instance MUST be called {{{DoCmd}}}. In fact it is implemented simply as a Basic module.
As an example, next statements are equivalent :
//{{{
RunCommand("DBDirectSQL")
//}}}
and
//{{{
DoCmd.RunCommand("DBDirectSQL")
//}}}
!!Methods
| !Method | !Description |
|[[ApplyFilter]] |Apply a filter, a query, or an SQL WHERE clause to a table, form, subform or query. |
|[[Close]] |Close an object (table, query, form or report). |
|[[CopyObject]] |Copy an existing query or table. |
|[[FindNext]] |Find the next instance of data that meets the criteria specified by the arguments of the last invoked //~FindRecord// action. |
|[[FindRecord]] |Find the first instance of data that meets the criteria specified by the //~FindRecord// arguments. |
|[[GetHiddenAttribute]] |Know if a named window is currently hidden or visible. |
|[[GoToControl]] |Move the focus to the named control in the active window. |
|[[GoToRecord]] |Make the specified record the current record in an open form |
|[[Maximize]] |Maximize the window containing the //Form// having the focus. |
|[[Minimize]] |Minimize the window containing the //Form// having the focus. |
|[[MoveSize]] |Move the active window to the coordinates specified by the argument values. |
|[[OpenForm]] |Open a form in normal view or in form design view. |
|[[OpenQuery]] |Open a query in normal view or in query design view. |
|[[OpenReport]] |Open a report in normal view or in report design view. |
|[[OpenSQL]] |Open a datasheet containing the data described by the provided SELECT SQL statement. |
|[[OpenTable]] |Open a table in normal view or in table design view. |
|[[OutputTo]] |Output the data in the specified object (currently only a form) to several output formats. |
|[[Quit]] |Quit //~OpenOffice/~LibreOffice Base//. |
|[[RunApp]] |Run an external application given by its command line. |
|[[RunCommand]] |Execute the command given as argument. |
|[[RunSQL]] |Execute the SQL statement given as argument. |
|[[SelectObject]] |Move the focus to the specified window. |
|[[SendObject]] |Output the data in the specified object (currently only a form) to several output formats and inserts it into an e-mail. |
|[[SetHiddenAttribute]] |Specify if a named window must be made hidden or visible. |
|[[SetOrderBy]] |Apply a sort to a table, form or datasheet. |
|[[ShowAllRecords]] |Remove any existing filters and sorts that may exist on the current table, query, or form. |
|[[SysCmd]] |Display a progress meter or specified text in the status bar. |</pre>
</div>
<div title="Edit" modifier="Jean-PierreLedure" created="201307191351" modified="201307211502" tags="Methods">
<pre>Copies the current record from an updatable [[Recordset object|Recordset]] to the edit buffer for subsequent editing.
!!!Applies to ...
| !Object | !Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.Edit()}}}
!!!Returned value
{{{True}}} if success.
!!!Remarks
*Once you use the //Edit// method, changes made to the current record's fields are copied to the copy buffer. After you make the desired changes to the record, use the [[Update method|Update]] to save your changes.
*After you modify the new record, use the [[Update]] method to save the changes and add the record to the //Recordset//. No changes occur in the database until you use the //Update// method.
**''Caution'' If you edit a record and then perform any operation that moves to another record, but without first using //Update//, your changes are lost without warning.
*The current record remains current after you use //Edit//.
!!!Error Messages
|Recordset or field is not updatable |
|Current row has been deleted |
!!!See also
[[AddNew]]
[[CancelUpdate]]
[[Close|Close (method)]]
[[CloseAllRecordsets]]
[[DefaultValue]]
[[Update]]
[[Value|Value (field)]]
!!!Example
<<tiddler "Edit example">></pre>
</div>
<div title="Edit example" modifier="Jean-Pierre Ledure" created="201307191355" modified="201405241104" tags="[[Snippets of Code]]" changecount="1">
<pre>Modify the last record in a table
//{{{
Dim oRecordset As Object
Set oRecordset = Application.CurrentDb().OpenRecordset("Expenses")
With oRecordset
.MoveLast
.Edit
.Fields("AMOUNT").Value = 4321
.Update
.mClose
End With
//}}}</pre>
</div>
<div title="EditMode" modifier="Jean-PierreLedure" created="201307130931" modified="201307131345" tags="Properties">
<pre>The //~EditMode// property returns a value that indicates the state of editing for the current record.
!!!Applies to ...
| !Object |!Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.EditMode}}}
!!!Returned values
|dbEditNone | Long |No editing operation is in progress. |
|dbEditInProgress |~|The [[Edit]] method has been invoked, and the current record is in the edit buffer. |
|dbEditAdd |~|The [[AddNew]] method has been invoked, and the current record in the edit buffer is a new record that hasn't been saved in the database. |
!!!Remarks
*The //~EditMode// property is read-only.
*The //~EditMode// property is useful when an editing process is interrupted, for example, by an error during validation. You can use the value of the //~EditMode// property to determine whether you should use the [[Update]] or [[CancelUpdate]] method.
*If useful you can insert next lines in your own code:
//{{{
REM Edit mode
Const dbEditNone = 0
Const dbEditInProgress = 1
Const dbEditAdd = 2
//}}}
!!!Error messages
!!!See also
[[AddNew]]
[[CancelUpdate]]
[[Edit]]
[[Recordset]]
[[Update]]
!!!Example</pre>
</div>
<div title="EmployeesTable" modifier="Jean-Pierre Ledure" created="201212221318" modified="201511211416" tags="HowTo" changecount="1">
<pre>*Employees table
| !Fields | !Field Type | !Primary |
|Address | Text ||
|~BirthDate | Date/Time ||
|City | Text ||
|Country | Text ||
|Extension | Integer ||
|~FirstName | Text ||
|~HireDate | Date/Time ||
|~HomePhone | Text ||
|~LastName | Text ||
|Notes | Text ||
|Photo | Text ||
|~PostalCode | Text ||
|Region | Text ||
|~ReportsTo | ~BigInt ||
|Title | Text ||
|~TitleOfCourtesy | Text ||
|~EmployeeID | ~BigInt | Y |</pre>
</div>
<div title="Enabled" modifier="Jean-PierreLedure" created="201108051443" modified="201306151420" tags="Properties">
<pre>The //Enabled// property specifies if the control is accessible with the cursor.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~HiddenControl<br />[[SubForm]]-- | All | All |A control on an open form or dialog |
!!!Syntax
//control//{{{.Enabled}}}
//control//{{{.Enabled = }}}//value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
!!!Error messages
|Property 'Enabled' not applicable in this context |
|Value '...' is invalid for property 'Enabled' |
!!!See also
[[Locked]]
!!!Example
<<tiddler "Enabled & Locked example">></pre>
</div>
<div title="Enabled & Locked example" modifier="Jean-PierreLedure" created="201108051456" modified="201212071425" tags="[[Snippets of Code]]">
<pre>Lock and disable control
//{{{
Dim ocControl As Object
Set ocControl = Controls("myForm", "myControl")
ocControl.Enabled = False
ocControl.Locked = True
//}}}</pre>
</div>
<div title="EndExecute" modifier="Jean-Pierre Ledure" created="201302021547" modified="201405241107" tags="Methods" changecount="1">
<pre>The //~EndExecute// method interrupts programmatically the display of the specified [[dialog|Dialog]] and transfers a value to be returned by the interrupted [[Execute|Execute (dialog)]] method.
!!!Applies to ...
| !Object | !Description |
|[[Dialog]] |The representation of a Basic dialog |
!!!Syntax
//dialog//.{{{EndExecute(}}}//returnvalue//{{{)}}}
| !Argument | !Type |!Description |
| returnvalue | //Long// |The value that will return the pending [[Execute|Execute (dialog)]] method applied to the //Dialog// object |
!!!Remarks
*The //~EndExecute// method must be preceeded with the [[Execute|Execute (dialog)]] method applied on the same object.
*The //~EndExecute// method is usually triggered from a //dialog// or //control// event linked to the concerned dialog box.
!!!Error messages
|Dialog unknown |
|Dialog not yet started |
!!!See also
[[AllDialogs]]
[[Execute|Execute (dialog)]]
[[Start]]
[[Terminate]]
!!!Example
<<tiddler "Dialog example">></pre>
</div>
<div title="EnumerateControls" modifier="Jean-PierreLedure" created="201205010601" modified="201308161011" tags="HowTo">
<pre>(Q) How can I cycle through the controls on a form and retrieve their names?
(R) Use the following function as an example. Pass the form's name to it and watch the displayed result.
Note: Make sure you also copy [[bIsLoaded|FindOutFormOpen]] function since fEnumControls uses it internally to make sure that the form to be enumerated is open.
//{{{
Sub fEnumControls(ByVal sFrmToEnum As String)
'Display control's Type and Name
'will NOT enumerate controls within an embedded subform
'if form is closed, exit function
Const vbCritical = 16
If Not bIsLoaded(sFrmToEnum) Then
MsgBox "Form " & sFrmToEnum & " is probably closed!! " & _
"Please open it & try again.", vbCritical
Exit Sub
End If
Dim oForm As Object, oControl As Object, iCount As Integer, i As Integer
Set oForm = Forms(sFrmToEnum)
'Count the number of controls
iCount = oForm.Controls().Count
For i = 0 To iCount - 1
Set oControl = oForm.Controls(i)
DebugPrint oControl.SubType & ":", oControl.Name
Next i
End Sub
//}}}
!!!See also
[[Forms]]
[[Controls]]
[[Count]]
[[Name]]
[[SubType]]
[[DebugPrint]]</pre>
</div>
<div title="Error Handler" modifier="Jean-Pierre Ledure" created="201108061445" modified="201408031021" tags="[[Error handling]]" changecount="5">
<pre>!!!Introduction
~Access2Base uses internally an error handler that can be optionally used by users in their own code.
The principles are:
*An error has an __error-level__. The error-level determines the severity of the error and the behaviour of the program after the error trap: stop or go ahead ?
*All errors, whatever their level, can be registered on the request of the programmer. The technique used by ~Access2Base is to keep the error //traces// in memory through a //circular buffer//, i.e. a buffer where the oldest entries are replaced by the new ones when the buffer gets full.
*The error traces (circular buffer) can be viewed for debugging purposes in what is called the ''~Access2Base Console'' dialog box.
*All the user-defined Subs or Functions follow the same code structure for error handling.
!!!To view the errors log
*If //~Access2Base// is included in the software, run next code, either directly in the Basic IDE or via a toolbar button, or ...
//{{{
Sub Console()
TraceConsole()
End Sub
//}}}
*If //~Access2Base// has been installed as a separate extension, then execute next menu command
>{{{Tools + Add-Ons + Access2Base Console ...}}}
in the Basic IDE.
!!!API
The routines for error handling are:
|[[TraceConsole]] |Open the //Console// dialog box for display of all past errors and logs. |
|[[TraceError]] |Report an error found. |
|[[TraceLevel]] |Set the minimal level of errors to be reported in the console. |
|[[TraceLog]] |Log an event in the circular buffer if its level is at least equal to the minimal error level. |
|DebugPrint |Record as many values as wanted in tabular form in the circular buffer, typically for debugging. |
!!!Error levels
| !Level | !Type |!Description |
|"DEBUG" | String |To report values of variables during the program execution. Such reported errors are NOT user visible. |
|"INFO" |~|To report any event |
|"WARNING" |~|To report some abnormal event. |
|"ERROR" |~|To report an error trapped by a user program. |
|"FATAL" |~|To report an error caused by a user program but detected by ~Access2Base (f.i. "Form does not exist ..." etc.). |
|"ABORT" |~|To report an error inside the ~Access2Base API itself. Do not use for programmer or user errors. |
!!!Recommended program structure for error handling
The example is given for a //Sub//. It is, mutatis mutandis, equally valid for a //Function//.
//{{{
Sub mySub
On Local Error Goto Error_Sub
...
Exit_Sub:
Exit Sub
Error_Sub:
TraceError("ERROR", Err, "MySub", Erl)
Goto Exit_Sub
End Sub
//}}}
In case of error next message will be displayed to the user and simultaneously registered in the trace buffer:
>Error # //number// (//...description...//) occurred at line //line// in mySub.</pre>
</div>
<div title="Error handling" modifier="Jean-Pierre Ledure" created="201108061447" tags="Menu">
<pre></pre>
</div>
<div title="Event" modifier="YourName" created="201110010725" modified="201802231708" tags="Objects [[Events handling]]" changecount="11">
<pre>The {{{Event}}} [[object|Object Model]] describes an event occurred typically from within a form or a form control, a dialog or a dialog control, or fired from elsewhere.
!!!Functions returning an //Event// object
| !Parent object | !Function | !Type | !Arguments |!Description |
|[[Application]] |[[Events]] | [[Collection]] | the //event// object passed by ~OpenOffice/~LibreOffice<br />as argument of a document, form, subform or control event |{{{Application.Events(oEvent)}}} returns an //Event// object. |
!!!Properties of an //Event// object
| !Property | !Type | !Description |
|~EventType | String |See the [[events handler|Events Handler]]. |
|~EventName | String |The following //~EventNames// are commonly available:<br />//~OnAlphaCharInput, ~OnClick, ~OnCloseApp, ~OnCopyTo, ~OnCopyToDone, ~OnCreate, ~OnError, ~OnFocus, ~OnInsertDone, ~OnInsertStart, ~OnLoad, ~OnLoadCancel, ~OnLoadDone, ~OnLoadError, ~OnLoadFinished, ~OnMailMerge, ~OnMailMergeFinished, ~OnModifyChanged, ~OnMouseOut, ~OnMouseOver, ~OnMove, ~OnNew, ~OnNewMail, ~OnNonAlphaCharInput, ~OnPageCountChange, ~OnPrepareUnload, ~OnPrepareViewClosing, ~OnPrint, ~OnResize, ~OnSave, ~OnSaveAs, ~OnSaveAsDone, ~OnSaveDone, ~OnSaveFinished, ~OnSelect, ~OnStartApp, ~OnSubComponentClosed, ~OnSubComponentOpened, ~OnTitleChanged, ~OnToggleFullscreen, ~OnUnfocus, ~OnUnload, ~OnViewClosed, ~OnViewCreated.// |
|~ContextShortcut | String |The [[shortcut notation|ShortCut Notation]] of the object (form, dialog or control) having triggered the event. |
|~ButtonLeft<br />~ButtonRight<br />~ButtonMiddle | Boolean |Indicates if the mouse button has been pressed .|
|~XPos<br />~YPos | Null or Long |Coordinates of the mouse cursor. |
|~ClickCount | Long |Number of mouse clicks. |
|~KeyCode | Integer |See the constants group {{{com.sun.star.awt.Key}}} |
|~KeyChar | String |The pressed key. |
|~KeyFunction | Integer |See the constants group {{{com.sun.star.awt.KeyFunction}}} |
|~KeyAlt<br />~KeyCtrl<br />~KeyShift | Boolean |Key combined with Alt, Ctrl or Shift keys. |
|~FocusChangeTemporary | Boolean |False if focus change due to a user action in same window. |
|[[ObjectType]] | String |Returns "EVENT" |
|~RowChangeAction | Long |See the constants group {{{com.sun.star.sdb.RowChangeAction}}} |
|Recommendation | String |"IGNORE" if the event is recommended to be ignored. Valid only for the //Before record action// form event which is, for strange reasons, fired twice. The first time is recommended to be ignored. |
|Source | Object |Return the [[Database]], [[Form]], [[SubForm]], [[Dialog]] or [[Control]] object having fired the event |
|~SubComponentName | String |The name of the component being //opened// or //closed// while executing a //Loaded a sub component// or //Closed a sub component// event. Such an event is set thru the {{{Tools + Customize ... + Events}}} menu command. |
|~SubComponentType | Long |To be associated with the //~SubComponentName// property. Returns one of next constants:<br />//acTable<br />acQuery<br />acForm<br />acReport// |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the Event has the given property. |
!!!Remarks
*All properties are read-only.
*Their values are accessible with the usual syntax<br />//oEvent//{{{.property}}}
*The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acForm = 2
Const acQuery = 1
Const acReport = 3
Const acTable = 0
//}}}
!!!See also
[[Events Handler]]
[[Events]]
!!!Example
<<tiddler "Event example">>
</pre>
</div>
<div title="Event example" modifier="Jean-PierreLedure" created="201109031336" modified="201212231012" tags="[[Snippets of Code]]">
<pre>Assign next macro to the //~TextModified// event of a combo box (other controls could require that the //Changed// event should be used for the same purpose).
When the user changes his/her selection in the combo box the content of the form is requeried and refreshed on the screen.
//{{{
Sub SelectChanged(poEvent As Object)
REM Combo value has changed
REM => requery form
Dim oeEvent As Object, ocCombo As Object, sSQL As String, oForm As Object
Set oeEvent = Events(poEvent)
Set ocCombo = oeEvent.Source
sSQL = "SELECT [PRODUCT CODE],[DENOMINATION],[SUPPLIER ID] FROM PRODUCTS WHERE " _
& "[SUPPLIER ID]='" & ocCombo.Value & "'"
Set oForm = Forms("myComboForm")
oForm.RecordSource = sSQL
End Sub
//}}}</pre>
</div>
<div title="Events" modifier="Jean-Pierre Ledure" created="201109031107" modified="201607311234" tags="[[Events handling]] Collections" changecount="5">
<pre>The {{{Events}}} collection returns the (unique) instance of the currently executed [[event object|Event]].
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]Events(}}}//event//{{{)}}}
The //event// argument is the variable of {{{Variant/Object}}} type given as argument by ~OpenOffice/~LibreOffice to the macro invoked when the event occurs.
!!!Returned values
Either
- {{{Nothing}}} (to be tested with the {{{IsNull()}}} Basic builtin function) when the event is not really an event or it was triggered by an unsupported event type - or some other error occurred (the call to {{{Events()}}} never stops the execution of the macro). In particular, when the event has been triggered by a toolbar button;
or
- an object of type //Event//.
!!!See also
[[Events Handler]]
[[Event]]
!!!Example
<<tiddler "Event example">>
</pre>
</div>
<div title="Events Handler" modifier="Jean-Pierre Ledure" created="201109030954" modified="201610161007" tags="[[Events handling]]" changecount="3">
<pre>{{firstletter{
@@color:#930;E@@
}}}''vents'' can automatically execute a macro when a specified software event occurs by assigning the desired macro to the event. The macros might be defined at database document, [[form|Form]], [[subform|SubForm]], [[dialog|Dialog]], [[control|Control]], menu item or toolbar button level. The triggered macro has one argument of type //Object//.
The //Events Handler// of //~Access2Base// provides a mean to standardize the processing of events and to increase the reusability of macros: indeed the same macro could be used for several controls - if meaningful, of course - as there is an easy way to identify the control which triggered the macro.
''Note that the described technique has nothing in common with the events processing in //~MSAccess//.''
!!!Step by step
#Assign the event to a macro: see the ~LibreOffice/~OpenOffice Help or documentation.
#In the code of the macro invoke the [[Events]] collection. Note that the macro may be a {{{Sub}}} or a {{{Function}}} depending on the necessity or not to return the value {{{False}}} to cancel the event.
#Use the properties of the returned object to process the event. In particular the //Source// property.
//{{{
Sub myEventMacro(poEvent As Object)
Dim oeEvent As Object, myControl As Object
Set oeEvent = Events(poEvent)
Set myControl = oEvent.Source ' Return the Control object
' that triggered the event
REM ...
End Sub
//}}}
!!!Event types
The types of events supported by the ~Access2Base API are listed below. See the ~OpenOffice/~LibreOffice documentation for more details.
The invocation of {{{Events()}}} returns a {{{Null}}} value when other event types occur.
| !Event type | !Description |
|DOCUMENTEVENT |At document (database) level. |
|EVENTOBJECT |Generic for most //form// and //control// events. |
|ACTIONEVENT |Triggered by a button, ... |
|FOCUSEVENT |Triggered by a focus change. |
|INPUTEVENT |Use of special keys. |
|ITEMEVENT |Action in menu or listbox. |
|KEYEVENT |Use of normal keys. |
|MOUSEEVENT |Mouse move or click. |
|ROWCHANGEEVENT |Insert, update or delete action. |
|TEXTEVENT |Edition of //control// content. |
!!!See also
[[Events]]
[[Event]]
[[getObject]]
!!!Example
<<tiddler "Event example">>
</pre>
</div>
<div title="Events handling" modifier="Jean-Pierre Ledure" created="201109030955" tags="Menu">
<pre> </pre>
</div>
<div title="Execute (commandbarcontrol)" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201507251409" modified="201507251417" tags="Methods" changecount="4">
<pre>The //Execute// method executes the command or script associated with acontrol in a toolbar.
!!!Applies to ...
| !Object | !Description |
|[[CommandBarControl]] |The representation of control in a [[CommandBar]]. |
!!!Syntax
//commandbarcontrol//.{{{Execute}}}
!!!Returned value
{{{True}}} if success
!!!Remarks
The //Execute// method may be preceded with the [[OnAction]] property of the same object.
!!!Error messages
!!!See also
[[CommandBar]]
[[CommandBarControl]]
[[OnAction]]
[[RunCommand]]
!!!Example
<<tiddler "CommandBarControl example">></pre>
</div>
<div title="Execute (dialog)" modifier="Jean-Pierre Ledure" created="201302021438" modified="201405241108" tags="Methods" changecount="1">
<pre>The //Execute// method displays the specified [[dialog|Dialog]].
!!!Applies to ...
| !Object | !Description |
|[[Dialog]] |The representation of a Basic dialog |
!!!Syntax
//dialog//.{{{Execute}}}
| !Returned values | !Type |!Description |
|//dlgOK// ||if OK button pressed |
|//dlgCancel// |~|if Cancel button pressed or dialog closed with the Window close button |
|Any | //Long// |The argument of the [[EndExecute]] method having requested the dialog closure |
!!!Remarks
*The //Execute// method must be preceeded with the [[Start]] method on the same object.
*Return values can be incorporated in your code by copying/pasting next lines:
//{{{
Const dlgOK = 1 ' OK button pressed
Const dlgCancel = 0 ' Cancel button pressed
//}}}
!!!Error messages
|Dialog unknown |
|Dialog not yet started |
!!!See also
[[AllDialogs]]
[[EndExecute]]
[[Start]]
[[Terminate]]
!!!Example
<<tiddler "Dialog example">></pre>
</div>
<div title="Execute (query)" modifier="Jean-PierreLedure" created="201306151539" modified="201308250748" tags="Methods">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //Execute// method executes the SQL statement contained in a query. The statement must execute an action. Examples of such statements are: INSERT INTO, DELETE, SELECT...INTO, UPDATE, CREATE TABLE, ALTER TABLE, DROP TABLE, CREATE INDEX, or DROP INDEX.
!!!Applies to
| !Object | !Description |
|[[QueryDef]] |The representation of a stored query. |
!!!Syntax
{{{querydef.Execute(options)}}}
| !Argument | !Optional | !Type |!Description |
|{{{options}}} | Yes | Integer<br />Long |If the argument is present its only allowed value = dbSQLPassThrough.<br />Forces escape substitution before sending the SQL statement to the database. |
The method returns False if the execution of the SQL statement failed.
!!!Remarks
To include the constant in your own code, copy and paste next line:
//{{{
Const dbSQLPassThrough = 64
//}}}
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|SQL Error, SQL statement = '...' |
!!!See also
[[OpenSQL]]
[[RunSQL]]
[[OpenQuery]]
[[SQL]]
!!!Example
<<tiddler "Execute query example">></pre>
</div>
<div title="Execute query example" modifier="Jean-PierreLedure" created="201306151605" modified="201306151606" tags="[[Snippets of Code]]">
<pre>Delete an existing table and execute a stored query that recreates the table
//{{{
Dim oQuery As Object
DoCmd.RunSQL("DROP TABLE IF EXISTS [TEST_TABLE]")
Set oQuery = Application.CurrentDb().QueryDefs("CreateTestTable")
oQuery.Execute
'Refresh the list of tables in the database window
Const acDatabaseWindow = 102
DoCmd.SelectObject acDatabaseWindow
DoCmd.RunCommand "DBRefreshTables"
//}}}
The SQL contained in the query is ...
//{{{
CREATE TABLE TEST_TABLE
(COL1 INTEGER NOT NULL,
COL2 CHAR(25),
COL3 VARCHAR(25),
COL4 DECIMAL(10,2) NOT NULL,
COL5 DATE,
PRIMARY KEY (COL1))
//}}}</pre>
</div>
<div title="ExploreTables" modifier="Jean-Pierre Ledure" created="201312311108" modified="201408011515" tags="HowTo" changecount="1">
<pre>(Q) How can I list table and field names, and use them in my code ?
(R) We will present 2 techniques. a generic one which uses the ~Access2Base API for exploring //~TableDefs//, and a second, which is specific to HSQLDB, which runs SQL statements on the database schema.
!!!An easy solution is to use the [[TableDefs]] and [[Fields]] collections and their objects.
Here a simple list of tables with their fields and types:
//{{{
Sub ScanTables()
Dim oDatabase As Object, oTable As Object, oField As Object
Dim i As Integer, j As Integer
Set oDatabase = Application.CurrentDb()
With odatabase
For i = 0 To .TableDefs.Count - 1
Set oTable = .TableDefs(i)
DebugPrint oTable.Name
For j = 0 To oTable.Fields.Count - 1
Set oField = oTable.Fields(j)
DebugPrint "", LongStr(oField.Name), LongStr(oField.TypeName), oField.Size
Next j
Next i
End With
End Sub
Function LongStr(psString As String) As String
Const cstLength = 20
LongStr = Left(psString & Space(cstLength), cstLength)
End Function
//}}}
Note that the //~LongStr// function is there only to have the output cleanly aligned in columns.
The output will be something like:
//{{{
Categories
CategoryName VARCHAR 50
Description VARCHAR 2147483647
Picture BINARY 2147483647
CategoryID BIGINT 0
Customers
Address VARCHAR 50
City VARCHAR 50
CompanyName VARCHAR 50
ContactName VARCHAR 50
ContactTitle VARCHAR 50
Country VARCHAR 50
CustomerID VARCHAR 50
Fax VARCHAR 50
Phone VARCHAR 50
PostalCode VARCHAR 50
Region VARCHAR 50
Employees
Address VARCHAR 50
etc ...
//}}}
!!!Solution by exploring the database schema directly (HSQLDB only)
Not surprisingly __reading the HSQLDB documentation__ will help understand the following examples.
Running next code
//{{{
Sub ScanSchemaSQL()
Dim sSql As String
sSql = "SELECT [TABLE_NAME],[COLUMN_NAME],[SYSTEM_COLUMNS].[TYPE_NAME],[COLUMN_SIZE] " _
& "FROM [INFORMATION_SCHEMA].[SYSTEM_TABLES],[INFORMATION_SCHEMA].[SYSTEM_COLUMNS] " _
& "WHERE [TABLE_SCHEM]='PUBLIC' AND [SYSTEM_COLUMNS].[TABLE_NAME]=[SYSTEM_TABLES].[TABLE_NAME]"
OpenSQL(sSql, dbSQLPassThrough)
End Sub
//}}}
produces the result displayed below:
//{{{
TABLE_NAME COLUMN_NAME TYPE_NAME COLUMN_SIZE
Categories CategoryName VARCHAR 50
Categories Description VARCHAR 2147483647
Categories Picture BINARY 2147483647
Categories CategoryID BIGINT
Customers Address VARCHAR 50
Customers City VARCHAR 50
Customers CompanyName VARCHAR 50
Customers ContactName VARCHAR 50
Customers ContactTitle VARCHAR 50
Customers Country VARCHAR 50
Customers CustomerID VARCHAR 50
Customers Fax VARCHAR 50
Customers Phone VARCHAR 50
Customers PostalCode VARCHAR 50
Customers Region VARCHAR 50
Employees Address VARCHAR 50
etc ...
//}}}
The same results can also be explored programmatically:
//{{{
Sub ScanSchema()
Dim oRecordset As Object, sSql As String, iNbFields As integer
sSql = "SELECT [TABLE_NAME],[COLUMN_NAME],[SYSTEM_COLUMNS].[TYPE_NAME],[COLUMN_SIZE] " _
& "FROM [INFORMATION_SCHEMA].[SYSTEM_TABLES],[INFORMATION_SCHEMA].[SYSTEM_COLUMNS] " _
& "WHERE [TABLE_SCHEM]='PUBLIC' AND [SYSTEM_COLUMNS].[TABLE_NAME]=[SYSTEM_TABLES].[TABLE_NAME]"
Set oRecordset = Application.CurrentDb().OpenRecordset(sSql, , dbSQLPassThrough, dbReadOnly)
With oRecordset
iNbFields = .Fields.Count
Do While Not .EOF()
DebugPrint LongStr(.Fields("TABLE_NAME").Value) _
, LongStr(.Fields("COLUMN_NAME").Value) _
, LongStr(.Fields("TYPE_NAME").Value) _
, .Fields("COLUMN_SIZE").Value
.MoveNext()
Loop
End With
End Sub
//}}}
produces once again the same result as before ...
//{{{
Categories CategoryName VARCHAR 50
Categories Description VARCHAR 2147483647
Categories Picture BINARY 2147483647
Categories CategoryID BIGINT [NULL]
Customers Address VARCHAR 50
Customers City VARCHAR 50
Customers CompanyName VARCHAR 50
Customers ContactName VARCHAR 50
Customers ContactTitle VARCHAR 50
Customers Country VARCHAR 50
Customers CustomerID VARCHAR 50
Customers Fax VARCHAR 50
Customers Phone VARCHAR 50
Customers PostalCode VARCHAR 50
Customers Region VARCHAR 50
Employees Address VARCHAR 50
etc ...
//}}}
!!!See also
[[DebugPrint]]
[[Fields]]
[[OpenSQL]]
[[Recordsets]]
[[TableDefs]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|Dictionary |||||Run one of the proposed Subs. They do not need any form or control event. |</pre>
</div>
<div title="ExportImages" modifier="Jean-PierreLedure" created="201308161612" modified="201308161615" tags="HowTo">
<pre>(Q) Can I export the content of database binary fields somewhere to the file system ?
(R) Use the [[WriteAllBytes]] method. It's exactly its purpose !
Let's consider next table:
<<tiddler "CategoriesTable">>
Run next Sub. The assumption is that each file in the directory has a name corresponding with the name of the category (after having substituted "/" in category names by a space).
//{{{
Sub ExportImages(psPath As String)
Dim oTable As Object, oRecordset As Object, sCatName As String
Set oTable = Application.CurrentDb().TableDefs("CATEGORIES")
Set oRecordset = oTable.OpenRecordset()
With oRecordset
Do While Not .EOF()
sCatName = Join(Split(.Fields("CATEGORYNAME").Value, "/"), " ")
.Fields("Picture").WriteAllBytes(psPath & sCatName & ".png")
.MoveNext
Loop
.mClose()
End With
End Sub
//}}}
!!!See also
[[Fields]]
[[OpenRecordset]]
[[Recordset]]
[[TableDefs]]
[[ReadAllBytes]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|Images |||||Adapt the //path// argument and run the //Main// Sub from the Basic IDE. |</pre>
</div>
<div title="ExtractDataTable" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201405311502" modified="201405311546" tags="HowTo" changecount="10">
<pre>(Q) How do I get data from a database table into my Basic application ?
(R) After you have located a particular record or records, you may want to extract data to use in your application. 2 methods are proposed: a single value or bulk data.
Let's consider next table:
<<tiddler "OrdersTable">>
!!!Copying a Single Field
You can copy a single field of a record to a variable of the appropriate data type. The following example extracts three fields from the first record in a [[Recordset object|Recordset]].
//{{{
Dim odbNorthwind As Object
Dim orsOrders As Object
Dim dOrderDate As Date
Dim sShipAddress As String
Dim sShipCity As String
Set odbNorthwind = Application.CurrentDb
Set orsOrders = odbNorthwind.OpenRecordset("Orders")
With orsOrders
.MoveFirst
dOrderDate = .Fields("OrderDate").Value
sShipAddress = .Fields("ShipAddress").Value
sShipCity = .Fields("ShipCity").Value
.mClose()
End With
//}}}
!!!Copying Entire Records to an Array
To copy one or more records, you can create a two-dimensional array and copy records one at a time. You increment the first subscript for each record and the second subscript for each field.
A fast way to do this is to use the [[GetRows method|GetRows]], which returns a two-dimensional array. The first subscript identifies the row and the second identifies the field number, as follows.
//{{{
vRecords(iRecord, iField)
//}}}
The following code example uses an SQL statement to retrieve three fields from a table into a //Recordset// object. It then uses the //~GetRows// method to retrieve the first three records of the //Recordset//, and it stores the selected records in a two-dimensional array. It then prints each record, one field at a time, by using the two array indexes to select specific fields and records.
//{{{
Sub ExtractDataTableBulk()
Dim odbNorthwind As Object
Dim orsOrders As Object
Dim vRecords As Variant
Dim iNumRows As Integer
Dim iNumColumns As Integer
Dim iRow As Integer
Dim iColumn As Integer
Dim sSQL As String
On Local Error GoTo ErrorHandler
Set odbNorthwind = Application.CurrentDb
sSQL = "SELECT [OrderDate],[ShipAddress],[ShipCity] FROM Orders"
Set orsOrders = odbNorthwind.OpenRecordset(sSQL)
vRecords = orsOrders.GetRows(10)
iNumRows = UBound(vRecords, 1) + 1
iNumColumns = UBound(vRecords, 2) + 1
For iRow = 0 To inumRows - 1
For iColumn = 0 To iNumColumns - 1
DebugPrint vRecords(iRow, iColumn)
Next iColumn
Next iRow
orsOrders.mClose()
Set orsOrders = Nothing
Exit Sub
ErrorHandler:
TraceError("ERROR", Err, "ExtractDataTableBulk", Erl)
End Sub
//}}}
You can use subsequent calls to the //~GetRows// method if more records are available. Because the array is filled as soon as you call the GetRows method, you can see why this approach is much faster than copying one field at a time.
Notice also that you do not have to declare the Variant as an array, because this is done automatically when the GetRows method returns records.
If you are trying to retrieve all the rows by using multiple //~GetRows// calls, use the [[EOF|BOF, EOF]] property to be sure that you are at the end of the //Recordset//. The //~GetRows// method may return fewer rows than you request. If you request more than the remaining number of rows in a //Recordset//, the //~GetRows// method returns only the rows that remain.
Because the //~GetRows// method always returns all the fields in the //Recordset// object, you may want to create a query that returns just the fields that you need. This is especially important for LONGVARBINARY and LONGVARCHAR (Memo) fields.
!!!See also
[[DebugPrint]]
[[OpenRecordset]]
[[TraceError]]
!!!Refer to ...
| !Basic module | !Sub |!Comments |
|~HowTo |~ExtractDataTable1Field ||
|~|~ExtractDataTableBulk ||</pre>
</div>
<div title="Field" modifier="Jean-Pierre Ledure" created="201306291409" modified="201508291730" tags="Objects" changecount="7">
<pre>{{firstletter{
@@color:#930;A@@
}}} //field// [[object|Object Model]] describes one of the fields of a [[table|TableDef]], a [[query|QueryDef]] or a [[recordset|Recordset]]. Each field will be retrieved as a member of the [[Fields]] [[collection|Collection]] of its corresponding parent.
!!!Functions returning a field object
| !Parent object | !Function | !Type | !Arguments |!Short example |
|[[Recordset]]<br />[[QueryDef]]<br />[[TableDef]] |[[Fields]] | [[Collection]] | None<br />Integer, Long<br />String |{{{Application.CurrentDb().TableDefs("myTable").Fields("myField")}}}<br />returns an object of type {{{Field}}} referring to the {{{myField}}} field in the {{{myTable}}} table. |
!!!Field types
The distinct field types can be recognized thru the use either of the [[DataType]] (long), the [[DbType|DataType]] (integer) or the [[TypeName|DataType]] (string) properties. The //~DbType// property is proposed in //~Access2Base// for compatibility with ~MSAccess.
See the correspondence table below.
<<tiddler "FieldTypesList">>
!!!Properties
| !Property | !Type | !Read only |!Description or UNO object |
|[[DataType]] || Y |Specifies the //AOO/~LibO// type of the data as an integer value |
|[[DbType|DataType]] || Y |Specifies the //~MsAccess// type of the data as an integer value |
|[[DefaultValue]] |||Returns the value stored in a new record |
|[[Description]] |||A summary description of the field |
|[[FieldSize]] || Y |Returns the number of bytes used in the database of a Memo or Long Binary field |
|[[Name]] || Y |The exact name of the field |
|[[ObjectType]] || Y |Always "FIELD" |
|[[Size]] || Y |The maximum size of the field |
|[[SourceField]] || Y |Indicates the name of the field that is the original source of the data for the field |
|[[SourceTable]] || Y |Indicates the name of the table that is the original source of the data for the field |
|[[TypeName|DataType]] || Y |Specifies the //AOO/~LibO// type of the data as a string |
|[[Value|Value (field)]] |||The value stored or to be stored in the field |
|Column | UNO | Y |com.sun.star.sdb.~OTableColumnWrapper<br />org.openoffice.comp.dbaccess.~OQueryColumn<br />com.sun.star.sdb.~ODataColumn |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the Field has the given property. |
|[[ReadAllBytes]] | filename |~|Store a binary file in a binary field |
|[[ReadAllText]] | filename |~|Store a text file in a memo field |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
|[[WriteAllBytes]] | filename |~|Copy a binary field into a file |
|[[WriteAllText]] | filename |~|Copy a memo field into a file |
!!!Remarks
!!!Example
<<tiddler "DataType example">></pre>
</div>
<div title="FieldSize" modifier="Jean-PierreLedure" created="201307211104" modified="201308161525" tags="Properties">
<pre>Returns the number of bytes used in the database (rather than in memory) of a Memo or Long Binary [[Field object|Field]] in the [[Fields collection|Fields]] of a [[Recordset object|Recordset]].
!!!Applies to ...
| !Object |!Description |
|[[Field]] |The representation of a field of a recordset. |
!!!Syntax
//field//{{{.FieldSize}}}
!!!Returned values
{{{Long}}}
!!!Remarks
*The //~FieldSize// property is read-only.
*Because the size of a Long Binary or Memo field can exceed 64K, you should assign the value returned by //~FieldSize// to a variable large enough to store a {{{Long}}} variable.
*To determine the size of a [[Field object|Field]] other than Memo and Long Binary types, use the [[Size property|Size]]. The //FieldSize// property returns in this case an {{{EMPTY}}} value.
!!!Error messages
|Property '~FieldSize' not applicable in this context |
!!!See also
[[DataType]]
[[Size]]
!!!Example</pre>
</div>
<div title="FieldTypesList" modifier="Jean-Pierre Ledure" created="201306291417" modified="201512271516" tags="NoTag" changecount="8">
<pre>| !~DataType | !~DbType | !~TypeName |
|com.sun.star.sdbc.~DataType.BIT | dbBoolean | BIT<br />BOOL |
|com.sun.star.sdbc.~DataType.BOOLEAN | dbBoolean | BOOLEAN |
|com.sun.star.sdbc.~DataType.TINYINT | dbInteger | TINYINT |
|com.sun.star.sdbc.~DataType.SMALLINT | dbLong | SMALLINT |
|com.sun.star.sdbc.~DataType.INTEGER | dbLong | INTEGER<br />INT<br />MEDIUMINT |
|com.sun.star.sdbc.~DataType.BIGINT | dbBigInt | BIGINT |
|com.sun.star.sdbc.~DataType.FLOAT | dbFloat | FLOAT<br />REAL |
|com.sun.star.sdbc.~DataType.REAL | dbSingle | REAL |
|com.sun.star.sdbc.~DataType.DOUBLE | dbDouble | DOUBLE<br />DOUBLE PRECISION<br />REAL |
|com.sun.star.sdbc.~DataType.NUMERIC | dbNumeric | NUMERIC |
|com.sun.star.sdbc.~DataType.DECIMAL | dbDecimal | DECIMAL |
|com.sun.star.sdbc.~DataType.CHAR | dbChar | CHAR<br />CHARACTER |
|com.sun.star.sdbc.~DataType.VARCHAR | dbText | VARCHAR<br />~VARCHAR_IGNORECASE<br />NVARCHAR<br />ENUM<br />SET |
|com.sun.star.sdbc.~DataType.LONGVARCHAR | dbMemo | LONGVARCHAR<br />LONG VARCHAR<br />TEXT<br />TINY TEXT<br />MEDIUM TEXT<br />LONG TEXT |
|com.sun.star.sdbc.~DataType.DATE | dbDate | DATE |
|com.sun.star.sdbc.~DataType.TIME | dbTime | TIME |
|com.sun.star.sdbc.~DataType.TIMESTAMP | dbTimeStamp | TIMESTAMP<br />DATETIME |
|com.sun.star.sdbc.~DataType.BINARY | dbBinary | BINARY |
|com.sun.star.sdbc.~DataType.VARBINARY | dbVarBinary | VARBINARY |
|com.sun.star.sdbc.~DataType.LONGVARBINARY | dbLongBinary | LONGVARBINARY<br />LONG VARBINARY<br />BLOB<br />TINY BLOB<br />MEDIUM BLOB<br />LONG BLOB |
|com.sun.star.sdbc.~DataType.CLOB | dbMemo | CLOB |
|com.sun.star.sdbc.~DataType.BLOB | dbLongBinary | BLOB |</pre>
</div>
<div title="Fields" modifier="Jean-Pierre Ledure" created="201306291342" modified="201405241127" tags="Collections" changecount="2">
<pre>The //Fields// collection describes instances of all __[[fields|Field]]__ present either
*in a [[table|TableDef]]
*in a [[query|QueryDef]]
*or in a [[recordset|Recordset]]
!!!Syntax
//table//{{{.Fields()}}}
//table//{{{.Fields(}}}//index//{{{)}}}
//table//{{{.Fields(}}}//fieldname//{{{)}}}
//query//{{{.Fields()}}}
//query//{{{.Fields(}}}//index//{{{)}}}
//query//{{{.Fields(}}}//fieldname//{{{)}}}
//recordset//{{{.Fields()}}}
//recordset//{{{.Fields(}}}//index//{{{)}}}
//recordset//{{{.Fields(}}}//fieldname//{{{)}}}
| !Object | !Type | !Argument | !Type |!Returned value |
|table | [[Table object|TableDef]] || absent |A [[Collection]] of the fields of the table |
|~|~| index | integer<br />long |A [[field object|Field]] |
|~|~| fieldname | string |~|
|query | [[Query object|QueryDef]] || absent |A [[Collection]] of the fields of the query |
|~|~| index | integer<br />long |A [[field object|Field]] |
|~|~| fieldname | string |~|
|recordset | [[Recordset object|Recordset]] || absent |A [[Collection]] of the fields of the recordset |
|~|~| index | integer<br />long |A [[field object|Field]] |
|~|~| fieldname | string |~|
!!!Remarks
*Field [[collections|Collection]] are numbered from 0 to {{{Fields().Count - 1}}}
*The //fieldname// argument is not case sensitive.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection Fields() |
|Field '...' not found |
!!!Examples
<<tiddler "DataType example">>
</pre>
</div>
<div title="FillAutoControlValue" modifier="Jean-PierreLedure" created="201212221327" modified="201308161105" tags="HowTo">
<pre>(Q) Is it possible to have some fields filled in automatically as soon as a certain value has been entered into another field?
(R) A typical example of this is getting state and city name from Zipcodes. If you have a ~Zip-Code table, you'll never have to enter the State/City again.
It is illustrated using next //Employees// table:
<<tiddler "EmployeesTable">>
Assume a form with a number of read-only fields corresponding with that table although __the form is not bound to the table__, then trigger next code in the //When losing focus// event of an editable field in which an employee id might be entered:
//{{{
Sub EmpFillAuto(poEvent As Object)
Dim oEvent As Object, oEmpID As Object, sCrit As String
Dim oParentForm As Object, oField As Object, vValue As Variant
Set oEvent = Events(poEvent)
oEmpID = oEvent.Source
sCrit = "[EmployeeID]=" & oEmpID.Value
Set oParentForm = oEmpID.Parent
With oParentForm
Set oField = .Controls("txtTitleOfCourtesy")
vValue = DLookup("[TitleOfCourtesy]", "[Employees]", sCrit)
If Not IsNull(vValue) Then oField.Value = vValue
Set oField = .Controls("txtFirstName")
vValue = DLookup("[FirstName]", "[Employees]", sCrit)
If Not IsNull(vValue) Then oField.Value = vValue
Set oField = .Controls("txtLastName")
vValue = DLookup("[LastName]", "[Employees]", sCrit)
If Not IsNull(vValue) Then oField.Value = vValue
Set oField = .Controls("txtAddress")
vValue = DLookup("[Address]", "[Employees]", sCrit)
If Not IsNull(vValue) Then oField.Value = vValue
Set oField = .Controls("txtCity")
vValue = DLookup("[City]", "[Employees]", sCrit)
If Not IsNull(vValue) Then oField.Value = vValue
End With
End Sub
//}}}
!!!See also
[[Controls]]
[[DLookup]]
[[Events Handler]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|~FillAuto |~Employees_FillAuto ||fmtEmployeeID|When losing focus ||</pre>
</div>
<div title="Filter" modifier="Jean-Pierre Ledure" created="201107171009" modified="201407261320" tags="Properties" changecount="1">
<pre>You can use the //Filter// property to
*specify a subset of records to be displayed when a filter is applied to a [[form|Form]] or a [[subform|SubForm]]
*set or return a value that determines the records included in a subsequently opened [[Recordset]] object (via [[OpenRecordset]])
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
|[[SubForm]] |A subform in an open form |
|[[Recordset]] |The representation of a set of records from a table, a query or a SQL statement |
!!!Syntax
//form//{{{.Filter}}}
//form//{{{.Filter = }}}//value//
//subform//{{{.Filter}}}
//subform//{{{.Filter = }}}//value//
//recordset//{{{.Filter}}}
//recordset//{{{.Filter = }}}//value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
The //Filter// property is a string expression consisting of a ''WHERE'' clause without the WHERE keyword. Like in //~MsAccess// __table names__, or __field names__ (e.g. when containing a space) may be surrounded by square brackets ([]).
!!!Error messages
|Form '...' is currently not open|
|Value '...' is invalid for property 'Filter' |
!!!See also
[[FilterOn]]
!!!Example
<<tiddler "Filter example">>
<<tiddler "Filter2 example">></pre>
</div>
<div title="Filter example" modifier="Jean-PierreLedure" created="201107171035" modified="201306231546" tags="[[Snippets of Code]]">
<pre>Set and apply a filter on a form
//{{{
Dim ofForm As Object, sFilter As String
Set ofForm = Forms("myForm")
sFilter = "[VAT CODE]=3 And [PRODUCT CODE]<'28000'"
ofForm.Filter = sFilter
ofForm.FilterOn = True
//}}}</pre>
</div>
<div title="Filter2 example" modifier="Jean-PierreLedure" created="201306231517" modified="201306231547" tags="[[Snippets of Code]]">
<pre>Set and apply a filter on a recordset derived from an existing recordset
Count the records before and after filter application
//{{{
Dim oRecordset1 As Object, oRecordset2 As Object, sFilter As String
Set oRecordset1 = Application.CurrentDb().OpenRecordset("SELECT * FROM [PRODUCTS]")
sFilter = "[VAT CODE]=3 And [PRODUCT CODE]<'28000'"
oRecordset1.Filter = sFilter
oRecordset1.MoveLast
Print oRecordset1.RecordCount,
Set oRecordset2 = oRecordset1.OpenRecordset() ' Filter is applied now
oRecordset2.MoveLast
Print oRecordset2.RecordCount,
Application.CurrentDb().CloseAllRecordsets() ' Don't forget !!
//}}}</pre>
</div>
<div title="FilterOn" modifier="Jean-Pierre Ledure" created="201107171043" modified="201407261341" tags="Properties" changecount="3">
<pre>Use the //~FilterOn// property to specify or determine whether the [[Filter]] property for a form is applied.
!!!Applies to ...
| !Object | !Description |
|[[Form]] |An open form |
|[[SubForm]] |A subform in an open form |
!!!Syntax
//form//{{{.FilterOn}}}
//form//{{{.FilterOn = }}}//value//
//subform//{{{.FilterOn}}}
//subform//{{{.FilterOn = }}}//value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
When a //Filter// is applied, the form is [[requeried|Requery]].
!!!Error messages
|Form '...' is currently not open|
|Value '...' is invalid for property '~FilterOn' |
!!!See also
[[Filter]]
[[Requery]]
!!!Example
<<tiddler "Filter example">></pre>
</div>
<div title="Find" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181629" modified="201612181704" tags="Methods" changecount="14">
<pre>The //Find// method finds a specified text in a standard or class [[module|Module]].
!!!Applies to ...
| !Object | !Description |
|[[Module]] |The representation of a Basic script. |
!!!Syntax
//module//{{{.Find(}}}//target, startline, startcolumn, endline, endcolumn, wholeword, matchcase, patternsearch//{{{)}}}
| !Argument | !Optional | !Type | !Description | !Returned value |
|module || [[Module object|Module]] |The Basic script |If the string is found, the //Find// method returns {{{True}}}. |
|target | N | String |The text that you want to find. |~|
|startline | N | Long |The line on which to begin searching.<br />If a match is found, the value of the //startline// argument is set to the line on which the beginning character of the matching text is found. |~|
|startcolumn | N | Long |The column on which to begin searching.<br />If a match is found, the value of the //startcolumn// argument is set to the column on which the beginning character of the matching text is found. |~|
|endline | N | Long |The line on which to stop searching.<br />If a match is found, the value of the //endline// argument is set to the line on which the ending character of the matching text is found. |~|
|endcolumn | N | Long |The column on which to stop searching.<br />If a match is found, the value of the //endcolumn// argument is set to the column on which the ending character of the matching text is found. |~|
|wholeword | Y | Boolean |{{{True}}} results in a search for whole words only.<br />The default is {{{False}}}. |~|
|matchcase | Y | Boolean |{{{True}}} results in a search for words with case matching the //target// argument.<br />The default is {{{False}}}. |~|
|patternsearch | Y | Boolean |{{{True}}} results in a search in which the //target// argument may contain wildcard characters such as an asterisk (*) or a question mark (?).<br />The default is {{{False}}}. |~|
!!!Remarks
*To determine the position in the module at which the search text was found, pass ''empty variables'' to the //Find// method for the //startline//, //startcolumn//, //endline//, and //endcolumn// arguments.<br />If a match is found, these arguments will contain the line number and column position at which the search text begins (//startline//, //startcolumn//) and ends (//endline//, //endcolumn//).<br />For example, if the search text is found on line 15, begins at column 20, and ends at column 30, the values of these arguments will be:<br />{{{startline = 15, startcolumn = 20, endline = 15, endcolumn = 30}}}.
*If the input arguments do not allow a fair search (f.i. //endline// < //startline//), then //Find// will return {{{False}}}.
*To pass an empty value, do not initialize the argument or use the {{{Empty}}} LO/AOO Basic reserved word.
//{{{
Dim vStartLine As Variant
vStartLine = Empty
//}}}
!!!Error messages
|Argument nr.1 (Value='...') is invalid |
!!!See also
[[Module]]
!!!Example
<<tiddler "Module example">></pre>
</div>
<div title="FindNext" modifier="Jean-Pierre Ledure" created="201112241559" modified="201409271452" tags="Actions" changecount="1">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~FindNext// action finds the next instance of data that meets the criteria specified by the arguments of the last invoked [[FindRecord]] action.
If a match has been found, the cursor is set in the matching field. Otherwise it returns to the starting record.
The starting record is NOT the record where the focus is on but the last record reached by the previous //~FindRecord// action.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]FindNext()}}}
!!!Remarks
*A previous //~FindRecord// action is mandatory. Otherwise the invocation of //~FindNext// will generate an error.
*//~FindNext// returns //True// if a matching occurrence has been found.
!!!Error messages
|~FindNext() must be preceded by a successful ~FindRecord(...) call |
!!!See also
[[FindRecord]]
!!!Example
<<tiddler "FindRecord example">></pre>
</div>
<div title="FindOutFormOpen" modifier="Jean-PierreLedure" created="201205010535" modified="201308161010" tags="HowTo">
<pre>(Q) How do I find out from code if a form is open or not?
(R) Pass the form name to the following function. Function will return True if form is open and False if it's not.
//{{{
Function bIsLoaded(ByVal sFormName As String) As Boolean
' sFormName is not case sensitive
bIsLoaded = AllForms(sFormName).IsLoaded
End Function
//}}}
!!!See also
[[AllForms]]
[[IsLoaded]]</pre>
</div>
<div title="FindOutTableExists" modifier="Jean-PierreLedure" created="201308161446" modified="201308161453" tags="HowTo">
<pre>(Q) How do I find out from code if a table exists or not?
(R) Pass the table name to the following function. Function will return True if table exists or False otherwise.
//{{{
Function bTableExists(ByVal sTableName As String) As Boolean
' sTableName is not case sensitive
Dim i As Integer, oDefs As Object
bTableExists = False
Set oDefs = Application.CurrentDb.TableDefs
For i = 0 To oDefs.Count - 1
If UCase(oDefs.Item(i).Name) = UCase(sTableName) Then
bTableExists = True
Exit For
End If
Next i
End Function
//}}}
!!!See also
[[TableDefs]]
[[Item]]</pre>
</div>
<div title="FindPositionRecordset" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201406061406" modified="201406061454" tags="HowTo" changecount="8">
<pre>(Q) How do I find the current absolute and relative position in a recordset ?
(R) The [[AbsolutePosition]] property returns the record number of the recordset. Associated with [[RecordCount]] the relative position can be derived.
In some situations, you need to determine how far through a [[Recordset object|Recordset]] you have moved the current record position, and perhaps indicate the current record position to a user. For example, you may want to indicate the current position on a progress bar or similar type of control.
The //~AbsolutePosition// property value is the position of the current record relative to 0. However, do not think of this property as a record number. There is no assurance that a record will have the same absolute position if the Recordset object is recreated because the order of individual records within a Recordset object is not guaranteed unless it is created with an SQL statement that includes an ORDER BY clause.
We can compute the current relative position expressed as a percentage of the total number of records indicated by the //~RecordCount// property. Because the //~RecordCount// property does not reflect the total number of records in the //Recordset// object until the //Recordset// has been fully populated, we will use the [[MoveLast|Move (recordset)]] and [[MoveFirst|Move (recordset)]] methods immediately after opening the Recordset. This fully populates the //Recordset// object. If you have a large result set, using the //~MoveLast// method may take a long time.
The following example opens a //Recordset// object on a table called Employees.
<<tiddler "EmployeesTable">>
The procedure then moves through the Employees table and uses the SysCmd method to display a progress bar showing the percentage of the table that has been processed.
//{{{
Sub DisplayPosition()
Dim odbNorthwind As Object
Dim orsEmployees As Object
Dim sMsg As String
Dim lCount As Long
Dim sSQL As String
Dim dPercent As Double
On Local Error GoTo ErrorHandler
Set odbNorthwind = Application.CurrentDb
sSQL = "SELECT * FROM Employees"
Set orsEmployees = odbNorthwind.OpenRecordset(sSQL, , , dbReadOnly)
With orsEmployees
If .EOF Then ' If no records, exit
Exit Sub
Else
sMsg = "Processing Employees table..."
DoCmd.SysCmd(acSysCmdInitMeter, sMsg, 100)
.MoveLast ' Determine number of records
lCount = .RecordCount
.MoveFirst
End If
Do Until .EOF
'
' Any processing ...
'
Wait 100 ' just to see what happens ...
dPercent = .AbsolutePosition / lCount
If dPercent <> 0 Then DoCmd.SysCmd(acSysCmdUpdateMeter, sMsg, Int(100*dPercent))
.MoveNext
Loop
End With
MsgBox "Processing ended"
DoCmd.SysCmd(acSysCmdRemoveMeter)
orsEmployees.mClose
Set orsEmployees = Nothing
Set odbNorthwind = Nothing
Exit Sub
ErrorHandler:
TraceError("ERROR", Err, "DisplayPosition", Erl)
End Sub
//}}}
!!!See also
[[OpenRecordset]]
[[SysCmd]]
!!!Refer to ...
| !Basic module | !Sub |!Comments |
|~HowTo |~DisplayPosition ||</pre>
</div>
<div title="FindRecord" modifier="Jean-Pierre Ledure" created="201112241005" modified="201605161008" tags="Actions" changecount="4">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~FindRecord// action finds the first instance of data that meets the criteria specified by the //~FindRecord// arguments. This can be in a succeeding or prior record, or in the first record. The search is done in a single column or in all columns of a __form__ (or __subform__)'s [[GridControl]].
If a match has been found, the cursor is set in the matching field.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]FindRecord(FindWhat,}}}//{{{ Match, MatchCase, Search, SearchAsFormatted, OnlyCurrentField, FindFirst}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{FindWhat}}} | No | String<br />Date<br />Number |Specifies the data you want to find in the record. Enter the text, number, or date you want to find. |
|{{{Match}}} | Yes | acAnyWhere<br />acEntire<br />acStart |Specifies where the data is located in the field. You can specify a search for data in any part of the field (acAnyWhere), for data that fills the entire field (acEntire), or for data located at the beginning of the field (acStart). Obviously this argument is meaningful only if //~FindWhat// is a string.<br />The default is acEntire. |
|{{{MatchCase}}} |~| Boolean |Specifies whether the search is case-sensitive (uppercase and lowercase letters must match exactly). The default is False. |
|{{{Search}}} |~| acDown<br />acSearchAll<br />acUp |Specifies whether the search proceeds from the current record up to the beginning of the records (acUp); down to the end of the records (acDown); or down to the end of the records and then from the beginning of the records to the current record, so all records are searched (acSearchAll). The default is acSearchAll. |
|{{{SearchAsFormatted}}} |~| Boolean |If present, must be FALSE. True is not supported. |
|{{{OnlyCurrentField}}} |~| acAll<br />acCurrent |Specifies whether the search is confined to the current field in each record (acCurrent) or includes all fields in each record (acAll). The default is acCurrent. |
|~|~| String |The argument must contain a [[shortcut|ShortCut Notation]] to a GridControl or to a column of a [[GridControl]]. If the shortcut points to a ~GridControl all the columns are scanned to find a match. |
|{{{FindFirst}}} |~| Boolean |Specifies whether the search starts at the first or last record (depending on the //Search// argument) or at the current record. The default is True. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acAnywhere = 0
Const acEntire = 1
Const acStart = 2
Const acDown = 1
Const acSearchAll = 2
Const acUp = 0
Const acAll = 0
Const acCurrent = -1
//}}}
!!!Remarks
*The //~FindRecord// action is most often started from an event. Clicking on a button in a form triggering the event might change the focus from the current field to the button which is not the desired effect. In that case use the [[SetFocus]] method, either on the //form// or on the targeted //control//, before executing the //~FindRecord// statement.
*The targeted //form// or //subform// MUST contain a //gridcontrol//.
*The //~FindRecord// action is a function. It returns //True// if a match ha been found, and //False// otherwise.
*Using a shortcut (i.e. a string ...) as {{{OnlyCurrentField}}} argument is the __only__ way to run a //~FindRecord// action in a //~GridControl// belonging to a //~SubForm//.
*Using a shortcut (i.e. a string ...) as {{{OnlyCurrentField}}} argument is the __recommended__ way to run a //~FindRecord// action in one of the [[forms|Standalone Forms]] defined in a //non-Base// document.It is the __only__ way if more than 1 form is contained in such a //non-Base// document.
!!!Error messages
|No active form or control found |
|Form '...' has no underlying dataset |
|Control '...' not found in gridcontrol '...' |
|No gridcontrol found in form '...' |
!!!See also
[[FindNext]]
[[SetFocus]]
!!!Example
<<tiddler "FindRecord example">></pre>
</div>
<div title="FindRecord example" modifier="Jean-Pierre Ledure" created="201112250945" modified="201408011516" tags="[[Snippets of Code]]" changecount="1">
<pre>Find the record starting from the top having the value "3" in one of the numeric columns:
//{{{
Dim ofForm As Object
Set ofForm = Forms("myForm")
ofForm.SetFocus()
If Not FindRecord(3, , , , , acAll) Then MsgBox "Not Found !"
//}}}
Next statement will retrieve the next occurrence:
//{{{
FindNext() ' Parentheses are optional
//}}}</pre>
</div>
<div title="Font example" modifier="Jean-PierreLedure" created="201108051604" modified="201303291730" tags="[[Snippets of Code]]">
<pre>Change control aspect
//{{{
Dim ofForm As Object, ocControl As Object
Set ofForm = Forms("myForm")
Set ocControl =ofForm.Controls("myControl")
If ofForm.Controls("myChkBox").Value = 1 Then
ocControl.FontName = "Verdana"
ocControl.FontSize = 18
ocControl.FontBold = True
ocControl.FontItalic = True
ocControl.FontUnderline = True
ocControl.ForeColor = RGB(255, 0, 0)
ocControl.TextAlign = 2
End If
//}}}
... or alternatively ...
//{{{
Dim ofForm As Object, ocControl As Object
Set ofForm = Forms("myForm")
Set ocControl =ofForm.Controls("myControl")
If ofForm.Controls("myChkBox").Value = 1 Then
ocControl.FontName = "Verdana"
ocControl.FontSize = 18
ocControl.FontWeight = com.sun.star.awt.FontWeight.ULTRABOLD ' alternative to Bold property
ocControl.FontItalic = True
ocControl.FontUnderline = True
ocControl.ForeColor = RGB(255, 0, 0)
ocControl.TextAlign = 2
End If
//}}}</pre>
</div>
<div title="FontBold" modifier="Jean-Pierre Ledure" created="201108051530" modified="201405291503" tags="Properties" changecount="1">
<pre>The //~FontBold// property specifies whether a font appears in a bold style in a Control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~HiddenControl<br />~ImageButton<br />~ImageControl<br />~ScrollBar<br />~SpinButton<br />[[SubForm]]-- | None |All except<br />--~ImageControl<br />~ProgressBar<br />~ScrollBar<br />-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.FontBold}}}
//control//{{{.FontBold = }}}//value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
The //~FontBold// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~FontBold' not applicable in this context |
|Value '...' is invalid for property '~FontBold' |
!!!See also
[[FontItalic]]
[[FontName]]
[[FontSize]]
[[FontUnderline]]
[[FontWeight]]
[[ForeColor]]
[[TextAlign]]
!!!Example
<<tiddler "Font example">></pre>
</div>
<div title="FontItalic" modifier="Jean-Pierre Ledure" created="201108051613" modified="201405291503" tags="Properties" changecount="1">
<pre>The //~FontItalic// property specifies whether text appears in italic in a Control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~HiddenControl<br />~ImageButton<br />~ImageControl<br />~ScrollBar<br />~SpinButton<br />[[SubForm]]-- | None |All except<br />--~ImageControl<br />~ProgressBar<br />~ScrollBar<br />-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.FontItalic}}}
//control//{{{.FontItalic = }}}//value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
The //~FontItalic// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~FontItalic' not applicable in this context |
|Value '...' is invalid for property '~FontItalic' |
!!!See also
[[FontBold]]
[[FontName]]
[[FontSize]]
[[FontUnderline]]
[[FontWeight]]
[[ForeColor]]
[[TextAlign]]
!!!Example
<<tiddler "Font example">></pre>
</div>
<div title="FontName" modifier="Jean-Pierre Ledure" created="201108051616" modified="201405291504" tags="Properties" changecount="1">
<pre>The //~FontName// property specifies the name of the font used to display a Control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~HiddenControl<br />~ImageButton<br />~ImageControl<br />~ScrollBar<br />~SpinButton<br />[[SubForm]]-- | None |All except<br />--~ImageControl<br />~ProgressBar<br />~ScrollBar<br />-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.FontName}}}
//control//{{{.FontName = }}}//value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
The //~FontName// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~FontName' not applicable in this context |
|Value '...' is invalid for property '~FontName' |
!!!See also
[[FontBold]]
[[FontItalic]]
[[FontSize]]
[[FontUnderline]]
[[FontWeight]]
[[ForeColor]]
[[TextAlign]]
!!!Example
<<tiddler "Font example">></pre>
</div>
<div title="FontSize" modifier="Jean-Pierre Ledure" created="201108051618" modified="201405291504" tags="Properties" changecount="1">
<pre>The //~FontSize// property specifies the size of the font used to display a Control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~HiddenControl<br />~ImageButton<br />~ImageControl<br />~ScrollBar<br />~SpinButton<br />[[SubForm]]-- | None |All except<br />--~ImageControl<br />~ProgressBar<br />~ScrollBar<br />-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.FontSize}}}
//control//{{{.FontSize = }}}//value//
!!!Returned values / Arguments
{{{Integer}}} or {{{Long}}}
!!!Remarks
The //~FontSize// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~FontSize' not applicable in this context |
|Value '...' is invalid for property '~FontSize' |
!!!See also
[[FontBold]]
[[FontItalic]]
[[FontName]]
[[FontUnderline]]
[[FontWeight]]
[[ForeColor]]
[[TextAlign]]
!!!Example
<<tiddler "Font example">></pre>
</div>
<div title="FontUnderline" modifier="Jean-Pierre Ledure" created="201108051621" modified="201405291504" tags="Properties" changecount="1">
<pre>The //~FontUnderline// property specifies whether text is underlined in a Control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~HiddenControl<br />~ImageButton<br />~ImageControl<br />~ScrollBar<br />~SpinButton<br />[[SubForm]]-- | None |All except<br />--~ImageControl<br />~ProgressBar<br />~ScrollBar<br />-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.FontUnderline}}}
//control//{{{.FontUnderline = }}}//value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
The //~FontUnderline// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~FontUnderline' not applicable in this context |
|Value '...' is invalid for property '~FontUnderline' |
!!!See also
[[FontBold]]
[[FontItalic]]
[[FontName]]
[[FontSize]]
[[FontWeight]]
[[ForeColor]]
[[TextAlign]]
!!!Example
<<tiddler "Font example">></pre>
</div>
<div title="FontWeight" modifier="Jean-Pierre Ledure" created="201108051625" modified="201405291505" tags="Properties" changecount="2">
<pre>The //~FontWeight// property specifies the line width used to display characters in a Control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~HiddenControl<br />~ImageButton<br />~ImageControl<br />~ScrollBar<br />~SpinButton<br />[[SubForm]]-- | None |All except<br />--~ImageControl<br />~ProgressBar<br />~ScrollBar<br />-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.FontWeight}}}
//control//{{{.FontWeight = }}}//value//
!!!Returned values / Arguments
{{{Integer}}} or {{{Long}}}
!!!Remarks
*Allowed values for //~FontWeight// are:
| Symbolic name || Numeric value |
|com.sun.star.awt.~FontWeight.DONTKNOW |The font weight is not specified/known. | 0 |
|com.sun.star.awt.~FontWeight.THIN |specifies a 50% font weight. | 50 |
|com.sun.star.awt.~FontWeight.ULTRALIGHT |specifies a 60% font weight. | 60 |
|com.sun.star.awt.~FontWeight.LIGHT |specifies a 75% font weight. | 75 |
|com.sun.star.awt.~FontWeight.SEMILIGHT |specifies a 90% font weight. | 90 |
|com.sun.star.awt.~FontWeight.NORMAL |specifies a normal font weight. | 100 |
|com.sun.star.awt.~FontWeight.SEMIBOLD |specifies a 110% font weight. | 110 |
|com.sun.star.awt.~FontWeight.BOLD |specifies a 150% font weight. | 150 |
|com.sun.star.awt.~FontWeight.ULTRABOLD |specifies a 175% font weight. | 175 |
|com.sun.star.awt.~FontWeight.BLACK |specifies a 200% font weight.| 200 |
*The //~FontWeight// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~FontWeight' not applicable in this context |
|Value '...' is invalid for property '~FontWeight' |
!!!See also
[[FontBold]]
[[FontItalic]]
[[FontName]]
[[FontSize]]
[[FontUnderline]]
[[ForeColor]]
[[TextAlign]]
!!!Example
<<tiddler "Font example">></pre>
</div>
<div title="ForeColor" modifier="Jean-Pierre Ledure" created="201108051514" modified="201405291502" tags="Properties" changecount="1">
<pre>The //~ForeColor// property specifies or determines the color (RGB) of the text in a Control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~HiddenControl<br />~ImageButton<br />~ImageControl<br />~ScrollBar<br />~SpinButton<br />[[SubForm]]-- | None |All except<br />--~ImageControl<br />~ProgressBar<br />~ScrollBar<br />-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.ForeColor}}}
//control//{{{.ForeColor = }}}//value//
!!!Returned values / Arguments
{{{Long}}}
!!!Remarks
The //~ForeColor// property can be set at [[grid control|GridControl]] level, not at its individual //controls// level.
!!!Error messages
|Property '~ForeColor' not applicable in this context |
|Value '...' is invalid for property '~ForeColor' |
!!!See also
[[BackColor]]
[[BorderColor]]
[[BorderStyle]]
[[FontBold]]
[[FontItalic]]
[[FontName]]
[[FontSize]]
[[FontUnderline]]
[[FontWeight]]
[[TextAlign]]
!!!Example
<<tiddler "Color example">></pre>
</div>
<div title="Form" modifier="YourName" created="201106260832" modified="201902151444" tags="Objects" changecount="16">
<pre>{{firstletter{
@@color:#930;A@@
}}} //Form// object describes
*either one of the Forms located in a Base document (".odb" file),
*or one of the forms contained in a non-Base (Writer, Calc, ...) document.
The form can be either opened or closed. If the property [[IsLoaded]] returns //True// then the form is opened.
!!!Functions returning a form object
| !Parent object | !Function | !Type | !Argument |!Description |
|[[Application]] |[[AllForms]] | [[Collection]] | Integer or String |{{{Application.AllForms("myForm")}}} returns an object corresponding with the {{{myForm}}} form |
|~|[[Forms]] | [[Collection]] | Integer or String |{{{Application.Forms("myForm")}}} returns an object corresponding with the {{{myForm}}} form. {{{myForm}}} must be open. |
||[[getObject]] || String |{{{getObject("Forms!myForm")}}} returns an object corresponding with the {{{myForm}}} form. {{{myForm}}} must be open. |
!!!Properties
| !Property | !Type | !Read only | !Description or UNO object |
|[[AllowAdditions]] |||Specifies whether a user can add a record when using the form. |
|[[AllowDeletions]] |||Specifies whether a user can delete a record when using the form. |
|[[AllowEdits]] |||Specifies whether a user can modify a record when using the form. |
|[[Bookmark]] |||specifies uniquely the current record of the form's underlying table, query or SQL statement. |
|[[Caption]] |||Specifies the text that appears in the title bar. |
|[[CurrentRecord]] |||Identifies the current record in the recordset being viewed on a form. |
|[[Filter]] |||Specifies a subset of records to be displayed. |
|[[FilterOn]] |||Specifies if the Filter has to be applied. |
|[[Height]] |||Specifies the height of the form. |
|[[IsLoaded]] || Y |True if form is open. |
|[[Name]] || Y |Specifies the real and full (including its path, if any) name of the form |
|[[ObjectType]] || Y |Returns "FORM" |
|[[On form events|On (form event)]]|||Specifies the Basic macro executed when an event is triggered. |
|[[OpenArgs]] || Y |Specifies the ~OpenArgs argument of an [[OpenForm]] action. |
|[[OrderBy]] |||Specifies in which order the records should be displayed. |
|[[OrderByOn]] |||Specifies if the ~OrderBy has to be applied. |
|[[RecordSource]] |||Specifies the source of the data. |
|[[Visible]] |||Shows or hides the form. |
|[[Width]] |||Specifies the width of the form. |
|Component | UNO | Y |com.sun.star.text.~TextDocument |
|~ContainerWindow | UNO | Y ||
|~DatabaseForm | UNO | Y |com.sun.star.form.component.~DataForm<br />com.sun.star.sdb.~ResultSet |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[Close|Close (method)]] | None | Boolean |Close the form. Always returns {{{True}}}. |
|[[CurrentDb]] | None | Object |Return the [[database|Database]] object related to the [[standalone|Standalone Forms]] form, or {{{Nothing}}}. |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the Form has the given property. |
|[[Move]] | coordinates |~|Return True if Form has been moved successfully. |
|[[Refresh]] | None |~|Refresh data with its most recent value in the database. |
|[[Requery]] |~|~|Refresh the data displayed in the Form. |
|[[SetFocus]] |~|~|Return True if focus set on Form successfully. |
|[[setProperty]] | value<br />property |~|Return True if the given property could be set. |
!!!Remarks
Each //Form// [[object|Object Model]] has a Controls [[collection|Collection]] method, which contains all controls on the form. You can refer to a specific control on a form by referring to the [[Controls]] collection.
!!!Examples
<<tiddler "Forms examples">></pre>
</div>
<div title="Form (subform)" modifier="Jean-Pierre Ledure" created="201107191433" modified="201405291545" tags="Properties" changecount="1">
<pre>The //Form// property refers to the //Form// associated with a [[subform control|SubForm]].
!!!Applies to ...
| !Pseudo object | !Type when<br />in a form | !Type when<br />in a ~GridControl |!Description |
|[[Control]] | ~SubForm | None |A control on an open form representing a subset (subform) of the form |
!!!Syntax
//control//{{{.Form}}}
!!!Returned values
An object of type [[SubForm]]
!!!Remarks
The //Form// property is read-only.
!!!Error messages
| Property 'Form' not applicable in this context |
!!!See also
The [[SubForm]] object
!!!Example
<<tiddler "Subform example">></pre>
</div>
<div title="Format" modifier="Jean-Pierre Ledure" created="201108170859" modified="201508290730" tags="Properties" changecount="4">
<pre>The //Format// property determines the way data is displayed in controls of type date, time or formattedfield.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl |!Description |
|[[Control]] | ~DateField<br />~FormattedField<br />~TimeField | ~DateField<br />~FormattedField<br />~TimeField |A control on an open form or within a [[GridControl]] of one of the listed types |
!!!Syntax
//control//{{{.Format}}}
//control//{{{.Format}}} = //value//
!!!Returned values/Arguments
{{{String}}}
Valid values for ''__datefield controls__'' are :
|Standard (short) |
|Standard (short YY) |
|Standard (short YYYY) |
|Standard (long) |
|DD/MM/YY |
|MM/DD/YY |
|YY/MM/DD |
|DD/MM/YYYY |
|MM/DD/YYYY |
|YYYY/MM/DD |
|~YY-MM-DD |
|~YYYY-MM-DD |
Valid values for ''__timefield controls__'' are :
|24h short |13:45 |
|24h long |13:45:00 |
|12h short |01:45 PM |
|12h long |01:45:00 PM |
Other values are rejected.
!!!Remarks
The //Format// property is read-only for controls of type //~FormattedField//.
!!!Error messages
|Property 'Format' not applicable in this context |
|Value '...' is invalid for property 'Format' |
!!!Examples
<<tiddler "Format example">></pre>
</div>
<div title="Format example" modifier="Jean-PierreLedure" created="201108170912" modified="201303301221" tags="[[Snippets of Code]]">
<pre>Display the format of a formatted field
//{{{
Dim ocControl As Object
Set ocControl = Controls("myForm", "myFormattedField")
MsgBox ocControl.Format
//}}}
Change the format of a date field
//{{{
Dim ocControl As Object
Set ocControl = Controls("myForm", "myDateField")
ocControl.Format = "YYYY-MM-DD"
//}}}</pre>
</div>
<div title="Forms" modifier="YourName" created="201106251412" modified="201902151443" tags="Collections" changecount="4">
<pre>The //Forms// [[collection|Collection]] describes instances of all __open forms__ present in the current Base document (".odb" file) or in the current non-Base document (".odt", ".ods", ... file) containing one or more [[standalone forms|Standalone Forms]].
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]Forms()}}} or {{{Forms()}}}
{{{[Application.]Forms(index)}}}
{{{[Application.]Forms(formname)}}}
| !Argument #1 | !Type |!Returned value |
|| absent |A [[Collection]] object |
| index | integer<br>long |A [[Form]] object corresponding to the index-th item in the Forms() collection. The 1st form is Forms(0), the 2nd is Forms(1) and so on ... The last one is Forms.Count - 1.|
| formname | string |A [[Form]] object having the argument as name. The argument is NOT case-sensitive.|
!!!Remarks
*~Access2Base supports hierarchical form names exactly like Base does it. The //formname// argument must contain the full pathname of the designated form.
*You can refer to an individual Form object in the Forms collection either by referring to the form by name, or by referring to its index within the collection. If you want to refer to a specific form in the Forms collection, it's better to refer to the form by name because a form's collection index may change. The Forms collection is indexed beginning with zero. If you refer to a form by its index, the first form opened is Forms(0), the second form opened is Forms(1), and so on. If you opened Form1 and then opened Form2, Form2 would be referenced in the Forms collection by its index as Forms(1). If you then closed Form1, Form2 would be referenced in the Forms collection by its index as Forms(0).
*The //formname// argument is not case sensitive.
*The returned Form object is always a main form.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection Forms() |
|Form '...' not found |
|Form '...' is currently not open|
!!!See also ...
[[AllForms]]
!!!Examples
<<tiddler "Forms examples">></pre>
</div>
<div title="Forms examples" modifier="Jean-Pierre Ledure" created="201107011401" modified="201405241627" tags="[[Snippets of Code]]" changecount="2">
<pre>To display the name of all open forms (uses the [[Name]] property):
//{{{
Dim i As Integer, oCollection As Object
Set oCollection = Application.Forms()
For i = 0 To oCollection.Count - 1 'Forms without argument returns a Collection object
Print Application.Forms(i).Name, 'Forms(...) with an argument returns a Form object
Next i
Print
//}}}
Can shorter ... :
//{{{
Dim i As Integer
For i = 0 To Application.Forms.Count - 1 'Forms without argument returns a Collection object
Print Application.Forms(i).Name, 'Forms(...) with an argument returns a Form object
Next i
Print
//}}}
To know the size of an open form:
//{{{
Dim ofForm As Object
Set ofForm = Application.Forms("myForm")
MsgBox "Height = " & ofForm.Height & ", Width = " & ofForm.Width
//}}}</pre>
</div>
<div title="Full Index" modifier="Jean-Pierre Ledure" created="201108071237" modified="201507121427" tags="NoTag" changecount="2">
<pre><<list>></pre>
</div>
<div title="GetChunk" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201603121127" modified="201603121454" tags="Methods" changecount="6">
<pre>The //~GetChunk// method returns all or a portion of the content of a binary [[Field]] belonging to the [[Fields]] collection of a [[Recordset]].
!!!Applies to ...
| !Object | !Type of field |
|[[Field]] |com.sun.star.sdbc.~DataType.BINARY<br />com.sun.star.sdbc.~DataType.VARBINARY<br />com.sun.star.sdbc.~DataType.LONGVARBINARY |
!!!Syntax
//chunk// = //field//{{{.GetChunk(}}}//offset, numbytes//{{{)}}}
!!!Arguments
| !Argument / Return value | !Type | !Description |
|chunk | Variant |An array of integers. Its size is determined by the //numbytes// argument or by the number of remaining bytes to read, whichever is the smallest.<br />If the field contains {{{Null}}}, //~GetChunk// will return {{{Null}}} (to be tested with the {{{IsNull()}}} Basic builtin function). |
|offset | Long |The number of bytes to skip before copying begins. |
|numbytes | Long |The number of bytes you want to return. |
!!!Remarks
*Use //~GetChunk// to return a portion of the total data value at a time. You can use the [[AppendChunk]] method to reassemble the pieces.
*If offset is 0, //~GetChunk// begins copying from the first byte of the field.
*If numbytes is greater than the number of bytes in the field, //~GetChunk// returns the actual number of remaining bytes in the field.
!!!Error messages
|Method '~GetChunk' not applicable in this context |
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[AppendChunk]]
[[ReadAllBytes]]
[[Value|Value (field)]]
!!!Example
<<tiddler "Chunk example">></pre>
</div>
<div title="GetHiddenAttribute" modifier="Jean-Pierre Ledure" created="201312260818" modified="201405241127" tags="Actions" changecount="5">
<pre>The //~GetHiddenAttribute// property specifies if a named window is currently hidden or visible.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]GetHiddenAttribute(}}}//{{{ObjectType, ObjectName}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{ObjectType}}} | No | acTable<br />acQuery<br />acForm<br />acReport<br />acDiagram (i.e. Relationships)<br />acBasicIDE<br />acDatabaseWindow<br />acDocument |The type of object to hide or to show. |
|{{{ObjectName}}} | Yes | String |The name of the object. This argument is NOT case-sensitive.<br />The argument is mandatory when the //~ObjectType// argument is one of next values: //acTable//, //acQuery//, //acForm//, //acReport// or //acDocument//.<br />When the //~ObjectType// is equal to //acDocument//, the //~ObjectName// argument must contain the __filename__ of the targeted window. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acDiagram = 8
Const acForm = 2
Const acQuery = 1
Const acReport = 3
Const acTable = 0
Const acBasicIDE = 101
Const acDatabaseWindow = 102
Const acDocument = 111
//}}}
!!!Returned values
{{{Boolean}}}
!!!Remarks
*In //~MSAccess// the //~GetHiddenAttribute// property is related to the [[Application]] root object, not to the [[DoCmd]] one.
*When the //~ObjectType// is {{{acTable}}}, {{{acQuery}}}, {{{acForm}}} or {{{acReport}}}, the named object MUST be open.
!!!Error messages
|Arguments are missing or are not initialized |
|Argument nr. ... [Value = '...'] is invalid |
|Object '...' not found |
!!!See also
[[Maximize]]
[[Minimize]]
[[MoveSize]]
[[RunCommand]]
[[SetFocus]]
[[SelectObject]]
[[SetHiddenAttribute]]
!!!Example
<<tiddler "SetHiddenAttribute example">></pre>
</div>
<div title="GetRows" modifier="Jean-Pierre Ledure" created="201401261441" modified="201408011516" tags="Methods" changecount="6">
<pre>The //~GetRows// method retrieves multiple rows from a [[Recordset]] object.
!!!Applies to ...
| !Object | !Description |
|[[Recordset]] |A set of records derived from a table, a query or a SQL statement. |
!!!Syntax
//recordset//{{{.GetRows(}}}//numrows//{{{)}}}
| !Argument | !Optional | !Type | !Description | !Returned value |
|recordset || [[Recordset object|Recordset]] |An open recordset |//~GetRows// returns a two-dimensional array. The first subscript identifies the field and the second identifies the row number. |
|numrows | N | Long |Specifies the maximum number of rows to retrieve. |~|
!!!Remarks
//~GetRows// returns a two-dimensional zero-based array.
For example, to get the first field value in the second row returned, use code like the following:
//{{{
Dim vVarRecords() As Variant, oRecordset As Object, vField1 As Variant
Set oRecordset = ... OpenRecordset(...)
Set vVarRecords = oRecordset.GetRows(1000)
vField1 = vVarRecords(0, 1).
//}}}
To get the second field value in the first row, use code like the following:
//{{{
Dim vField2 As Variant
vField2 = vVarRecords(1, 0)
//}}}
The {{{vVarRecords}}} variable automatically becomes a two-dimensional array when //~GetRows// returns data. Otherwise //~GetRows// will return an uninitialized array (i.e. the output of the Basic builtin {{{Array()}}} function).
Each element of the returned array will be of the Basic type most close to the [[DataType]] of the original database field.
A {{{Null}}} field value in the database will be returned as a {{{Null}}} value in the array resulting from the invocation of //~GetRows//. To be evaluated with the {{{IsNull()}}} Basic builtin function.
If you request more rows than are available, then //~GetRows// returns only the number of available rows. You can use the Basic {{{UBound}}} function to determine how many rows //~GetRows// actually retrieved, because the array is sized to fit the number of returned rows.
For example, you could use the following code to determine how many rows were actually returned:
//{{{
numReturned = UBound(vVarRecords, 2) + 1
//}}}
You need to use "+ 1" because the first row returned is in the 0th element of the array. The number of rows that you can retrieve is constrained by the amount of available memory. You shouldn't use //~GetRows// to retrieve an entire table into an array if it is large.
Because GetRows returns all fields of the //Recordset// into the array, including Memo fields, you might want to use a query that restricts the fields returned.
Binary fields are not returned. Instead the corresponding element in the array returned by //~GetRows// contains the //length// of the field.
After you call //~GetRows//, the current record is positioned at the next unread row. That is, //~GetRows// has the same effect on the current record as {{{recordset.Move(numrows)}}}.
If you are trying to retrieve all the rows by using multiple //~GetRows// calls, use the [[EOF|BOF, EOF]] property to be sure that you're at the end of the //Recordset//. //~GetRows// returns less than the number requested if it's at the end of the //Recordset//.
Calling //~GetRows// cancels all not confirmed updates on the //recordset//.
!!!Error messages
|Argument nr.1 (Value='...') is invalid |
|Recordset has been closed. Recordset action rejected |
!!!See also
[[BOF, EOF]]
[[Move (recordset)]]
[[OpenRecordset]]
!!!Example
<<tiddler "GetRows example">></pre>
</div>
<div title="GetRows example" modifier="YourName" created="201401262005" modified="201401262005" tags="[[Snippets of Code]]">
<pre>Create a new recordset, extract the data in blocks of 50 records
//{{{
Const dbReadOnly = 4
Const cstNumRecs = 50
Dim orsRecords As Object, vDataBlock() As Variant
Set orsRecords = Application.CurrentDb().OpenRecordset("EXPENSES", , , dbReadOnly)
With orsRecords
Do While Not .EOF()
Set vDataBlock = .GetRows(cstNumRecs)
' ... process data block ...
' vDataBlock(i, j) = value in (i + 1)th field of (j + 1)th record
Loop
.mClose()
End With
//}}}</pre>
</div>
<div title="GoToControl" modifier="Jean-Pierre Ledure" created="201205171621" modified="201409271452" tags="Actions" changecount="4">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~GoToControl// action moves the focus to the named control in the active window. The active window is assumed to be a form.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]GoToControl(}}}//{{{ControlName}}}//{{{)}}}
| !Argument | !Optional | !Type |!Description |
|{{{ControlName}}} | No | String |The name of the control to move the focus to. This argument is NOT case-sensitive. |
!!!Remarks
*If
**the active window is not a form belonging to a Base document (".odb" suffix),
**or if the active window is indeed a form but no control is found with the given ~ControlName,
**or if such a control is found but it is not enabled,
{{indent{then the ~GoToControl request is ignored.
*You can also use the [[SetFocus]] method to move the focus to a control on a form or any of its subforms. This is the preferred method for moving the focus, especially to controls on subforms and nested subforms.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
!!!See also
[[SetFocus]]
!!!Example
//{{{
SelectObject(acForm, "myForm")
GoToControl("myControl")
//}}}</pre>
</div>
<div title="GoToRecord" modifier="Jean-Pierre Ledure" created="201112311138" modified="201412301600" tags="Actions" changecount="13">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~GoToRecord// action makes the specified record the current record in an open form, a table or a query datasheet.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]GoToRecord(}}}//{{{ObjectType, ObjectName, Record, Offset}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{ObjectType}}} | Yes | acActiveDataObject<br />acDataForm<br />acDataTable<br />acDataQuery |The type of object that contains the record you want to make current. Leave this argument blank to select the active window. |
|{{{ObjectName}}} |~| String |The name of the object that contains the record you want to make the current record. If you leave the Object Type argument blank, leave this argument blank also.<br />This argument may also contain a [[shortcut|ShortCut Notation]] to a [[Form]] or a [[SubForm]]. |
|{{{Record}}} |~| acFirst<br />acGoTo<br />acLast<br />acNewRec<br />acNext<br/>acPrevious |Specifies the record to make the current record. The default is //acNext//. |
|{{{Offset}}} |~| Integer<br />Long |This argument specifies the record to make the current record. You can use the Offset argument in two ways:<br />- When the Record argument is //acNext// or //acPrevious//, the cursor moves the number of records forward or backward specified in the Offset argument.<br />- When the Record argument is //acGoTo//, the cursor moves to the record with the number equal to the Offset argument. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acActiveDataObject = -1
Const acDataTable = 0
Const acDataQuery = 1
Const acDataForm = 2
Const acFirst = 2
Const acGoTo = 4
Const acLast = 3
Const acNewRec = 5
Const acNext = 1
Const acPrevious = 0
//}}}
!!!Remarks
*If the targeted window (= combination of //~ObjectType// and //~ObjectName//) does not exist or is not open then the //~GoToRecord// action request is ignored.
*The //~GoToRecord// action is most often started from an event. Clicking on a button in a form triggering the event might change the focus from the current form to the form containing the button. This could not be the desired effect. In that case use the [[SetFocus]] method on the targeted //form// or alternatively the [[SelectObject]] action, before executing the //~GoToRecord// statement.
*The //~GoToRecord// action, when applied to a table or a query datasheet, __does NOT work in //~OpenOffice//__ (//~LibreOffice// OK).
*When run from a //non-Base// document containing several forms, the first argument must be equal to {{{acDataForm}}} and the second one must be a {{{string}}} containing either the name of the targeted form or a [[shortcut|ShortCut Notation]] to it.
*An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before/after the first/last row, respectively.
*If {{{Record}}} = //acGoTo// then:
**If the {{{Offset}}} is positive, the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on.
**If the given {{{Offset}}} is negative, the cursor moves to an absolute row position with respect to the end of the result set. For example, {{{Offset}}} = (-1) positions the cursor on the last row, {{{Offset}}} = (-2) indicates the next-to-last row, and so on.
*Before moving to the indicated record, the current record is saved if it was either being created or being updated.
*//~GoToRecord// returns {{{True}}} if the move was successful, {{{False}}} otherwise.
!!!Error messages
|Argument nr.X [Value = '...'] is invalid|
!!!See also
[[Bookmark]]
[[OpenTable]]
[[OpenQuery]]
[[SelectObject]]
[[SetFocus]]
!!!Example
<<tiddler "GoToRecord example">></pre>
</div>
<div title="GoToRecord example" modifier="Jean-Pierre Ledure" created="201112311346" modified="201411021514" tags="[[Snippets of Code]]" changecount="6">
<pre>Jump to the 5th record before the last one
//{{{
Const acDataForm = 2
GoToRecord acDataForm, "myForm", acLast
GoToRecord acDataForm, "myForm", acPrevious, 5
//}}}
Jump to the last record of a table datasheet
//{{{
Const acDataTable = 0
GotoRecord acDataTable, "ARTICLE", acLast
//}}}</pre>
</div>
<div title="GridControl" modifier="Jean-Pierre Ledure" created="201109021440" modified="201405300632" tags="[[Special controls]]" changecount="3">
<pre>{{firstletter{
@@color:#930;A@@
}}} //~GridControl// [[control|Control]] presents the records of a table or query in a tabular form.
!!!Functions returning a ~GridControl control
| !Function | !Type | !Arguments |!Description |
|[[Controls]] | [[Collection]] | Integer<br />String |{{{Dim ofForm As Object}}}<br />{{{Set ofForm = Forms("myForm")}}}<br />{{{ofForm.Controls("myGridControl")}}} returns a control object corresponding with the {{{myGridControl}}} control in the {{{myForm}}} form. {{{myForm}}} must be open. |
|[[getObject]] || String |{{{getObject("Forms!myForm!myGridControl")}}} returns a control object corresponding with the {{{myGridControl}}} control in the {{{myForm}}} form. {{{myForm}}} must be open. |
!!!Properties
| !Property | !Type | !Read only |!Description or UNO object |
|[[Name]] || Y |Specifies the exact name of the control |
|BackColor |||Specifies the color of the interior of a control. |
|BorderColor |||Specifies the color of a control's border. |
|BorderStyle |||Specifies how a control's border appears. |
|[[ControlTipText]] |||Specifies the text that appears in a ~ScreenTip when you hold the mouse pointer over a control. |
|[[ControlType]] || Y |Specifies the type of a control. |
|[[Enabled]] |||Specifies if the cursor can access the control. |
|[[FontBold]]<br />[[FontItalic]]<br />[[FontName]]<br />[[FontSize]]<br />[[FontUnderline]]<br />[[FontWeight]]<br />[[ForeColor]] |||Specify the font characteristics of all the columns of the grid. |
|[[TabIndex]] |||Specifies a control's place in the tab order on a form. |
|[[TabStop]] |||Specifies whether you can use the TAB key to move the focus to a control. |
|[[Tag]] |||Stores extra information about a control. |
|[[Visible]] |||Specifies if a control is visible or hidden. |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the ~GridControl has the given property. |
|[[Requery]] ||~|True if data reloaded in the ~GridControl |
|[[SetFocus]] | none |~|Return True if focus set on Control successfully. |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
!!!Remarks
Each //~GridControl// [[control object|Object Model]] has a Controls [[collection|Collection]], which contains all controls on the gridcontrol. You can refer to a specific control on a gridcontrol by referring to its [[Controls]] collection.
!!!Example
<<tiddler "Gridcontrol examples">></pre>
</div>
<div title="Gridcontrol examples" modifier="Jean-Pierre Ledure" created="201109021509" modified="201405210822" tags="[[Snippets of Code]]" changecount="1">
<pre>Change font properties for ALL fields in a gridcontrol
//{{{
Dim ocGrid As Object
Set ocGrid = Forms("myForm").Controls("myGridControl")
ocGrid.FontBold = True
//}}}
To know the controls present in a gridcontrol (datagrid)
//{{{
Dim i As Integer, iCountGrid As Integer
iCountGrid = ocGrid.Controls().Count
For i = 0 To iCountGrid - 1
Print ocGrid.Controls(i).Name,
Next i
Print
//}}}</pre>
</div>
<div title="Height" modifier="Jean-PierreLedure" created="201107171203" modified="201306151428" tags="Properties">
<pre>The //Height// property specifies the height of a form or a dialog.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
|[[Dialog]] |An active dialog |
!!!Syntax
//form//{{{.Height}}}
//form//{{{.Height = }}}//value//
//dialog//{{{.Height}}}
//dialog//{{{.Height = }}}//value//
!!!Returned values / Arguments
{{{Integer}}} or {{{Long}}}
!!!Remarks
!!!Error messages
|Form '...' is currently not open|
|Dialog '...' not active |
|Value '...' is invalid for property 'Height' |
!!!See also
[[Maximize]]
[[Minimize]]
[[Move]]
[[Width]]
!!!Example
<<tiddler "Height & Width example">></pre>
</div>
<div title="Height & Width example" modifier="Jean-PierreLedure" created="201107171231" modified="201212091146" tags="[[Snippets of Code]]">
<pre>Modify height and width of a form
//{{{
Dim ofForm As Object
Set ofForm = Forms("myForm")
ofForm.Height = 300
ofForm.Width = 200
//}}}</pre>
</div>
<div title="Home" modifier="YourName" created="201106250808" modified="201902151454" tags="NoTag" changecount="32">
<pre>!NEW
Read about ''[[BASEDOCUMENTER|http://www.access2base.com/basedocumenter]]'': a new ~LibreOffice __extension__ for producing a __HTML documentation__ of Base applications.
~BaseDocumenter is based on the ~Access2Base library.
!What is __~Access2Base__ ?
{{firstletter{
@@color:#930;A@@
}}}''ccess2Base'' is a ~LibreOffice/~OpenOffice Basic library of macros for (business or personal) __application developers__ and __advanced users__.
Their syntax and their meaning are directly inspired by //~MSAccess//. The macros are callable from
*a ''~LibreOffice / ~OpenOffice Base'' application,
*any ''~LibreOffice / ~OpenOffice document'' wanting to access data stored in databases.
It is intended first to support people having a knowledge of ~MSAccess and willing to step over to a similar but free software, i.e. //~LibreOffice/~OpenOffice Base//.
It is also useful for users having already a practical knowledge of ~LibreOffice/~OpenOffice (Base or other ...) and wanting to start building applications with it, while remaining focussed on the application or business logic only.
//It is also recommended to people having tried to program in AOO/~LibO Basic with the standard ~LibreOffice/~OpenOffice UNO API and having given it up ...//
The ''~Access2Base API'' is ''much more concise, intuitive, easy to learn'' and ''easy to use'' than the standard UNO API (API = Application Programming Interface).
''
~Access2Base is provided either
>- __pre-installed as a standard feature in all versions of //~LibreOffice// since //~LibO version 4.2//__
>- as an __extension__ downloadable from the //~LibreOffice// (versions <= 4.1) or //~OpenOffice// (all versions) download centers.
The current and future versions of ~Access2Base (6.2.0) will be delivered only as a part of ~LibreOffice (>= 6.2).
See the [[getting started instructions|Install]] for more details.
''
The implemented macros include:
>1. a simplified and extensible ''__API__'' for [[forms|Forms]], [[dialogs|Dialog]] and [[controls|Controls]] manipulations similar with the ''//~MSAccess// object model''
>2. an API for database access with the [[table|TableDef]], [[query|QueryDef]], [[recordset|Recordset]] and [[field|Field]] objects, aligned with the ''//DAO (Microsoft Data Access Object)// object model''
>3. a number of actions with a syntax identical to their corresponding //~MSAccess// macros/actions including [[FindRecord]], [[RunCommand]], [[RunSQL]] or [[SelectObject]]
>4. the DLookup, DSum, ... database functions
>5. the support of the [[shortcut|ShortCut Notation]] notations like {{{Forms!myForm!myControl}}}
+
>6. a consistent [[errors and exceptions handler|Error Handler]]
>7. facilities for programming [[form, dialog and control events|Events Handler]]
>8. the support of both //embedded forms// (in Base documents) and [[forms stored in non-Base documents|Standalone Forms]]
!Compare ~Access2Base with ~MSAccess VBA
<<tiddler "Access2Base vs. VBA">>
!To know more ...
[[Why Access2Base ?]]
The [[Object model|Object Model]]
[[A tutorial|Tutorial]]
Browse the [[User's Guide]]
A detailed [[comparison|MSAccessCoverage]] between //~Access2Base// and //~MSAccess 2013//
!Getting started
[[Download the extension and get started|Install]]
!To give feedback ...
<<tiddler "Contact">></pre>
</div>
<div title="How To's" modifier="Jean-Pierre Ledure" created="201205010510" modified="201408011517" tags="NoTag" changecount="1">
<pre></pre>
</div>
<div title="HtmlEncode" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201510031310" modified="201510031326" tags="Properties" changecount="7">
<pre>The //~HtmlEncode// property converts a string to an ~HTML-encoded string.
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]HtmlEncode(}}}//{{{InputString}}}//, [//{{{OutputLength}}}//]{{{)}}}
!!!Returned values / Arguments
| !Argument | !Optional | !Type |!Description | !Returned value |
|{{{InputString}}} | No | String |Maximum length of 64,000 characters. | String |
|{{{OutputLength}}} | Yes | Integer<br />Long |The output string will be truncated after {{{OutputLength}}} characters. However an &-encoded character will remain complete. |~|
!!!Remarks
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[OutputTo]]
!!!Example
<<tiddler "HtmlEncode example">></pre>
</div>
<div title="HtmlEncode example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201510031343" modified="201510031345" tags="[[Snippets of Code]]" changecount="3">
<pre>Html encoding of a string
Returned string: {{{Amounts in &euro;, not in &#163;. Montants affich&#233;s en &euro;, pas en &#163;.}}}
//{{{
Const cstString = "Amounts in €, not in £. Montants affichés en €, pas en £."
DebugPrint Application.HtmlEncode(cstString)
//}}}</pre>
</div>
<div title="Identification example" modifier="Jean-Pierre Ledure" created="201312261119" modified="201611101401" tags="[[Snippets of Code]]" changecount="2">
<pre>//{{{
MsgBox Application.Version & " - " & Application.ProductCode & " - " & Application.CurrentUser
MsgBox Application.CurrentDb.Version
//}}}</pre>
</div>
<div title="ImportImages" modifier="Jean-PierreLedure" created="201308161552" modified="201308161607" tags="HowTo">
<pre>(Q) Can I import the content of a directory in individual binary fields ?
(R) Use the [[ReadAllBytes]] method. It's exactly its purpose !
Let's consider next table:
<<tiddler "CategoriesTable">>
Run next Sub. The assumption is that each file in the directory has a name corresponding with the name of the category (after having substituted "/" in category names by a space).
//{{{
Sub ImportImages(psPath As String)
Dim oTable As Object, oRecordset As Object, sCatName As String
Set oTable = Application.CurrentDb().TableDefs("CATEGORIES")
Set oRecordset = oTable.OpenRecordset()
With oRecordset
Do While Not .EOF()
sCatName = Join(Split(.Fields("CATEGORYNAME").Value, "/"), " ")
.Edit
.Fields("Picture").ReadAllBytes(psPath & sCatName & ".png")
.Update
.MoveNext
Loop
.mClose()
End With
End Sub
//}}}
!!!See also
[[Fields]]
[[OpenRecordset]]
[[Recordset]]
[[TableDefs]]
[[WriteAllBytes]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|Images |||||Store images in a directory, adapt the //path// argument and run the //Main// Sub from the Basic IDE. |</pre>
</div>
<div title="Index" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201507121436" modified="201507121453" tags="Properties" changecount="5">
<pre>The //Index// property specifies the index number for a [[CommandBarControl]] object in the [[CommandBarControls]] collection of [[CommandBar]]. The property is read-only.
!!!Applies to ...
| !Object |!Description |
|[[CommandBarControl]] |An element of a ~CommandBar. |
!!!Syntax
//commandbarcontrol//{{{.Index}}}
!!!Returned values / Arguments
{{{Integer}}}
!!!Remarks
For compatibility reasons with Microsoft Access ''the //Index// property starts at 1'', not at 0.
To retrieve a commandbarcontrol object from its collection and you know the value of its //Index// property, use that value minus 1 as argument of the ~CommandBarControls collection.</pre>
</div>
<div title="InlineJavascriptPlugin" modifier="YourName" created="201203161501" modified="201203161502" tags="systemConfig excludeLists">
<pre>/***
|Name|InlineJavascriptPlugin|
|Source|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|Documentation|http://www.TiddlyTools.com/#InlineJavascriptPluginInfo|
|Version|1.9.6|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|Insert Javascript executable code directly into your tiddler content.|
''Call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Documentation
>see [[InlineJavascriptPluginInfo]]
!!!!!Revisions
<<<
2010.12.15 1.9.6 allow (but ignore) type="..." syntax
|please see [[InlineJavascriptPluginInfo]] for additional revision details|
2005.11.08 1.0.0 initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.InlineJavascriptPlugin= {major: 1, minor: 9, revision: 6, date: new Date(2010,12,15)};
config.formatters.push( {
name: "inlineJavascript",
match: "\\<script",
lookahead: "\\<script(?: type=\\\"[^\\\"]*\\\")?(?: src=\\\"([^\\\"]*)\\\")?(?: label=\\\"([^\\\"]*)\\\")?(?: title=\\\"([^\\\"]*)\\\")?(?: key=\\\"([^\\\"]*)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",
handler: function(w) {
var lookaheadRegExp = new RegExp(this.lookahead,"mg");
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var src=lookaheadMatch[1];
var label=lookaheadMatch[2];
var tip=lookaheadMatch[3];
var key=lookaheadMatch[4];
var show=lookaheadMatch[5];
var code=lookaheadMatch[6];
if (src) { // external script library
var script = document.createElement("script"); script.src = src;
document.body.appendChild(script); document.body.removeChild(script);
}
if (code) { // inline code
if (show) // display source in tiddler
wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
if (label) { // create 'onclick' command link
var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",wikifyPlainText(label));
var fixup=code.replace(/document.write\s*\(/gi,'place.bufferedHTML+=(');
link.code="function _out(place,tiddler){"+fixup+"\n};_out(this,this.tiddler);"
link.tiddler=w.tiddler;
link.onclick=function(){
this.bufferedHTML="";
try{ var r=eval(this.code);
if(this.bufferedHTML.length || (typeof(r)==="string")&&r.length)
var s=this.parentNode.insertBefore(document.createElement("span"),this.nextSibling);
if(this.bufferedHTML.length)
s.innerHTML=this.bufferedHTML;
if((typeof(r)==="string")&&r.length) {
wikify(r,s,null,this.tiddler);
return false;
} else return r!==undefined?r:false;
} catch(e){alert(e.description||e.toString());return false;}
};
link.setAttribute("title",tip||"");
var URIcode='javascript:void(eval(decodeURIComponent(%22(function(){try{';
URIcode+=encodeURIComponent(encodeURIComponent(code.replace(/\n/g,' ')));
URIcode+='}catch(e){alert(e.description||e.toString())}})()%22)))';
link.setAttribute("href",URIcode);
link.style.cursor="pointer";
if (key) link.accessKey=key.substr(0,1); // single character only
}
else { // run script immediately
var fixup=code.replace(/document.write\s*\(/gi,'place.innerHTML+=(');
var c="function _out(place,tiddler){"+fixup+"\n};_out(w.output,w.tiddler);";
try { var out=eval(c); }
catch(e) { out=e.description?e.description:e.toString(); }
if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
}
}
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
} )
//}}}
// // Backward-compatibility for TW2.1.x and earlier
//{{{
if (typeof(wikifyPlainText)=="undefined") window.wikifyPlainText=function(text,limit,tiddler) {
if(limit > 0) text = text.substr(0,limit);
var wikifier = new Wikifier(text,formatter,null,tiddler);
return wikifier.wikifyPlain();
}
//}}}
// // GLOBAL FUNCTION: $(...) -- 'shorthand' convenience syntax for document.getElementById()
//{{{
if (typeof($)=='undefined') { function $(id) { return document.getElementById(id.replace(/^#/,'')); } }
//}}}</pre>
</div>
<div title="InlineJavascriptPluginInfo" modifier="YourName" created="201203161446" modified="201204071108" tags="excludeLists">
<pre>/***
|Name|InlineJavascriptPluginInfo|
|Source|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|Documentation|http://www.TiddlyTools.com/#InlineJavascriptPluginInfo|
|Version|1.9.6|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|documentation|
|Description|Documentation for InlineJavascriptPlugin|
''Call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated ~TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Usage
<<<
This plugin adds wiki syntax for surrounding tiddler content with {{{<script>}}} and {{{</script>}}} markers, so that it can be recognized as embedded javascript code. When a tiddler is rendered, the plugin automatically invokes any embedded scripts, which can be used to construct and return dynamically-generated output that is inserted into the tiddler content.
{{{
<script type="..." src="..." label="..." title="..." key="..." show>
/* javascript code goes here... */
</script>
}}}
All parameters are //optional//. When the ''show'' keyword is used, the plugin will also include the script source code in the output that it displays in the tiddler. This is helpful when creating examples for documentation purposes (such as used in this tiddler!)
__''Deferred execution from an 'onClick' link''__
<script label="click here" title="mouseover tooltip text" key="X" show>
/* javascript code goes here... */
alert('you clicked on the link!');
</script>
By including a {{{label="..."}}} parameter in the initial {{{<script>}}} marker, the plugin will create a link to an 'onclick' script that will only be executed when that specific link is clicked, rather than running the script each time the tiddler is rendered. You may also include a {{{title="..."}}} parameter to specify the 'tooltip' text that will appear whenever the mouse is moved over the onClick link text, and a {{{key="X"}}} parameter to specify an //access key// (which must be a //single// letter or numeric digit only).
__''Loading scripts from external source files''__
<script src="URL" show>
/* optional javascript code goes here... */
</script>You can also load javascript directly from an external source URL, by including a src="..." parameter in the initial {{{<script>}}} marker (e.g., {{{<script src="demo.js"></script>}}}). This is particularly useful when incorporating third-party javascript libraries for use in custom extensions and plugins. The 'foreign' javascript code remains isolated in a separate file that can be easily replaced whenever an updated library file becomes available.
In addition to loading the javascript from the external file, you can also use this feature to invoke javascript code contained within the {{{<script>...</script>}}} markers. This code is invoked //after// the external script file has been processed, and can make immediate use of the functions and/or global variables defined by the external script file.
>Note: To ensure that your javascript functions are always available when needed, you should load the libraries from a tiddler that is rendered as soon as your ~TiddlyWiki document is opened, such as MainMenu. For example: put your {{{<script src="..."></script>}}} syntax into a separate 'library' tiddler (e.g., ~LoadScripts), and then add {{{<<tiddler LoadScripts>>}}} to MainMenu so that the library is loaded before any other tiddlers that rely upon the functions it defines.
>
>Normally, loading external javascript in this way does not produce any direct output, and should not have any impact on the appearance of your MainMenu. However, if your ~LoadScripts tiddler contains notes or other visible content, you can suppress this output by using 'inline CSS' in the MainMenu, like this: {{{@@display:none;<<tiddler LoadScripts>>@@}}}
<<<
!!!!!Creating dynamic tiddler content and accessing the ~TiddlyWiki DOM
<<<
An important difference between ~TiddlyWiki inline scripting and conventional embedded javascript techniques for web pages is the method used to produce output that is dynamically inserted into the document: in a typical web document, you use the {{{document.write()}}} (or {{{document.writeln()}}}) function to output text sequences (often containing HTML tags) that are then rendered when the entire document is first loaded into the browser window.
However, in a ~TiddlyWiki document, tiddlers (and other DOM elements) are created, deleted, and rendered "on-the-fly", so writing directly to the global 'document' object does not produce the results you want (i.e., replacing the embedded script within the tiddler content), and instead will //completely replace the entire ~TiddlyWiki document in your browser window (which is clearly not a good thing!)//. In order to allow scripts to use {{{document.write()}}}, the plugin automatically converts and buffers all HTML output so it can be safely inserted into your tiddler content, immediately following the script.
''Note that {{{document.write()}}} can only be used to output "pure HTML" syntax. To produce //wiki-formatted// output, your script should instead return a text value containing the desired wiki-syntax content'', which will then be automatically rendered immediately following the script. If returning a text value is not sufficient for your needs, the plugin also provides an automatically-defined variable, 'place', that gives the script code ''direct access to the //containing DOM element//'' into which the tiddler output is being rendered. You can use this variable to ''perform direct DOM manipulations'' that can, for example:
* generate wiki-formatted output using {{{wikify("...content...",place)}}}
* vary the script's actions based upon the DOM element in which it is embedded
* access 'tiddler-relative' DOM information using {{{story.findContainingTiddler(place)}}}
Note:
''When using an 'onclick' script, the 'place' element actually refers to the onclick //link text// itself, instead of the containing DOM element.'' This permits you to directly reference or modify the link text to reflect any 'stateful' conditions that might set by the script. To refer to the containing DOM element from within an 'onclick' script, you can use "place.parentNode" instead.
<<<
!!!!!Instant "bookmarklets"
<<<
You can also use an 'onclick' link to define a "bookmarklet": a small piece of javascript that can be ''invoked directly from the browser without having to be defined within the current document.'' This allows you to create 'stand-alone' commands that can be applied to virtually ANY ~TiddlyWiki document... even remotely-hosted documents that have been written by others!! To create a bookmarklet, simply define an 'onclick' script and then grab the resulting link text and drag-and-drop it onto your browser's toolbar (or right-click and use the 'bookmark this link' command to add it to the browser's menu).
Notes:
*When writing scripts intended for use as bookmarklets, due to the ~URI-encoding required by the browser, ''you cannot not use ANY double-quotes (") within the bookmarklet script code.''
*All comments embedded in the bookmarklet script must ''use the fully-delimited {{{/* ... */}}} comment syntax,'' rather than the shorter {{{//}}} comment syntax.
*Most importantly, because bookmarklets are invoked directly from the browser interface and are not embedded within the ~TiddlyWiki document, there is NO containing 'place' DOM element surrounding the script. As a result, ''you cannot use a bookmarklet to generate dynamic output in your document,'' and using {{{document.write()}}} or returning wiki-syntax text or making reference to the 'place' DOM element will halt the script and report a "Reference Error" when that bookmarklet is invoked.
Please see ~InstantBookmarklets for many examples of 'onclick' scripts that can also be used as bookmarklets.
<<<
!!!!!Special reserved function name
<<<
The plugin 'wraps' all inline javascript code inside a function, {{{_out()}}}, so that any return value you provide can be correctly handled by the plugin and inserted into the tiddler. To avoid unpredictable results (and possibly fatal execution errors), this function should never be redefined or called from ''within'' your script code.
<<<
!!!!!$(...) 'shorthand' function
<<<
As described by Dustin Diaz [[here|http://www.dustindiaz.com/top-ten-javascript/]], the plugin defines a 'shorthand' function that allows you to write:
{{{
$(id)
}}}
in place of the normal standard javascript syntax:
{{{
document.getElementById(id)
}}}
This function is provided merely as a convenience for javascript coders that may be familiar with this abbreviation, in order to allow them to save a few bytes when writing their own inline script code.
<<<
!!!!!Examples
<<<
simple dynamic output:
><script show>
document.write("The current date/time is: "+(new Date())+"<br>");
return "link to current user: [["+config.options.txtUserName+"]]\n";
</script>
dynamic output using 'place' to get size information for current tiddler:
><script show>
if (!window.story) window.story=window;
var title=story.findContainingTiddler(place).getAttribute("tiddler");
var size=store.getTiddlerText(title).length;
return title+" is using "+size+" bytes";
</script>
dynamic output from an 'onclick' script, using {{{document.write()}}} and/or {{{return "..."}}}
><script label="click here" show>
document.write("<br>The current date/time is: "+(new Date())+"<br>");
return "link to current user: [["+config.options.txtUserName+"]]\n";
</script>
creating an 'onclick' button/link that accesses the link text AND the containing tiddler:
><script label="click here" title="clicking this link will show an 'alert' box" key="H" show>
if (!window.story) window.story=window;
var txt=place.firstChild.data;
var tid=story.findContainingTiddler(place).getAttribute('tiddler');
alert('Hello World!\nlinktext='+txt+'\ntiddler='+tid);
</script>
dynamically setting onclick link text based on stateful information:
>{{block{
{{{
<script label="click here">
/* toggle "txtSomething" value */
var on=(config.txtSomething=="ON");
place.innerHTML=on?"enable":"disable";
config.txtSomething=on?"OFF":"ON";
return "\nThe current value is: "+config.txtSomething;
</script><script>
/* initialize onclick link text based on current "txtSomething" value */
var on=(config.txtSomething=="ON");
place.lastChild.previousSibling.innerHTML=on?"disable":"enable";
</script>
}}}
<script label="click here">
/* toggle "txtSomething" value */
var on=(config.txtSomething=="ON");
place.innerHTML=on?"enable":"disable";
config.txtSomething=on?"OFF":"ON";
return "\nThe current value is: "+config.txtSomething;
</script><script>
/* initialize onclick link text based on current "txtSomething" value */
var on=(config.txtSomething=="ON");
place.lastChild.innerHTML=on?"enable":"disable";
</script>
}}}
loading a script from a source url:
>http://www.TiddlyTools.com/demo.js contains:
>>{{{function inlineJavascriptDemo() { alert('Hello from demo.js!!') } }}}
>>{{{displayMessage('InlineJavascriptPlugin: demo.js has been loaded');}}}
>note: When using this example on your local system, you will need to download the external script file from the above URL and install it into the same directory as your document.
>
><script src="demo.js" show>
return "inlineJavascriptDemo() function has been defined"
</script>
><script label="click to invoke inlineJavascriptDemo()" key="D" show>
inlineJavascriptDemo();
</script>
<<<
!!!!!Revisions
<<<
2010.12.15 1.9.6 allow (but ignore) type="..." syntax
2009.04.11 1.9.5 pass current tiddler object into wrapper code so it can be referenced from within 'onclick' scripts
2009.02.26 1.9.4 in $(), handle leading '#' on ID for compatibility with ~JQuery syntax
2008.06.11 1.9.3 added $(...) function as 'shorthand' for document.getElementById()
2008.03.03 1.9.2 corrected fallback declaration of wikifyPlainText() (fixes Safari "parse error")
2008.02.23 1.9.1 in onclick function, use string instead of array for 'bufferedHTML' (fixes IE errors)
2008.02.21 1.9.0 output from 'onclick' scripts (return value or document.write() calls) are now buffered and rendered into into a span following the script. Also, added default 'return false' handling if no return value provided (prevents HREF from being triggered -- return TRUE to allow HREF to be processed). Thanks to Xavier Verges for suggestion and preliminary code.
2008.02.14 1.8.1 added backward-compatibility for use of wikifyPlainText() in ~TW2.1.3 and earlier
2008.01.08 [*.*.*] plugin size reduction: documentation moved to ...Info tiddler
2007.12.28 1.8.0 added support for key="X" syntax to specify custom access key definitions
2007.12.15 1.7.0 autogenerate URI encoded HREF on links for onclick scripts. Drag links to browser toolbar to create bookmarklets. IMPORTANT NOTE: place is NOT defined when scripts are used as bookmarklets. In addition, double-quotes will cause syntax errors. Thanks to ~PaulReiber for debugging and brainstorming.
2007.11.26 1.6.2 when converting "document.write()" function calls in inline code, allow whitespace between "write" and "(" so that "document.write ( foobar )" is properly converted.
2007.11.16 1.6.1 when rendering "onclick scripts", pass label text through wikifyPlainText() to parse any embedded wiki-syntax to enable use of HTML entities or even TW macros to generate dynamic label text.
2007.02.19 1.6.0 added support for title="..." to specify mouseover tooltip when using an onclick (label="...") script
2006.10.16 1.5.2 add newline before closing '}' in 'function out_' wrapper. Fixes error caused when last line of script is a comment.
2006.06.01 1.5.1 when calling wikify() on script return value, pass hightlightRegExp and tiddler params so macros that rely on these values can render properly
2006.04.19 1.5.0 added 'show' parameter to force display of javascript source code in tiddler output
2006.01.05 1.4.0 added support 'onclick' scripts. When label="..." param is present, a button/link is created using the indicated label text, and the script is only executed when the button/link is clicked. 'place' value is set to match the clicked button/link element.
2005.12.13 1.3.1 when catching eval error in IE, e.description contains the error text, instead of e.toString(). Fixed error reporting so IE shows the correct response text. Based on a suggestion by ~UdoBorkowski
2005.11.09 1.3.0 for 'inline' scripts (i.e., not scripts loaded with src="..."), automatically replace calls to 'document.write()' with 'place.innerHTML+=' so script output is directed into tiddler content. Based on a suggestion by ~BradleyMeck
2005.11.08 1.2.0 handle loading of javascript from an external URL via src="..." syntax
2005.11.08 1.1.0 pass 'place' param into scripts to provide direct DOM access
2005.11.08 1.0.0 initial release
<<<</pre>
</div>
<div title="Install" modifier="YourName" created="201201071417" modified="201902151503" tags="NoTag" changecount="60">
<pre>{{firstletter{
@@color:#930;D@@
}}}epending on the office suite you are using and its version, the installation instructions may vary.
!For LIBREOFFICE users only
The //~Access2Base// library is included in ~LibreOffice as from its version 4.2. If you run that or a later version, then ''~Access2Base is already installed'' on your device. As such ... skip the installation of the extension and go to the ''__Start using the library__'' paragraph below.
If you are using ~Access2Base with ~LibreOffice in a version earlier than 4.2, then __REMOVE the ~Access2Base extension__ before installing ~LibreOffice 4.2 or later.
| !~LibreOffice version | !Embedded ~Access2Base version | !Ịnstallation / upgrade instructions |
| <= 4.1 | None |See ''__Install ~Access2Base as an extension__'' below. |
| 4.2 | 1.0.0 |Go to ''__Start using the library__'' below. |
| 4.3 | 1.1.0 |~|
| 4.4 | 1.2.0 |~|
| 5.0 | 1.3.0 |~|
| 5.1 | 1.4.0 |~|
| 5.2 | 1.5.0 |~|
| 5.3 | 1.6.0 |~|
| 5.4 | 1.7.0 |~|
| 6.0 | 1.8.0 |~|
| 6.1 | 1.9.0 |~|
|''If you would like to benefit from the latest version of ~Access2Base (typically 1.9.0) but, for any reason, want to stay in an older version of ~LibreOffice (typically 6.0), then you might decide anyway to download and install the extension as described below.<br />This option is available only as from __~LibreOffice 4.2.6__.<br /><br />However, before upgrading later on ~LibreOffice to a newer major release (typically 6.1), first __REMOVE the ~Access2Base extension__.'' |>|>|
!Install ~Access2Base as an extension (DEPRECATED)
!!Download //~Access2Base// either from the
*[[OpenOffice extensions repository|http://extensions.services.openoffice.org/en/project/access2base]]
*[[LibreOffice extensions center|http://extensions.libreoffice.org/extension-center/access2base]]
The downloaded contents are identical if their version numbers are identical too.
>''Starting from version 6.2.0, ~Access2Base is not available as an extension anymore. To benefit from its features, install ~LibreOffice (>=) 6.2.''
!!Install the //~Access2Base// extension
The name of he downloaded file is __~Access2Base.oxt__. Select preferably the last proposed version.
Note: //some browsers might download the extension as a .zip file; if this happens rename the downloaded file from .zip to .oxt//
Install the extension as any other extension. To know more, follow the instructions in [[Installing an extension (AOO)|https://wiki.openoffice.org/wiki/Documentation/Administration_Guide/Using_Package_Manager]] or in [[Installing an extension (LibO)|https://wiki.documentfoundation.org/Documentation/HowTo/install_extension]]
The Basic IDE ...
... has now 2 more options:
#The {{{Tools + Add-Ons + Access2Base Console ...}}} menu item opens the ~Access2Base console (see the [[Error Handler]]).
#The {{{Help + Access2Base Online Help}}} menu item opens the current Help file in your preferred browser.
!Start using the library
To be able to invoke the //~Access2Base// API from a AOO/~LibO ".odb" file (the usual suffix for the front-end part of database documents) you have to
*Have a minimal knowledge of the Basic IDE and of the Basic programming language.
*Open in the main AOO/~LibO Base window the ".odb" file (the database document) on which you would like to apply ~Access2Base functions.
*With {{{Tools + Macros + Organize Macros + OpenOffice/LibreOffice Basic...}}} open the Basic IDE and create a Basic module in the Standard library of the database document itself. The module should contain as a minimum next code:
<<tiddler "Openconnection example">>
*Assign in the main Base window with menu items {{{Tools + Customize...}}} ({{{Events}}} tab) the above Sub ("~DBOpen" in the example but use the name of your choice) to the //~OpenDocument// event. Save in the ".odb" file itself.
*//Close// and re-//open// the ".odb" file. This will trigger the //~OpenDocument// event.
*__Optionally__ associate next code with the //"View is going to be closed"// document event.
//{{{
Sub DBClose(Optional poEvent As Object)
Call CloseConnection()
End Sub
//}}}
*Start programming macro's. Associate them with //form// or //control events// if relevant.
Caution: the procedure is different for [[Standalone Forms]].
!!If no database connection ...
<<tiddler "RunWithoutConnection">>
!!See also
[[OpenConnection]]
[[Standalone Forms]]
!!Releases History
<<tiddler "ReleaseNotes">></pre>
</div>
<div title="IsLoaded" modifier="Jean-PierreLedure" created="201107171306" modified="201306151428" tags="Properties">
<pre>You can use the //~IsLoaded// property to specify if a form or dialog is currently loaded.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |A form, either open or not |
|[[Dialog]] |A dialog, active or not |
!!!Syntax
//form//{{{.IsLoaded}}}
//dialog//{{{.IsLoaded}}}
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
The //~IsLoaded// property is read-only
!!!Error messages
!!!See also
!!!Example
<<tiddler "IsLoaded example">></pre>
</div>
<div title="IsLoaded example" modifier="Jean-Pierre Ledure" created="201107171304" modified="201408011456" tags="[[Snippets of Code]]" changecount="1">
<pre>List all forms and specify which ones are open
//{{{
Dim ofForm As Object, iCount As Integer, i As Integer
iCount = AllForms.Count
For i = 0 To iCount - 1
Set ofForm = AllForms(i)
With ofForm
Print "Form " & .Name & " is " & Iif(.IsLoaded, "", "NOT ") & "open"
End With
Next i
Print
//}}}</pre>
</div>
<div title="Item" modifier="Jean-Pierre Ledure" created="201308131050" modified="201405311123" tags="Properties" changecount="5">
<pre>The //Item// property identifies a member of a [[collection|Collection]] by its name or its index.
!!!Applies to ...
| !Collection |!Description |
|[[AllDialogs]] |All dialogs present in any of the accessible dialog libraries |
|[[AllForms]] |All forms, open or closed, in the current database document (".odb" file) |
|[[Controls]] |All the controls of a //form//, a //dialog//, a //subform// or a //gridcontrol// |
|[[Fields]] |All the fields of a //table//, a //query// or a //recordset// |
|[[Forms]] |All open forms |
|[[Properties|Properties (collection)]] |All properties of an object |
|[[QueryDefs]] |All queries in the database |
|[[Recordsets]] |All recordsets currently open |
|[[TableDefs]] |All tables in the database |
!!!Syntax
//collection//{{{.Item(}}}//index//{{{)}}}
//collection//{{{.Item(}}}//name//{{{)}}}
!!!Arguments / Returned values
| !Argument | !Type | !Returned value |
|index | Integer<br />Long |An {{{Object}}} of the collection. |
|name | String |~|
!!!Remarks
*The //Item// property is read-only.
*The //index// argument must have a value in the interval 0 to {{{Count - 1}}}.
!!!Error messages
!!!See also
[[Count]]
!!!Example
<<tiddler "Item example">></pre>
</div>
<div title="Item example" modifier="Jean-PierreLedure" created="201308141504" modified="201308141504" tags="[[Snippets of Code]]">
<pre>Document all database queries
//{{{
Dim oQueryDefs As Object, oFields As Object, oProperties As Object, oProperty As Object
Dim i As Integer, j As Integer, k As Integer
Set oQueryDefs = Application.CurrentDb().QueryDefs
for i = 0 to oQueryDefs.Count - 1
Set oFields = oQueryDefs.Item(i).Fields()
For j = 0 to oFields.Count - 1
Set oProperties = oFields.Item(j).Properties
for k = 0 to oProperties.Count - 1
Set oProperty = oProperties.Item(k)
DebugPrint oQueryDefs.Item(i).Name, oFields.Item(j).Name, _
oProperty.Name, oProperty.Value
next k
next j
next i
//}}}</pre>
</div>
<div title="ItemData" modifier="Jean-Pierre Ledure" created="201108181232" modified="201405241128" tags="Properties" changecount="1">
<pre>The //~ItemData// property returns the data in the bound column for the specified row in a combo box or list box.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] | [[ComboBox]]<br />[[ListBox]] | [[ComboBox]]<br />[[ListBox]] | [[ComboBox]]<br />[[ListBox]] |A combo- or listbox on an open form or dialog, or in a [[GridControl]]|
!!!Syntax
//control//{{{.ItemData}}}
//control//{{{.ItemData(index)}}}
!!!Returned values / Arguments
{{{Array of Strings}}} (might be empty) if index is absent
{{{String}}} (might be null string) if index is present
!!!Remarks
*The //~ItemData// property is read-only. To modify the list of items displayed in a //~ComboBox// or a //~ListBox//, use the [[RowSource]] and [[RowSourceType]] properties.
*The //index// argument must have a (integer or long) value between 0 and (ListCount - 1)
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Property '~ItemData' not applicable in this context |
|Out of array range or incorrect array size for property '~ItemData'|
!!!See also
[[ListCount]]
[[ListIndex]]
[[MultiSelect]]
[[RowSource]]
[[RowSourceType]]
[[Selected]]
!!!Example
*Combo box
<<tiddler "ComboBox example">>
*List box
<<tiddler "ListBox example">></pre>
</div>
<div title="KeepFormsSynchro" modifier="Jean-Pierre Ledure" created="201212241514" modified="201408011519" tags="HowTo" changecount="1">
<pre>(Q) I can't put all the numerous fields of a table on one single form. I need several forms and will navigate thru them with buttons. Of course, when I navigate thru records, I want to keep all open forms synchronized with the active one. How can I get that ?
(R) The synchronization will be obtained by using subforms and filters. However the challenge is to have one single concise code to do all the job.
Let's consider next tables:
<<tiddler "OrdersTable">>
<<tiddler "OrderDetailsTable">>
<<tiddler "CustomersTable">>
<<tiddler "ProductsTable">>
<<tiddler "EmployeesTable">>
We will use 4 forms:
*a //main// form and its subform for displaying Orders and their ~OrderDetails.
*3 //auxiliary// forms for displaying on request more details about the concerned Customer, Product or Employee.
*3 buttons (one for each of the 3 //auxiliary// forms) available from the //main// form activating the corresponding //auxiliary// form.
The trick is that when navigating among orders or order details, the open //auxiliary// forms remain synchronized with the //main// form and its subform.
!!!Synchronize all forms
Link next code to next events:
*//After record change// in the form events list
*//Mouse button pressed// control events of each of the 3 buttons
*//After record change// in the ''sub''form events list
//{{{
Sub SyncForms(poEvent As Object)
Dim ofForm As Object, oeEvent As Object, oTrigger As Object, oMainForm As Object
Dim sFilter As String, sEmployee As String, sCustomer As String, sProduct As String
Dim i As Integer, sForm As String
Const cstMainForm = "Orders_Details_Sync_Cust-Prod-Emp"
Const cstSuffix = "_Sync_Orders" ' Suffix of auxiliary form names
Set oeEvent = Events(poEvent)
Set oTrigger = oeEvent.Source ' Determine the trigger: one of the buttons ? or record navigation in main form ?
' or record navigation in subform ?
Set oMainForm = AllForms(cstMainForm)
If Not oMainForm.IsLoaded Then Goto Exit_Sub ' May happen at form loading or closure
If Left(oTrigger.Name, Len("btn")) = "btn" Then ' Triggered by buttons btnCustomers, btnProducts or btnEmployees
sForm = Right(oTrigger.Name, Len(oTrigger.Name)- Len("btn")) & cstSuffix
Set ofForm = AllForms(sForm) ' AllForms() collects all forms, whether open or not
If ofForm.IsLoaded Then ofForm.SetFocus() Else OpenForm(sForm)
End If
'Determine filters
sCustomer = "[CustomerID]='" & oMainForm.Controls("txtCustomerID").Value & "'" ' String !!!
sProduct = "[ProductID]=" & oMainForm.Controls("SubForm").Form.Controls("SubForm_Grid").Controls("ProductID").Value
sEmployee = "[EmployeeID]=" & oMainForm.Controls("fmtEmployeeID").Value
For i = 0 To Forms().Count - 1 ' Forms() collects all open forms
Set ofForm = Forms(i)
sFilter = ""
Select Case Split(ofForm.Name, cstSuffix)(0)
Case "Customers" : sFilter = sCustomer
Case "Products" : sFilter = sProduct
Case "Employees" : sFilter = sEmployee
Case Else ' Ignore any other open form
End Select
If Len(sFilter) > 0 Then
ofForm.Filter = sFilter
ofForm.FilterOn = True
End If
Next i
Exit_Sub:
Set ofForm = Nothing
Set oeEvent = Nothing
Set oTrigger =Nothing
Set oMainForm = Nothing
Exit Sub
End Sub
//}}}
!!!To close all the forms simultaneously when the main form is closed
Link next Sub to the //Closed a sub component// event of the database file (Use the {{{Tools + Customize ... + Events}}} menu items).
//{{{
Sub SyncCloseForms(poEvent As Object)
' Fired at each component closure !!
Dim oEvent As Object
Const acForm = 2
Const cstMainForm = "Orders_Details_Sync_Cust-Prod-Emp"
Set oEvent = Events(poEvent)
If UCase(oEvent.SubComponentName) <> UCase(cstMainForm) Then Exit Sub
DoCmd.mClose acForm, "Customers_Sync_Orders"
DoCmd.mClose acForm, "Employees_Sync_Orders"
DoCmd.mClose acForm, "Products_Sync_Orders"
Exit Sub
End Sub
//}}}
!!!See also
[[AllForms]]
[[Close (method)]]
[[Event]]
[[Filter]]
[[FilterOn]]
[[Forms]]
!!!Refer to ...
| !Basic module | !Database event | !Form | !Form event | !~SubForm | !~SubForm event | !Control | !Control event |!Comments |
|Synchro |Closed a sub-component | ~Orders_Details_Sync_Cust-Prod-Emp<br />~Customers_Sync_Orders<br />~Employees_Sync_Orders<br />~Products_Sync_Orders |After record change |~SubForm |After record change | btnCustomers<br />btnEmployees<br />btnProducts |Mouse button pressed ||</pre>
</div>
<div title="LimitsRecordset" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201405311333" modified="201406161406" tags="HowTo" changecount="16">
<pre>(Q) When browsing thru a //recordset//, how can I identify that I reached the end ?
(R) In a [[Recordset object|Recordset]], if you try to move beyond the beginning or ending record, an error occurs. For example, if you try to use the [[MoveNext|Move (recordset)]] method when you are already at the last record of the //Recordset//, an error occurs. For this reason, it is helpful to know the limits of the //Recordset// object.
The [[BOF|BOF, EOF]] property indicates whether the current position is at the beginning of the //Recordset//. If //BOF// is {{{True}}}, the current position is before the first record in the //Recordset//. The //BOF// property is also {{{True}}} if there are no records in the //Recordset// when it is opened. Similarly, the [[EOF|BOF, EOF]] property is {{{True}}} if the current position is after the last record in the //Recordset//, or if there are no records.
The following code example shows how to use the //BOF// and //EOF// properties to detect the beginning and end of a //Recordset// object. This code fragment creates a //Recordset// based on the ''Orders table'' from the current database. It moves through the records, first from the beginning of the //Recordset// to the end, and then from the end of the //Recordset// to the beginning.
//{{{
Dim odbNorthwind As Object
Dim orsOrders As Object
Set odbNorthwind = Application.CurrentDb
Set orsOrders = odbNorthwind.OpenRecordset("Orders")
' Do until ending of file.
Do Until orsOrders.EOF
' Manipulate the data.
orsOrders.MoveNext ' Move to the next record.
Loop
orsOrders.MoveLast ' Move to the last record.
' Do until beginning of file.
Do Until orsOrders.BOF
' Manipulate the data.
orsOrders.MovePrevious ' Move to the previous record.
Loop
orsOrders.mClose()
//}}}
Be aware that there is no current record immediately following the first loop. The //BOF// and //EOF// properties both have the following characteristics.
*If the //Recordset// contains no records when you open it, both //BOF// and //EOF// are {{{True}}}.
*When //BOF// or //EOF// is {{{True}}}, the property remains {{{True}}} until you move to an existing record, at which time the value of //BOF// or //EOF// becomes {{{False}}}.
*At the moment you create or open a //Recordset// that contains at least one record, the first record is the current record, and both //BOF// and //EOF// are {{{False}}}.
*If the first record is the current record when you use the [[MovePrevious|Move (recordset)]] method, //BOF// is set to {{{True}}}. If you use //~MovePrevious// while //BOF// is {{{True}}}, an error occurs. When this happens, //BOF// remains {{{True}}} and there is no current record.
*Similarly, moving past the last record in the //Recordset// changes the value of the //EOF// property to True. If you use the //~MoveNext// method while //EOF// is {{{True}}}, an error occurs.
!!!See also
[[BOF, EOF]]
[[MoveFirst, MoveLast, MoveNext, MovePrevious|Move (recordset)]]
[[OpenRecordset]]
!!!Refer to ...
| !Basic module | !Sub |!Comments |
|~HowTo |~FindLimitsRecordset ||
</pre>
</div>
<div title="Lines" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181409" modified="201612181427" tags="Properties" changecount="4">
<pre>The //Lines// property returns a string containing the contents of a specified line or lines in a standard or a class [[module|Module]].
!!!Applies to ...
| !Object |!Description |
|[[Module]] |The representation of a Basic script. |
!!!Syntax
//module//{{{.Lines(}}}//line, numlines//{{{)}}}
!!!Returned values / Arguments
| !Argument | !Type | !Description | !Returned type |
|module | Object |The concerned module. | String |
|line | Long |The number of the first line to return. |~|
|numlines | Long |The number of lines to return. |~|
!!!Remarks
The requested lines are returned as one single string. The individual lines are separated by a line feed (Chr(10)) character.
Lines in a module are numbered beginning with 1. For example, if you read the //Lines// property with a value of 1 for the //line// argument and 1 for the //numlines// argument, the //Lines// property returns a string containing the text of the first line in the module.
!!!Error messages
|Property 'Lines' not applicable in this context |
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[CountOfDeclarationLines]]
[[CountOfLines]]
!!!Example
<<tiddler "Module example">></pre>
</div>
<div title="LinkChildFields" modifier="Jean-Pierre Ledure" created="201108131647" modified="201405241128" tags="Properties" changecount="1">
<pre>You can use the ~LinkChildFields property (along with the LinkMasterFields property together) to know how the records in a form are linked to records in a subform.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl |!Description |
|[[Control]] | [[SubForm]] | None |A subform of an open form or another subform |
!!!Syntax
//control//{{{.LinkChildFields}}}
//control//{{{.LinkChildFields(index)}}}
!!!Returned values
Array of {{{Strings}}} or {{{String}}}
!!!Remarks
The ~LinkChildFields property is read-only.
The array can be empty. In this case the {{{UBound()}}} function applied on that array will return {{{-1}}}.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Property '~LinkChildFields' not applicable in this context |
|Out of array range or incorrect array size for property '~LinkChildFields' |
!!!See also
[[LinkMasterFields]]
!!!Example
<<tiddler "Linkfields example">></pre>
</div>
<div title="LinkMasterFields" modifier="Jean-Pierre Ledure" created="201108131633" modified="201405241128" tags="Properties" changecount="1">
<pre>You can use the ~LinkMasterFields property (along with the LinkChildFields property together) to know how the records in a form are linked to records in a subform.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl |!Description |
|[[Control]] | [[SubForm]] | None |A subform of an open form or another subform |
!!!Syntax
//control//{{{.LinkMasterFields}}}
//control//{{{.LinkMasterFields(index)}}}
!!!Returned values
Array of {{{Strings}}} or {{{String}}}
!!!Remarks
The ~LinkMasterFields property is read-only.
The array can be empty. In this case the {{{UBound()}}} function applied on that array will return {{{-1}}}.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Property '~LinkMasterFields' not applicable in this context |
|Out of array range or incorrect array size for property '~LinkMasterFields' |
!!!See also
[[LinkChildFields]]
!!!Example
<<tiddler "Linkfields example">></pre>
</div>
<div title="Linkfields example" modifier="Jean-PierreLedure" created="201108131630" modified="201212091200" tags="[[Snippets of Code]]">
<pre>List all the master / children fields of a subform
//{{{
Dim ocSubform As Object, i As Integer, iCount As Integer
Set ocSubform = getValue("Forms!myForm!mySubform.Form")
iCount = UBound(ocSubform.LinkMasterFields)
For i = 0 To iCount
Print "Master " & ocSubform.LinkMasterFields(i) & " is linked to " & ocSubform.LinkChildFields(i),
Next i
Print
//}}}</pre>
</div>
<div title="ListBox" modifier="YourName" created="201108171432" modified="201802231510" tags="[[Special controls]]" changecount="7">
<pre>{{firstletter{
@@color:#930;A@@
}}} //~ListBox// describes a list box control. It has specific properties to manage the input list of potential values and to select one or more of them programmatically.
A ~ListBox control is returned by the [[Controls]] collection or by the [[getObject]] shortcut.
!!!Specific properties for list box management
| !Property | !Type | !Read only | !Description |
|[[ItemData]] | Variant array | Y |Returns the data for the specified row in a combo box or list box. |
|[[ListCount]] | Integer<br />Long | Y |Determines the number of rows in a ~ListBox or the list box portion of a [[ComboBox]]. |
|[[ListIndex]] | Integer<br />Long ||Determines which item is selected in a ~ListBox or a [[ComboBox]]. |
|[[MultiSelect]] | Boolean ||Specifies whether a user can make multiple selections in a ~ListBox on a form. |
|[[RowSource]] | String ||Specifies the source (tablename, queryname or SQL statement) of the data in a ~ListBox or a [[ComboBox]]. |
|[[RowSourceType]] | Integer<br />Long ||Specifies the type of source (table, query or SQL statement) of the data in a ~ListBox or a [[ComboBox]]. |
|[[Selected]] | Boolean array ||Specifies if an item in the data proposed by a ~ListBox is currently selected. |
|[[Value]] | Variant ||Specifies the value contained in the (~MultiSelect = False !) ~ListBox. |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[AddItem]] | String |Boolean|Add a new item to the list of displayed values. |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the ~ListBox has the given property. |
|[[RemoveItem]] | String<br />Integer |~|Remove an item from the list of displayed values. |
|[[Requery]] | none |~|True if data reloaded in the ~ListBox |
|[[SetFocus]] |~|~|Return True if focus set on Control successfully. |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
!!!Remarks
*A //~ListBox// may or not have a second (hidden) column which is bound to the underlying data in the database. It is most often an index, the visible column being a readable label associated with that index. When it is the case the //Value// property contains the value in the index column.
*If no item is selected in the //~ListBox//, the //~ListIndex// property is set to {{{-1}}} and the //Selected// array contains {{{False}}} in all its entries. If //~MutliSelect// is {{{True}}} then //~ListIndex// always returns {{{-1}}}
!!!See also
[[ComboBox]]
!!!Example
<<tiddler "ListBox example">></pre>
</div>
<div title="ListBox example" modifier="Jean-Pierre Ledure" created="201108171620" modified="201405300629" tags="[[Snippets of Code]]" changecount="1">
<pre>Display the selected rows of a (multiselect) listbox
//{{{
Dim i As Integer, ocList As Object
Set ocList = getObject("Forms!myForm!myListBox")
For i = 0 To ocList.ListCount - 1
If ocList.Selected(i) Then Print i & " - " & ocList.ItemData(i),
Next i
//}}}
Select all options
//{{{
For i = 0 To ocList.ListCount - 1
setSelected(ocList, True, i)
Next i
Print
//}}}</pre>
</div>
<div title="ListCount" modifier="Jean-PierreLedure" created="201108181254" modified="201306151422" tags="Properties">
<pre>You can use the //~ListCount property// to determine the number of rows in a list box or the list box portion of a combo box.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] | [[ComboBox]]<br />[[ListBox]] | [[ComboBox]]<br />[[ListBox]] | [[ComboBox]]<br />[[ListBox]] |A combo- or listbox on an open form or dialog, or in a [[GridControl]]|
!!!Syntax
//control//{{{.ListCount}}}
!!!Returned values
{{{Long}}}
!!!Remarks
The //~ListCount// property is read-only.
!!!Error messages
|Property '~ListCount' not applicable in this context |
!!!See also
[[ItemData]]
[[ListIndex]]
[[MultiSelect]]
[[RowSource]]
[[RowSourceType]]
[[Selected]]
!!!Example
*Combo box
<<tiddler "ComboBox example">>
*List box
<<tiddler "ListBox example">></pre>
</div>
<div title="ListIndex" modifier="Jean-Pierre Ledure" created="201108181302" modified="201405291558" tags="Properties" changecount="1">
<pre>You can use the //~ListIndex// property to determine which item is selected in a list box or combo box.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] | [[ComboBox]]<br />[[ListBox]] | [[ComboBox]]<br />[[ListBox]] | [[ComboBox]]<br />[[ListBox]] |A combo- or listbox on an open form or dialog, or in a [[GridControl]]|
!!!Syntax
//control//{{{.ListIndex}}}
//control//{{{.ListIndex}}} = //value//
!!!Returned values / Arguments
{{{Long}}} in interval [0, //~ListCount// - 1] or (-1)
!!!Remarks
If the control is a [[MultiSelect]] listbox, or if there is no item selected, then the //~ListIndex// property always returns {{{-1}}}
!!!Error messages
|Property '~ListIndex' not applicable in this context |
|Value '...' is invalid for property '~ListIndex' |
!!!See also
[[ItemData]]
[[ListCount]]
[[MultiSelect]]
[[RowSource]]
[[RowSourceType]]
[[Selected]]
!!!Example
*Combo box
<<tiddler "ComboBox example">>
*List box
<<tiddler "ListBox example">></pre>
</div>
<div title="Locked" modifier="Jean-PierreLedure" created="201108051500" modified="201306151423" tags="Properties">
<pre>The //Locked// property specifies if the control is read only.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |[[ComboBox]]<br />~CurrencyField<br />~DateField<br />~FileControl<br />~FormattedField<br />~ImageControl<br />[[ListBox]]<br />~NumericField<br />~PatternField<br />~TextField<br />~TimeField | All except<br />--~CheckBox-- |[[ComboBox]]<br />~CurrencyField<br />~DateField<br />~FileControl<br />~FormattedField<br />[[ListBox]]<br />~NumericField<br />~PatternField<br />~TextField<br />~TimeField |A control on an open form, a dialog or a [[GridControl]] |
!!!Syntax
//control//{{{.Locked}}}
//control//{{{.Locked}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
!!!Error messages
|Property 'Locked' not applicable in this context |
|Value '...' is invalid for property 'Locked' |
!!!See also
[[Enabled]]
!!!Example
<<tiddler "Enabled & Locked example">></pre>
</div>
<div title="MSAccessCoverage" creator="Jean-Pierre Ledure" modifier="YourName" created="201406281616" modified="201804241258" tags="NoTag" changecount="75">
<pre>{{firstletter{
@@color:#930;A@@
}}} detailed info has been compiled in this page about which actions and which objects, as they exist in //~MSAccess 2013//, have been - partly or more completely - already implemented in //~Access2Base//. A @@background-color:#ff3;perspective for future developments@@ of //~Access2Base// is also given in terms of interest for users and of complexity of implementation.
!Access objects
| !OBJECTS |>|>|>|>| ''__FUNCTIONALITY__'' |>|>|>|background-color:#eee; ''__IMPLEMENTATION__'' | !Comments |
|~| !Done | !Could be improved | !Very nice to have | !Nice to have | !Not applicable | !Out of Reach | !Complex | !Average | !Easy |~|
|''"""AccessObject"""'' | | | | X | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Generic object for forms, queries, ..., database objects""" |
|''"""AccessObjectProperties"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Similar to Properties""" |
|''"""AccessObjectProperty"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Similar to Property""" |
|''"""AdditionalData"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Linked to ExportXML method""" |
|''"""AllDatabaseDiagrams"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""AllForms"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""AllFunctions"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""List VBA code""" |
|''"""AllMacros"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""MSAccess macro's <> LibO/AOO macro's""" |
|''"""AllModules"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""List VBA code""" |
|''"""AllQueries"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Redundant with QueryDefs collection""" |
|background-color:#ff3;''"""AllReports"""'' | | | X | | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; | |
|''"""AllStoredProcedures"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""RDBMS dependent""" |
|''"""AllTables"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Redundant with TableDefs collection""" |
|''"""AllViews"""'' | | | | X | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""RDBMS views are seen as Tables in Base""" |
|''"""Application"""'' | X | X | | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Extensions to form, report design are Out of Reach""" |
|''"""Attachment"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Access database fields can hold file attachments""" |
|''"""AutoCorrect"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Dictionaries/Thesaurus linked""" |
|''"""BoundObjectFrame"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""For OLE objects stored in databases""" |
|''"""CheckBox"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Inherited from Control""" |
|''"""CodeData"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""The database from which the code is executed""" |
|''"""CodeProject"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""ComboBox"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Inherited from Control""" |
|''"""CommandButton"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""Control"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Most Control types do not match between MSAccess and Base""" |
|''"""Controls"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""CurrentData"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""The server database, usually SQL Server""" |
|''"""CurrentProject"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""CustomControl"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""ActiveX control""" |
|''"""DependencyInfo"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Dependency between database objects (e.g. in which queries is a table used ?)""" |
|''"""DependencyObjects"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""DoCmd"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""See DoCmd Actions sheet""" |
|''"""EmptyCell"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Form or Report design mode""" |
|''"""Entities"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Entity"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Related to Microsoft Business Connectivity Services (BCS)""" |
|''"""Form"""'' | X | X | | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; |"""TBC event handling""" |
|''"""FormatCondition"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Most Control types do not match between MSAccess and Base""" |
|''"""FormatConditions"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Forms"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""GroupLevel"""'' | | | X | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Related to Report object""" |
|''"""Hyperlink"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Too specific""" |
|''"""Image"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Inherited from Control""" |
|''"""ImportExportSpecification"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""See TransferXXX actions in DoCmd""" |
|''"""ImportExportSpecifications"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Label"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Inherited from Control""" |
|''"""Line"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Inherited from Control, for Dialogs only""" |
|''"""ListBox"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Inherited from Control""" |
|''"""MacroError"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""MSAccess macro's !""" |
|''"""Module"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""VBA Code""" |
|''"""Modules"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""NavigationButton"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""NavigationControl"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Inherited from Control""" |
|''"""ObjectFrame"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Pictures in forms""" |
|''"""Operation"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Related to Microsoft Business Connectivity Services (BCS)""" |
|''"""Operations"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""OptionButton"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Inherited from Control""" |
|''"""OptionGroup"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Page"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Only for Dialogs""" |
|background-color:#ff3;''"""PageBreak"""'' | | | | X | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""See Report object""" |
|''"""Pages"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Printer"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""TBC""" |
|''"""Printers"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""Properties"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Rectangle"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""No such objects in Base Forms""" |
|''"""Reference"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Windows specific""" |
|''"""References"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""Report"""'' | | | X | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""Reports"""'' | | | X | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; X | |
|''"""ReturnVar"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""MSAccess macro's specific""" |
|''"""ReturnVars"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""Screen"""'' | | | X | | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; |"""To manage active window""" |
|''"""Section"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""To manage headers, footers, pages of a form""" |
|''"""SharedResource"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Microsoft Office shared resources""" |
|''"""SharedResources"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""SmartTag"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Microsoft Office specific""" |
|''"""SmartTagAction"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""SmartTagActions"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""SmartTagProperties"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""SmartTagProperty"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""SmartTags"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""SubForm"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""TBC event handling""" |
|''"""TabControl"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Most Control types do not match between MSAccess and Base""" |
|''"""TempVar"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""To store "Global" variables accessible from any document""" |
|''"""TempVars"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""TextBox"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Inherited from Control""" |
|''"""ToggleButton"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""WebBrowserControl"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Web frame in form""" |
|''"""WebService"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Related to Microsoft Business Connectivity Services (BCS)""" |
|''"""WebServices"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""WSParameter"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""WSParameters"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
!~DataAccess objects
| !OBJECTS |>|>|>|>| ''__FUNCTIONALITY__'' |>|>|>|background-color:#eee; ''__IMPLEMENTATION__'' | !Comments |
|~| !Done | !Could be improved | !Very nice to have | !Nice to have | !Not applicable | !Out of Reach | !Complex | !Average | !Easy |~|
|''"""ComplexType"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""For multi-valued fields""" |
|''"""Connection"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Confused with Database object""" |
|''"""Connections"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Connections of a workspace""" |
|''"""Container"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Useless generic object""" |
|''"""Containers"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Database"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""RunSQL has been preferred to Execute method""" |
|background-color:#ff3;''"""Databases"""'' | | | | X | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; |"""Manage collection of all databases opened during a LibO/AOO session""" |
|''"""DBEngine"""'' | | | | X | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Database administration""" |
|''"""Document"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""Documents"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Error"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Database errors management""" |
|''"""Errors"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Field"""'' | X | X | | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; |"""See Relation object""" |
|''"""Field2"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""For multi-valued fields""" |
|''"""Fields"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""Index"""'' | | | X | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; |"""Description of table indexes"""<br />"""Fields collection to be derived""" |
|background-color:#ff3;''"""Indexes"""'' | | | X | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""Parameter"""'' | | | X | | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; |"""To manage parameter queries""" |
|background-color:#ff3;''"""Parameters"""'' | | | X | | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; | |
|''"""Properties"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; |"""MSAccess supports user-defined properties for Database, TableDef, QueryDef and Index objects""" |
|''"""Property"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""QueryDef"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""QueryDefs"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; |"""Creation of temporary queries could be useful bt strongly depend on RDBMS""" |
|''"""Recordset"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Recordset2"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""For multi-valued fields""" |
|''"""Recordsets"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Not very useful""" |
|background-color:#ff3;''"""Relation"""'' | | | | X | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""Relations"""'' | | | | X | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; | |
|''"""TableDef"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""TableDefs"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Workspace"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Transaction management and data security""" |
|''"""Workspaces"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
!~DoCmd Actions
| !ACTIONS |>|>|>|>| ''__FUNCTIONALITY__'' |>|>|>|background-color:#eee; ''__IMPLEMENTATION__'' | !Comments |
|~| !Done | !Could be improved | !Very nice to have | !Nice to have | !Not applicable | !Out of Reach | !Complex | !Average | !Easy |~|
|''"""AddMenu"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Menus are static in LibO/AOO"""<br />"""(except in shortcut menus)""" |
|''"""ApplyFilter"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Better replaced by the Filter and FilterOn properties for Forms"""<br />"""Applicable to table/query datasheet views""" |
|''"""Beep"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Standard in LibO/AOO Basic""" |
|''"""BrowseTo"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Browse thru forms and reports displayed in a tabbed interface""" |
|''"""CancelEvent"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Exit Sub in procedure invoked by event""" |
|''"""ClearMacroError"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Close"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""mClose i.o. Close""" |
|background-color:#ff3;''"""CloseDatabase"""'' | | | | X | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; X |"""Easy to reproduce with"""<br />"""SelectObject(acDatabaseWindow)"""<br />"""RunCommand("acCmdClose")""" |
|''"""CopyDatabaseFile"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Copy database to server""" |
|''"""CopyObject"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Only tables and queries"""<br />"""Between different databases, even from different RDBMS""" |
|background-color:#ff3;''"""DeleteObject"""'' | | | | X | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; X |"""Replaceable by Delete method applied on TableDef/QueryDef objects""" |
|''"""DoMenuItem"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Yet obsolete in MSAccess""" |
|''"""Echo"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Hide or show the results of a macro while it runs""" |
|''"""FindNext"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Limited to a grid control, very slow""" |
|''"""FindRecord"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |~|
|''"""GoToControl"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Better replaced by SetFocus""" |
|''"""GoToPage"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Yet obsolete in MSAccess""" |
|''"""GoToRecord"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Enriched with subforms""" |
|''"""Hourglass"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""SystemPointer interface not at application level in LibO/AOO""" |
|''"""LockNavigationPane"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""No navigation pane in LibO/AOO""" |
|''"""Maximize"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""Minimize"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""MoveSize"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""NavigateTo"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""No navigation pane in LibO/AOO""" |
|''"""OpenDataAccessPage"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""No data access pages in LibO/AOO""" |
|background-color:#ff3;''"""OpenDiagram"""'' | | | | X | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; X |"""Easy to reproduce with"""<br />"""SelectObject(acDatabaseWindow)"""<br />"""RunCommand(acCmdShowAllRelationships)"""<br />"""1 diagram by database !""" |
|''"""OpenForm"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""The OpenArgs argument is (almost) meaningless""" |
|''"""OpenFunction"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Function in SQL Server""" |
|''"""OpenModule"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Access2Base not intended to manage interaction with Basic IDE""" |
|''"""OpenQuery"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""The DataMode argument is ignored""" |
|''"""OpenReport"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Filters, etc. are ignored.""" |
|''"""OpenStoredProcedure"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Database specific""" |
|''"""OpenTable"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""The DataMode argument is ignored""" |
|''"""OpenView"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Views are seen as tables""" |
|''"""OutputTo"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Supported output formats are different"""<br />"""TemplateFile, Encoding and OutputQuality arguments are ignored""" |
|background-color:#ff3;''"""PrintOut"""'' | | | X | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; |"""Maybe with Print menu command ??""" |
|''"""Quit"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|''"""RefreshRecord"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Better replaced by the Refresh method""" |
|background-color:#ff3;''"""Rename"""'' | | | | X | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; |"""Rename forms, querries, tables and reports""" |
|''"""RepaintObject"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Yet obsolete in MSAccess""" |
|''"""Requery"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Better replaced by the Requery method""" |
|background-color:#ff3;''"""Restore"""'' | | | X | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; X |"""Probably solved with IsMaximized=False tbc""" |
|''"""RunCommand"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Where to find their arguments ??"""<br />"""VBA commands list derived from MSAccess 2003""" |
|''"""RunDataMacro"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""No concept of DataMacros in LibO/AOO""" |
|''"""RunMacro"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""No concept of Macros in LibO/AOO""" |
|''"""RunSavedImportExport"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Let's try TransferXXX first""" |
|''"""RunSQL"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; |"""Has dbSQLPassThrough option"""<br />"""Extended to database objects"""<br />"""UseTranasction argument not supported""" |
|''"""Save"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Design views of Forms or Reports are not supported"""<br />"""Easily replaced by RunCommand(acCmdSave)""" |
|''"""SearchForRecord"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |""""Where" parser ?""" |
|''"""SelectObject"""'' | X | X | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""InNavigationPane not implemented""" |
|''"""SendObject"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""TemplateFile argument ignored""" |
|''"""SetDisplayedCategories"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Linked to navigation pane""" |
|''"""SetFilter"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Better replaced by the Filter and FilterOn properties for Forms"""<br />"""Doable for table/query datasheet views ?""" |
|''"""SetMenuItem"""'' | | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Yet obsolete in MSAccess""" |
|''"""SetOrderBy"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Better replaced by the OrderBy and OrderByOn properties for Forms"""<br />"""Applicable to table/query datasheet views""" |
|''"""SetParameter"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Related to (data)macros""" |
|''"""SetProperty"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Much broader scope in Access2Base""" |
|''"""SetWarnings"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Related to system messages""" |
|''"""ShowAllRecords"""'' | X | | | | |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""ShowToolbar"""'' | | | X | | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; |"""Toolbars are static on LibO/AOO""" |
|''"""SingleStep"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Related to (data)macros""" |
|''"""TransferDatabase"""'' | | | X | | |background-color:#eee; X |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Copy objects (forms, queries, tables, ...) between databases""" |
|''"""TransferSharePointList"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""TransferSpreadsheet"""'' | | | X | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; |"""Calc only""" |
|''"""TransferSQLDatabase"""'' | | | | | X |background-color:#eee; |background-color:#eee; |background-color:#eee; |background-color:#eee; |"""Copy full database w/ or wo/ data""" |
|background-color:#ff3;''"""TransferText"""'' | | | X | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; |"""Fixed + variable length; Schema.ini file parser""" |
!Other topics
| !ACTIONS |>|>|>|>| ''__FUNCTIONALITY__'' |>|>|>|background-color:#eee; ''__IMPLEMENTATION__'' | !Comments |
|~| !Done | !Could be improved | !Very nice to have | !Nice to have | !Not applicable | !Out of Reach | !Complex | !Average | !Easy |~|
|''"""On properties"""'' | X | | | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; |"""Assign programmatically events to macros""" |
|background-color:#ff3;''"""Switchboard"""'' | | | | X | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; |"""To be completely redesigned:"""<br />"""- to avoid use of table (only 1 database in Base ... !)"""<br />"""- Use of either (language-neutral) dialog box or shortcut menus""" |
|background-color:#ff3;''"""Shortcut menus"""'' | | | X | | |background-color:#eee; |background-color:#eee; X |background-color:#eee; |background-color:#eee; | |
|background-color:#ff3;''"""Error handling"""'' | | | | X | |background-color:#eee; |background-color:#eee; |background-color:#eee; X |background-color:#eee; |"""Process A2B errors in user code""" |</pre>
</div>
<div title="MainMenu" modifier="YourName" created="201106251004" modified="201902151437" tags="excludeLists" changecount="14">
<pre>[[Software Version: 6.2.0|ReleaseNotes]]
[[Home|Home]]
<<search>>
[[Index|Full Index]]
[[Getting started|Install]]
[[The object model|Object Model]]
[[Tutorial]]
<<tagsTree Menu>>
[[Thanks|Thanks]]
[[Contact]]
<<toggleSideBar "" "Toggle side bar" hide>></pre>
</div>
<div title="Maximize" modifier="Jean-Pierre Ledure" created="201203311248" modified="201409271453" tags="Actions" changecount="2">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //Maximize// action maximizes the window containing the [[Form]] having the focus.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]Maximize()}}}
!!!Remarks
*The //Maximize// action is usually preceded by a [[SelectObject]] action or by a [[SetFocus]] method applied on the targeted //form//.
*//Maximize// returns {{{True}}} if the action was successful, {{{False}}} otherwise.
!!!Error messages
|No active form or control found |
!!!See also
[[Minimize]]
[[SelectObject]]
[[SetFocus]]
!!!Example
<<tiddler "Maximize example">></pre>
</div>
<div title="Maximize example" modifier="Jean-Pierre Ledure" created="201203311257" modified="201408011520" tags="[[Snippets of Code]]" changecount="1">
<pre>Set focus on targeted form and maximize it
//{{{
Dim ofForm As Object
Set ofForm = Forms("myForm")
ofForm.SetFocus
Maximize() ' ... or Minimize() ...
MsgBox ofForm.Width
//}}}</pre>
</div>
<div title="Methods" modifier="Jean-Pierre Ledure" created="201108131502" tags="Menu">
<pre></pre>
</div>
<div title="Minimize" modifier="Jean-Pierre Ledure" created="201203311311" modified="201409271453" tags="Actions" changecount="3">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //Minimize// action minimizes the window containing the [[Form]] having the focus.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]Minimize()}}}
!!!Remarks
*The //Minimize// action is usually preceded by a [[SelectObject]] action or by a [[SetFocus]] method applied on the targeted //form//.
*//Minimize// returns {{{True}}} if the action was successful, {{{False}}} otherwise.
!!!Error messages
|No active form or control found |
!!!See also
[[Maximize]]
[[SelectObject]]
[[SetFocus]]
!!!Example
<<tiddler "Maximize example">> </pre>
</div>
<div title="MixAccess2baseAndUNO" modifier="Jean-PierreLedure" created="201212301013" modified="201308161035" tags="HowTo">
<pre>(Q) Is it possible to mix calls to the //~Access2Base// API and to the //UNO// API in the same code ?
(R) Yes, this is by the way exactly what //~Access2Base// does internally. Additionally most [[Access2Base objects|Object Model]] provide entries to useful //UNO// objects.
!!!Documentation
Next objects have within their properties one or more of them qualified as "UNO". Have a look at:
*[[Database]]
*[[Form]]
*[[Control]] with the - very useful - //~ControlModel// and //~ControlView// properties
*[[SubForm]]
*[[Recordset]]
*[[Field]] with the //Column// property
!!!Example 1
To get the character surrounding table and fieldnames in SQL statements for the current database:
//{{{
MsgBox CurrentDb.MetaData.IdentifierQuoteString
//}}}
[[CurrentDb]] returns the current database object making its //metadata// property available.
!!!Example 2
Next function (inspired by a code snippet from [[XRay|http://bernard.marcelly.perso.sfr.fr/index2.html]]) returns the nature of a //UNO// object:
//{{{
Public Function getUNOTypeName(pvObject As Variant) As String
' Return the symbolic name of the pvObject (UNO-object) type
' Code-snippet from XRAY
Dim oService As Object, vClass as Variant, sType As String
_getUNOTypeName = ""
On Local Error Resume Next
sType = pvObject.getImplementationName()
If sType = "" Then
oService = CreateUnoService("com.sun.star.reflection.CoreReflection")
vClass = oService.getType(pvObject)
If vClass.TypeClass = com.sun.star.uno.TypeClass.STRUCT Then
getUNOTypeName = vClass.Name
End If
oService.Dispose()
End If
getUNOTypeName = sType
End Function ' getUNOTypeName
//}}}
Next code will probably display //com.sun.star.comp.forms.~ODatabaseForm//
//{{{
Dim ofForm As Object
Set ofForm = Forms("Orders_Browse")
MsgBox getUNOTypeName(ofForm.DatabaseForm)
//}}}
!!!Example 3
To apply a font attribute that is not implemented within the //~Access2Base// API:
//{{{
Dim ocControl As Object
Set ocControl = Forms("Orders_Browse").Controls("txtCustomerID")
ocControl.ControlModel.FontStrikeout = com.sun.star.awt.FontStrikeout.DOUBLE
//}}}
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Prerequisite |
|Snippets |||||Form ~Orders_Browse must be open before running examples 2 and 3. |
</pre>
</div>
<div title="Module" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181037" modified="201708191650" tags="Objects" changecount="9">
<pre>{{firstletter{
@@color:#930;A@@
}}} //Module// object represents a module containing a Basic script. It might represent either a standard module or a class module.
!!!Function returning a module object
| !Parent object | !Function | !Type | !Argument |!Description |
|[[Application]] |[[AllModules]] | [[Collection]] | Integer or String |{{{Application.AllModules("myModule")}}} returns an object corresponding with the {{{myModule}}} module stored in the current document |
!!!Properties
| !Property | !Type | !Read only | !Description or UNO object |
|[[CountOfDeclarationLines]] || Y |Indicates the number of lines of code in the Declarations section of the module. |
|[[CountOfLines]] || Y |Indicates the number of lines of code in the module. |
|[[Lines]] || Y |Returns a string containing the contents of a specified line or lines in a module. |
|[[Name]] || Y |Specifies the real name of the module |
|[[ObjectType]] || Y |Returns "MODULE" |
|[[ProcBodyLine]] || Y |Returns the number of the line at which the body of a specified procedure begins in the module. |
|[[ProcCountLines]] || Y |Returns the number of lines in a specified procedure in the module. |
|[[ProcOfLine]] || Y |Returns the name of the procedure that contains a specified line in the module. |
|[[ProcStartLine]] || Y |Returns a value identifying the line at which a specified procedure begins in the module. |
|[[Type]] || Y |Indicates whether a module is a standard module or a class module. |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[Find]] | string to find | Boolean |Return True if the string was found. Other arguments contain its position (line and column). |
!!!What does return the //Name// property of a module ?
To manage potential homonyms among libraries, the ''name'' of a module consists in 3 components:
//{{{
SCOPE.LIBRARY.MODULE
//}}}
*The //SCOPE// is either
**''{{{GLOBAL}}}'' grouping both the ''~LibreOffice/~OpenOffice Macros and Dialogs'' and the ''My Macros and Dialogs'' catalogs of libraries.
**''{{{DOCUMENT}}}'' grouping the libraries stored in the current document.
*The //LIBRARY// component is the name of the library. It is often equal to "''Standard''".
!!!See also
[[AllModules]]
!!!Examples
<<tiddler "Module example">></pre>
</div>
<div title="Module example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181339" modified="201612181714" tags="[[Snippets of Code]]" changecount="5">
<pre>Query the properties of a Basic module
//{{{
Const cstModule = "myModule"
Const cstProc = "mySub"
Const vbext_pk_Proc = 0 ' A Sub or Function procedure
Const cstStringToFind = "some string"
Dim oModule As Object, sProc As String, iProcType As Integer
Dim vStartLine As Variant, vStartColumn As Variant, vEndLine As Variant, vEndColumn As Variant
Set oModule = Application.AllModules(cstModule)
With oModule
DebugPrint "Name = " & .Name
DebugPrint "# of lines = " & .CountOfLines
DebugPrint "# of declaration lines = " & .CountOfdeclarationLines
DebugPrint "Lines 26 to 31 = " & .Lines(26, 6)
DebugPrint "# of lines in proc " & cstProc & " = " & .ProcCountLines(cstProc, vbext_pk_Proc)
DebugPrint "Start line in proc " & cstProc & " = " & .ProcStartLine(cstProc, vbext_pk_Proc)
DebugPrint "Start body line in proc " & cstProc & " = " & .ProcBodyLine(cstProc, vbext_pk_Proc)
' Line 35 is located within procedure sProc (of type iProcType)
sProc = .ProcOfLine(35, iProcType)
' Arguments are left uninitialized to consider the whole module
If .Find(cstStringToFind, vStartLine, vStartColumn, vEndLine, vEndColumn) Then DebugPrint cstStringToFind & " found on line " & vStartLine
End With
TraceConsole()
//}}}</pre>
</div>
<div title="Move" modifier="Jean-Pierre Ledure" created="201111011543" modified="201405241129" tags="Methods" changecount="1">
<pre>The //Move// method moves the specified object to the coordinates specified by the argument values.
!!!Applies to ...
| !Object | !Description |
|[[Form]] |The representation of an //~OpenOffice/~LibreOffice// database form |
|[[Dialog]] |The representation of a Basic dialog |
!!!Syntax
//form//.{{{Move([}}}//Left//{{{], [}}}//Top//{{{], [}}}//Width//{{{], [}}}//Height//{{{])}}}
//dialog//.{{{Move([}}}//Left//{{{], [}}}//Top//{{{], [}}}//Width//{{{], [}}}//Height//{{{])}}}
| !Argument | !Type | !Description | !Returned value |
| form |[[Form object|Form]] |Form to be moved |//True// if success. |
| dialog |[[Dialog object|Dialog]] |Dialog to be moved |~|
| Left | Integer<br />Long |The screen position for the left edge of the form relative to the left edge of the screen |~|
| Top | Integer<br />Long |The screen position for the top edge of the form relative to the top edge of the screen |~|
| Width | Integer<br />Long |The desired width of the form |~|
| Height | Integer<br />Long |The desired height of the form |~|
!!!Remarks
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[Height]]
[[MoveSize]]
[[Width]]
!!!Example
<<tiddler "Move example">></pre>
</div>
<div title="Move (recordset)" modifier="Jean-Pierre Ledure" created="201306291017" modified="201405241134" tags="Methods" changecount="2">
<pre>The //Move//, //~MoveFirst//, //~MoveLast//, //~MoveNext// and //~MovePrevious// methods move the cursor either
*to a record specified by its position
*or to the first, last, next, or previous record
in a specified [[Recordset]] object and make that record the current record.
!!!Applies to ...
| !Object | !Description |
|[[Recordset]] |A set of records derived from a table, a query or a SQL statement. |
!!!Syntax
//recordset//{{{.Move(}}}//rows, startbookmark//{{{)}}}
//recordset//{{{.MoveFirst}}}
//recordset//{{{.MoveLast}}}
//recordset//{{{.MoveNext}}}
//recordset//{{{.MovePrevious}}}
| !Argument | !Optional | !Type | !Description | !Returned value |
|recordset || [[Recordset object|Recordset]] |An open recordset |//True// if success. |
|rows || Long |Specifies the number of rows the position will move.<br />If rows is greater than 0, the position is moved forward (toward the end of the file).<br />If rows is less than 0, the position is moved backward (toward the beginning of the file). |~|
|startbookmark | Y | Variant |Value identifying a bookmark. If you specify //startbookmark//, the //move// begins relative to this bookmark. Otherwise, //move// begins from the current record. |~|
!!!Remarks
*''Caution'' If you edit the current record, be sure you use the [[Update]] method to save the changes before you move to another record. If you move to another record without updating, your changes are lost without warning.
*When using the //Move// method:
**If you use //Move// to position the current record pointer before the first record, the current record pointer moves to the beginning of the file. If the //Recordset// contains no records and its [[BOF|BOF, EOF]] property is {{{True}}}, using this method to move backward causes an error.
**If you use //Move// to position the current record pointer after the last record, the current record pointer position moves to the end of the file. If the //Recordset// contains no records and its [[EOF|BOF, EOF]] property is {{{True}}}, then using this method to move forward causes an error.
**If either the [[BOF|BOF, EOF]] or [[EOF|BOF, EOF]] property is {{{True}}} and you attempt to use the //Move// method without a valid bookmark, a run-time error occurs.
*When using //~MoveFirst, ~MoveLast, ~MoveNext// or //~MovePrevious// methods
**When you open a //Recordset//, the first record is current and the [[BOF|BOF, EOF]] property is {{{False}}}. If the //Recordset// contains no records, the [[BOF|BOF, EOF]] property is {{{True}}}, and there is no current record.
**If the first or last record is already current when you use //~MoveFirst// or //~MoveLast//, the current record doesn't change.
**If you use //~MovePrevious// when the first record is current, the [[BOF|BOF, EOF]] property is {{{True}}}, and there is no current record. If you use //~MovePrevious// again, an error occurs, and [[BOF|BOF, EOF]] remains {{{True}}}.
**If you use //~MoveNext// when the last record is current, the [[EOF|BOF, EOF]] property is {{{True}}}, and there is no current record. If you use //~MoveNext// again, an error occurs, and [[EOF|BOF, EOF]] remains {{{True}}}.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Action rejected in a forward-only or not bookmarkable recordset |
|Recordset delivered no data. Action on current record rejected |
|Recordset has been closed. Recordset action rejected |
|Current record out of range |
!!!See also
[[Bookmark]]
[[Bookmarkable]]
[[OpenRecordset]]
!!!Example
<<tiddler "OpenRecordset example">></pre>
</div>
<div title="Move example" modifier="Jean-PierreLedure" created="201111011601" modified="201212141433" tags="[[Snippets of Code]]">
<pre>Move a form to new left-top coordinates and resize it ...
//{{{
Dim ofForm As Object
Set ofForm = Forms("myForm")
ofForm.Move(100, 200, 500, 200)
//}}}</pre>
</div>
<div title="MoveItemsBetweenListboxes" modifier="Jean-PierreLedure" created="201306021037" modified="201308161339" tags="HowTo">
<pre>(Q) Can I move easily items from one listbox to another ?
(R) Let's implement the classical method of moving either the selected items or all the items from one listbox to another and reciprocally.
A first listbox is loaded from the database. The second one is empty.
The goal is to load the second listbox with a selection of items from the first one, thanks to 4 buttons:
*{{{>}}} and {{{<}}} move all selected items from one listbox to the other one and remove them from the original one.
*{{{>>}}} and {{{<<}}} empty the original box and move all its items to the other one.
!!!Solution
It consists in putting on a form:
*2 [[listboxes|ListBox]] called //~LeftList// and //~RightList//
*4 buttons called //~MoveOneRight// ({{{>}}}), //~MoveAllRight// ({{{>>}}}), //~MoveOneLeft// ({{{<}}}), //~MoveAllLeft// ({{{<<}}})
The code associated with the events is mainly a matter of arrays redimensioning, trimming and housekeeping. Both listboxes must be reinitialized from the event macro after each button activation to remain synchronized.
Let's assume next table:
<<tiddler "ProductsTable">>
The //~LeftList// box is loaded initially with the //~ProductName// field of the //Products// table.
1. Associate next code with the //When loading// form event: after initial loading the //~LeftList// control will be dissociated from its bound field. Additionally 3 constants are defined at module level.
//{{{
Const cstForm = "Products_FastSelect"
Const cstLeftList = "LeftList"
Const cstRightList = "RightList"
Sub InitFirstList(poEvent As Object)
'Activated when form opened
Dim ocList As Object, sSource As String
Set ocList = Forms(cstForm).Controls(cstLeftList)
sSource = Join(ocList.ItemData, ";")
ocList.RowSourceType = com.sun.star.form.ListSourceType.VALUELIST ' Cancel link with bound field
ocList.RowSource = sSource
End Sub
//}}}
2. Associate the //Execute action// event of each of the 4 buttons with next macro:
//{{{
Sub MoveItems(poEvent As Object)
Dim oEvent As Object, ocLeftList As Object, ocRightList As Object
Dim i As Integer, vLeft() As Variant, vRight() As Variant, vSelected() As Variant
Dim iMaxDim As Integer, iLeftSize As Integer, iRightSize As Integer, sSource As String
Set oEvent = Events(poEvent)
Set ocLeftList = Forms(cstForm).Controls(cstLeftList)
Set ocRightList = Forms(cstForm).Controls(cstRightList)
' Initial load of arrays
vLeft = ocLeftList.ItemData
vRight = ocRightList.ItemData
iLeftSize = UBound(vLeft)
iRightSize = UBound(vRight)
iMaxDim = iLeftSize + 1 + iRightSize + 1
ReDim Preserve vLeft(iMaxDim)
ReDim Preserve vRight(iMaxDim)
Select Case oEvent.Source.Name
Case "MoveOneRight" ' >
vSelected = ocLeftList.Selected
For i = 0 To iLeftSize
If vSelected(i) Then
iRightSize = iRightSize + 1
vRight(iRightSize) = vLeft(i)
vLeft(i) = ""
End If
Next i
Case "MoveAllRight" ' >>
For i = 0 To iLeftSize
iRightSize = iRightSize + 1
vRight(iRightSize) = vLeft(i)
vLeft(i) = ""
Next i
Case "MoveOneLeft" ' <
vSelected = ocRightList.Selected
For i = 0 To iRightSize
If vSelected(i) Then
iLeftSize = iLeftSize + 1
vLeft(iLeftSize) = vRight(i)
vRight(i) = ""
End If
Next i
Case "MoveAllLeft" ' <<
For i = 0 To iRightSize
iLeftSize = iLeftSize + 1
vLeft(iLeftSize) = vRight(i)
vRight(i) = ""
Next i
End Select
'Reload listboxes
sSource = ""
For i = 0 To iLeftSize
If vLeft(i) <> "" Then sSource = sSource & vLeft(i) & ";"
Next i
If Len(sSource) = 0 Then ocLeftList.RowSource = "" Else ocLeftList.RowSource = Left(sSource, Len(sSource) - 1) ' Remove last ";"
sSource = ""
For i = 0 To iRightSize
If vRight(i) <> "" Then sSource = sSource & vRight(i) & ";"
Next i
If Len(sSource) = 0 Then ocRightList.RowSource = "" Else ocRightList.RowSource = Left(sSource, Len(sSource) - 1)' Remove last ";"
'Deselect listboxes
For i = 0 To ocLeftList.ListCount - 1
setSelected(ocLeftList, False, i)
Next i
For i = 0 To ocRightList.ListCount - 1
setSelected(ocRightList, False, i)
Next i
End Sub
//}}}
!!!See also
[[ListBox]]
[[ListCount]]
[[RowSource]]
[[RowSourceType]]
[[Selected]]
[[Event]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|~FastSelect |~Products_FastSelect |When loading |~MoveOneRight<br />~MoveAllRight<br />~MoveOneLeft<br />~MoveAllLeft |Execute action ||</pre>
</div>
<div title="MoveSize" modifier="Jean-Pierre Ledure" created="201204061510" modified="201409271453" tags="Actions" changecount="3">
<pre>The //~MoveSize// action moves the active window to the coordinates specified by the argument values.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]MoveSize([}}}//Left//{{{], [}}}//Top//{{{], [}}}//Width//{{{], [}}}//Height//{{{])}}}
| !Argument | !Optional | !Type | !Description | !Returned value |
| Left | Yes |Integer<br />Long |The screen position for the left edge of the window relative to the left edge of the screen | True if success |
| Top |~| Integer<br />Long |The screen position for the top edge of the window relative to the top edge of the screen |~|
| Width |~| Integer<br />Long |The desired width of the window |~|
| Height |~| Integer<br />Long |The desired height of the window |~|
!!!Remarks
*The action applies to the active window. A window may be made active with the [[SelectObject]] action.
*The //~MoveSize// action is also applicable to the Basic IDE window or the database window. However it will ignore any window opened by another application than the one having called the //~MoveSize// action..
*The //~MoveSize// action applies to [[forms|Form]] or [[dialogs|Dialog]] only.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[Height]]
[[Move]]
[[SelectObject]]
[[Width]]
!!!Example
<<tiddler "MoveSize example">></pre>
</div>
<div title="MoveSize example" modifier="Jean-Pierre Ledure" created="201204061544" modified="201408011520" tags="[[Snippets of Code]]" changecount="1">
<pre>Select an open form and resize it
//{{{
SelectObject(acForm, "myForm")
MoveSize 100, 200, 500, 200
//}}}</pre>
</div>
<div title="MultiSelect" modifier="Jean-PierreLedure" created="201108181326" modified="201306151423" tags="Properties">
<pre>You can use the ~MultiSelect property to specify whether a user can make multiple selections in a list box on a form
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] | [[ListBox]] | [[ListBox]] | [[ListBox]] |A listbox on an open form or dialog, or in a [[GridControl]]|
!!!Syntax
//control//{{{.MultiSelect}}}
//control//{{{.MultiSelect}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
In ~MSAccess VBA the //~MultiSelect// property returns an integer value.
!!!Error messages
|Property '~MultiSelect' not applicable in this context |
|Value '...' is invalid for property '~MultiSelect' |
!!!See also
[[ItemData]]
[[ListCount]]
[[ListIndex]]
[[RowSource]]
[[RowSourceType]]
[[Selected]]
!!!Example
*Combo box
<<tiddler "ComboBox example">>
*List box
<<tiddler "ListBox example">></pre>
</div>
<div title="MultiSelectListboxSelectForm" modifier="Jean-PierreLedure" created="201212161708" modified="201308161049" tags="HowTo">
<pre>(Q) I have a listbox control (might be MultiSelect) on my form. I want to pass the selected items to select the data listed in a gridcontrol on the same form. How do I do this?
(R) The criteria must be built as a character string and passed to the [[RecordSource]] of the form.
Assuming next tables:
<<tiddler "SuppliersTable">>
<<tiddler "ProductsTable">>
and a form
*bound to the Table "Products"
*containing an unbound listbox having as data source
//{{{
SELECT "CompanyName" FROM "Suppliers" ORDER BY "CompanyName" ASC
//}}}
!!!(1) Solution for ~MultiSelect = No listbox
We make the //Changed// event of the listbox control triggering next code:
//{{{
Sub SyncFormListBoxMono(poEvent As Object)
Dim oEvent As Object, ocList As Object, oForm As Object
Dim sSupplier As String, lSupplier As Long
Set oEvent = Events(poEvent)
Set ocList = oEvent.Source ' Retrieve listbox object
Set oForm = ocList.Parent ' Retrieve parent form
sSupplier = Join(Split(ocList.Value, "'"), "''") ' For the case the company name contains quotes
lSupplier = DLookup("[SupplierID]", "[Suppliers]", "[CompanyName]='" & sSupplier & "'")
oForm.RecordSource = "SELECT [SupplierID], [ProductID], [ProductName], [UnitPrice] FROM [Products] WHERE [SupplierID]=" & lSupplier
End Sub
//}}}
This will produce the requested effect.
!!!(2) Solution for ~MultiSelect = Yes listbox
A first variant is when the listbox is defined with ~MultiSelection = Yes
//{{{
Sub SyncFormListBoxMulti(poEvent As Object)
Dim oEvent As Object, ocList As Object, oForm As Object
Dim sSupplier As String, lSupplier As Long, i As Integer, sSQL As String
Const cstCriteria = " OR [SupplierID]="
Set oEvent = Events(poEvent)
Set ocList = oEvent.Source ' Retrieve listbox object
Set oForm = ocList.Parent ' Retrieve parent form
sSQL = "SELECT [SupplierID], [ProductID], [ProductName], [UnitPrice] FROM [Products] WHERE [SupplierID]="
For i = 0 To UBound(oclist.Selected)
If ocList.Selected(i) Then
sSupplier = Join(Split(ocList.ItemData(i), "'"), "''") ' For the case the company name contains quotes
lSupplier = DLookup("[SupplierID]", "[Suppliers]", "[CompanyName]='" & sSupplier & "'")
sSQL = sSQL & lSupplier & cstCriteria
End If
Next i
oForm.RecordSource = Left(sSQL, Len(sSQL) - Len(cstCriteria)) ' Trim SQL phrase
End Sub
//}}}
!!!(3) Solution with form filtering
Another variant is to use a filter. This lets the user the freedom to cancel the filtering option or to filter the data independently from the listbox. This freedom can be desired by the developer or not. ~MultiSelection is presumed False in the example:
//{{{
Sub SyncFormListBoxFilter(poEvent As Object)
Dim oEvent As Object, ocList As Object, oForm As Object
Dim sSupplier As String, lSupplier As Long
Set oEvent = Events(poEvent)
Set ocList = oEvent.Source ' Retrieve listbox object
Set oForm = ocList.Parent ' Retrieve parent form
sSupplier = Join(Split(ocList.Value, "'"), "''") ' For the case the company name contains quotes
lSupplier = DLookup("[SupplierID]", "[Suppliers]", "[CompanyName]='" & sSupplier & "'")
oForm.Filter = "[SupplierID]=" & lSupplier
oForm.FilterOn = True
End Sub
//}}}
!!!See also
[[getObject]]
[[Events Handler]]
[[Filter]]
[[Parent]]
[[RecordSource]]
!!!Refer to ...
| !Solution | !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
| (1) |~ListBox |~Products_ListBoxFilter ||~SuppliersListBoxMono |Changed ||
| (2) |~|~|~|~SuppliersListBoxMulti |~|~|</pre>
</div>
<div title="Name" modifier="YourName" created="201107181600" modified="201902151447" tags="Properties" changecount="7">
<pre>The //Name// property specifies the text string corresponding to the name of an object.
!!!Applies to ...
| !Object |!Description |
|[[CommandBar]] |A tool-, menu- or statusbar |
|[[Control]] |A control of an open form |
|[[Database]] |A database the application is currently connected to |
|[[Dialog]] |A dialog, active or not |
|[[Field]] |A field within a //~TableDef//, a //~QueryDef// or a //Recordset// |
|[[Form]] |A form, open or not, including its path name, if any |
|[[Module]] |A Basic script |
|[[OptionGroup]] |A group of radio buttons |
|[[Property]] |A property of an object |
|[[QueryDef]] |A query definition |
|[[Recordset]] |A set of records related to a table, a query or a SQL statement |
|[[SubForm]] |A subform of an open form |
|[[TableDef]] |A table definition |
|[[TempVar]] |A temporary variable |
!!!Syntax
//commandbar//{{{.Name}}}
//control//{{{.Name}}}
//database//{{{.Name}}}
//dialog//{{{.Name}}}
//form//{{{.Name}}}
//module//{{{.Name}}}
//optiongroup//{{{.Name}}}
//property//{{{.Name}}}
//querydef//{{{.Name}}}
//recordset//{{{.Name}}}
//subform//{{{.Name}}}
//tabledef//{{{.Name}}}
//tempvar//{{{.Name}}}
!!!Returned values
{{{String}}}
!!!Remarks
*The Name property is read-only.
*When relevant the returned string contains the name of the object __as stored by ~LibreOffice/~OpenOffice Base__. In ~LibreOffice/~OpenOffice Base "myForm" is different from "MYFORM". At the opposite, in ~Access2Base, all references to a name as argument of a function are //''not case-sensitive''//.<br />Example: {{{Forms("myForm")}}} is identical to {{{Forms("MYFORM")}}}
*The //Name// property of a recordset is artificially set by //~Access2Base//. See the [[Recordsets]] collection for more info.
!!!Error messages
!!!Example
<<tiddler "Name example">></pre>
</div>
<div title="Name example" modifier="Jean-PierreLedure" created="201107181642" modified="201212141439" tags="[[Snippets of Code]]">
<pre>Display exact name of the first open form
Display all property names of that form
//{{{
Dim ofForm As Object, opProperty As Object, i As Integer
If Forms.Count > 0 Then
Set ofForm = Forms(0)
_Print ofForm.Name
For i = 0 To ofForm.Properties().Count - 1
Set opProperty = ofForm.Properties(i)
Print opProperty.Name,
Next i
End If
Print
//}}}</pre>
</div>
<div title="Object Model" modifier="Jean-Pierre Ledure" created="201106251306" modified="201612181032" tags="Definitions" changecount="35">
<pre>{{firstletter{
@@color:#930;A@@
}}}OO/~LibO Basic is a simple but still an object-oriented language. To know more about object-oriented programming in Basic, you can have a look at [[here|https://forum.openoffice.org/en/forum/viewtopic.php?f=21&t=58135]]
To stay close to the syntax of the //~MSAccess// object model the implementation of ~Access2Base has been based on BASIC object classes.
*Specific functions, sometimes called "Collections" will create instances of classes of type ''Form'', ''Subform'', ''Control'' or ''Database'', etc.
*To use these instances in your own code, your local/global/... variables should be declared as being of type {{{Object}}}
*The names of the ''properties'' and ''methods'' to be applied on those variables are identical in //~MSAccess// and in //~Access2Base//. Their arguments are identical as well. Note however that //~Access2Base// implements only a limited subset of the object model of //~MSAccess//. Note also that their semantics might differ from the original //~MSAccess// one. Read the current documentation carefully.
*''Indirection'', i.e. accessing a property by its name given as a {{{string}}} argument, and ''introspection'', i.e. knowing which properties are available for any object, are supported for propertiesl.
!The Object Model
[img[The Access2Base object model|objectmodel.png]]
!!Root classes
| !Class | !Description | !Collections | !Properties | !Methods |
|[[Application]] |The root class |[[AllDialogs]]<br />[[AllForms]]<br />[[AllModules]]<br />[[CommandBars]]<br />[[Events]]<br />[[Forms]]<br />[[TempVars]] |[[CurrentUser]]<br />[[HtmlEncode]]<br />[[ProductCode]]<br />[[Version]] |[[CurrentDb]]<br />[[DAvg]]<br />[[DCount]]<br />[[DLookup]]<br />[[DMin, DMax]]<br />[[DStDev, DStDevP]]<br />[[DSum]]<br />[[DVar, DVarP]]<br />[[OpenConnection]]<br />[[OpenDatabase]] |
|[[DoCmd]] |A secondary root class from which a number of commands can be run ||[[GetHiddenAttribute]] |[[ApplyFilter]]<br />[[Close]]<br />[[CopyObject]]<br />[[FindNext]]<br />[[FindRecord]]<br />[[GoToControl]]<br />[[GoToRecord]]<br />[[Maximize]]<br />[[Minimize]]<br />[[MoveSize]]<br />[[OpenForm]]<br />[[OpenQuery]]<br />[[OpenReport]]<br />[[OpenSQL]]<br />[[OpenTable]]<br />[[OutputTo]]<br />[[Quit]]<br />[[RunApp]]<br />[[RunCommand]]<br />[[RunSQL]]<br />[[SelectObject]]<br />[[SendObject]]<br />[[SetHiddenAttribute]]<br />[[ShowAllRecords]]<br />[[SysCmd]] |
|[[Collection]] |An array of objects accessible via their index or their name ||[[Count]]<br />[[Item]]<br />[[ObjectType]] |[[Add]]<br />[[Delete|Delete (table-query)]]<br />[[Remove]]<br />[[RemoveAll]] |
!!Forms, dialogs, command bars and controls
| !Class | !Description | !Collections | !Properties | !Methods |
|[[Form]] |The representation of an //~OpenOffice/~LibreOffice// database form |[[Controls]]<br />[[OptionGroup|OptionGroup (Method)]]<br />[[Properties|Properties (collection)]] |[[AllowAdditions]]<br />[[AllowDeletions]]<br />[[AllowEdits]]<br />[[Bookmark]]<br />[[Caption]]<br />[[CurrentRecord]]<br />[[Filter]]<br />[[FilterOn]]<br />[[Height]]<br />[[IsLoaded]]<br />[[Name]]<br />[[ObjectType]]<br />[[On ... form events|On (form event)]]<br />[[OpenArgs]]<br />[[OrderBy]]<br />[[OrderByOn]]<br />[[Recordset|Recordset (property)]]<br />[[RecordSource]]<br />[[Visible]]<br />[[Width]] |[[Close]]<br />[[CurrentDb]]<br />[[Move]]<br />[[Refresh]]<br />[[Requery]]<br />[[SetFocus]] |
|[[Dialog]] |The representation of a Basic dialog |[[Controls]]<br />[[OptionGroup|OptionGroup (Method)]]<br />[[Properties|Properties (collection)]] |[[Caption]]<br />[[Height]]<br />[[IsLoaded]]<br />[[Name]]<br />[[ObjectType]]<br />[[Visible]]<br />[[Width]] |[[Execute|Execute (dialog)]]<br />[[Move]]<br />[[Start]]<br />[[Terminate]] |
|[[CommandBar]] |Identifies a toolbar, a menubar or the statusbar. |[[CommandBarControls]]<br />[[Controls]]<br />[[Properties|Properties (collection)]] |[[BuiltIn]]<br />[[Name]]<br />[[ObjectType]]<br />[[Visible]] |[[Reset]] |
|[[Control]] |The representation of a control within a Form, a Dialog, a ~SubForm or an ~OptionGroup |[[Controls]]<br />[[Properties|Properties (collection)]] |[[BackColor]]<br />[[BorderColor]]<br />[[BorderStyle]]<br />[[Cancel]]<br />[[Caption]]<br />[[ControlSource]]<br />[[ControlTipText]]<br />[[ControlType]]<br />[[Count]]<br />[[Default]]<br />[[DefaultValue]]<br />[[Enabled]]<br />[[FontBold]]<br />[[FontItalic]]<br />[[FontName]]<br />[[FontSize]]<br />[[FontUnderline]]<br />[[FontWeight]]<br />[[ForeColor]]<br />[[Form|Form (subform)]]<br />[[Format]]<br />[[ItemData]]<br />[[ListCount]]<br />[[ListIndex]]<br />[[Locked]]<br />[[MultiSelect]]<br />[[Name]]<br />[[ObjectType]]<br />[[On ... control events|On (control event)]]<br />[[OptionValue]]<br />[[Parent]]<br />[[Picture]]<br />[[Required]]<br />[[RowSource]]<br />[[RowSourceType]]<br />[[Selected]]<br />[[SelLength]]<br />[[SelStart]]<br />[[SelText]]<br />[[SubType]]<br />[[TabIndex]]<br />[[TabStop]]<br />[[Tag]]<br />[[Text]]<br />[[TextAlign]]<br />[[TripleState]]<br />[[Value]]<br />[[Visible]] |[[AddItem]]<br />[[RemoveItem]]<br />[[Requery]]<br />[[SetFocus]] |
|[[SubForm]] |Identifies a specific control which is a subform of a database form or another subform |[[Controls]]<br />[[OptionGroup|OptionGroup (Method)]]<br />[[Properties|Properties (collection)]] |[[AllowAdditions]]<br />[[AllowDeletions]]<br />[[AllowEdits]]<br />[[Filter]]<br />[[FilterOn]]<br />[[LinkChildFields]]<br />[[LinkMasterFields]]<br />[[Name]]<br />[[ObjectType]]<br />[[On ... form events|On (form event)]]<br />[[OrderBy]]<br />[[OrderByOn]]<br />[[Parent]]<br />[[Recordset|Recordset (property)]]<br />[[RecordSource]] |[[Refresh]]<br />[[Requery]] |
|[[OptionGroup]] |Identifies a group of specific controls, i.e. radio buttons. |[[Controls]]<br />[[Properties|Properties (collection)]] |[[Count]]<br />[[Name]]<br />[[ObjectType]]<br />[[Value]] ||
|[[CommandBarControl]] |Identifies a control within a ~CommandBar. |[[Execute|Execute (commandbarcontrol)]]<br />[[Properties|Properties (collection)]] |[[BeginGroup]]<br />[[BuiltIn]]<br />[[Caption]]<br />[[Index]]<br />[[ObjectType]]<br />[[OnAction]]<br />[[Parent]]<br />[[TooltipText]]<br />[[Type]]<br />[[Visible]] |
!!Database access
| !Class | !Description | !Collections | !Properties | !Methods |
|[[Database]] |One of the databases to which the application is connected |[[Properties|Properties (collection)]]<br />[[TableDefs]]<br />[[QueryDefs]]<br />[[Recordsets]]|[[Connect]]<br />[[Name]]<br />[[ObjectType]]<br />[[Version]] |[[Close|Close (method)]]<br />[[CloseAllRecordsets]]<br />[[CreateQueryDef]]<br />[[DAvg]]<br />[[DCount]]<br />[[DLookup]]<br />[[DMin, DMax]]<br />[[DStDev, DStDevP]]<br />[[DSum]]<br />[[DVar, DVarP]]<br />[[OpenRecordset]] |
|[[TableDef]] |The representation of a Table. |[[Fields]]<br />[[Properties|Properties (collection)]] |[[Name]]<br />[[ObjectType]] |[[OpenRecordset]] |
|[[QueryDef]] |The representation of a Query. |[[Fields]]<br />[[Properties|Properties (collection)]] |[[Name]]<br />[[ObjectType]]<br />[[SQL]]<br />[[Type]] |[[Execute|Execute (query)]]<br />[[OpenRecordset]] |
|[[Recordset]] |The representation of a set of records from a table, a query or a SQL statement. |[[Fields]]<br />[[Properties|Properties (collection)]] |[[AbsolutePosition]]<br />[[BOF|BOF, EOF]]<br />[[Bookmark]]<br />[[Bookmarkable]]<br />[[EditMode]]<br />[[EOF|BOF, EOF]]<br />[[Filter]]<br />[[Name]]<br />[[ObjectType]]<br />[[RecordCount]] |[[AddNew]]<br />[[CancelUpdate]]<br />[[Clone]]<br />[[Close|Close (method)]]<br />[[Delete]]<br />[[Edit]]<br />[[GetRows]]<br />[[Move|Move (recordset)]]<br />[[MoveFirst|Move (recordset)]]<br />[[MoveLast|Move (recordset)]]<br />[[MoveNext|Move (recordset)]]<br />[[MovePrevious|Move (recordset)]]<br />[[OpenRecordset]]<br />[[Update]] |
|[[Field]] |The representation of a field of a table, a query or a recordset. |[[Properties|Properties (collection)]] |[[DataType]]<br />[[DataUpdatable]]<br />[[DbType|DataType]]<br />[[DefaultValue]]<br />[[Description]]<br />[[FieldSize]]<br />[[Name]]<br />[[ObjectType]]<br />[[Size]]<br />[[SourceField]]<br />[[SourceTable]]<br />[[TypeName|DataType]]<br />[[Value|Value (field)]] |[[AppendChunk]]<br />[[GetChunk]]<br />[[ReadAllBytes]]<br />[[ReadAllText]]<br />[[WriteAllBytes]]<br />[[WriteAllText]] |
!!Other
| !Class | !Description | !Collections | !Properties | !Methods |
|[[Property]] |A name-value pair allowing objects introspection (see below) ||[[Name]]<br />[[ObjectType]]<br />[[Value]] ||
|[[TempVar]] |The representation of a temporary variable ||[[Name]]<br />[[ObjectType]]<br />[[Value]] ||
|[[Event|Events]] |A description of an occurred form, dialog or control event ||~ButtonLeft<br />~ButtonMiddle<br />~ButtonRight<br />~ClickCount<br />~ContextShortcut<br />~EventName<br />~EventSource<br />~EventType<br />~FocusChangeTemporary<br />~KeyAlt<br />~KeyChar<br />~KeyCode<br />~KeyCtrl<br />~KeyFunction<br />~KeyShift<br />[[ObjectType]]<br />Recommendation<br />~RowChangeAction<br />Source<br />~SubComponentName<br />~SubComponentType<br />~XPos<br />~YPos ||
|[[Module]] |The representation of a Basic script ||[[CountOfDeclarationLines]]<br />[[CountOfLines]]<br />[[Lines]]<br />[[Name]]<br />[[ObjectType]]<br />[[ProcBodyLine]]<br />[[ProcCountLines]]<br />[[ProcOfLine]]<br />[[ProcStartLine]]<br />[[Type]] |[[Find]] |
The object class is returned for all objects as a string by the [[ObjectType]] property.
!Remark about the //Application// and //~DoCmd// classes
The //Application// and //~DoCmd// classes may be instantiated only once. Their instance MUST be called {{{Application}}} and {{{DoCmd}}} respectively. In fact they are implemented as module names.
As an example, it is equivalent to write next statements:
//{{{
DoCmd.OpenForm "anyform"
//}}}
or
//{{{
OpenForm "anyform"
//}}}
This complies with the //~MSAccess// object model. Additionally this freedom solves potential homonymy issues between concurrent Basic libraries.
!Collections - Functions returning objects
Objects are created by the invocation of specific functions included in the API. In the calling procedure an object is defined as a variable of type //Object//.
Example:
//{{{
Dim ofForm As Object ' Variant would also be correct
Set ofForm = AllForms("myForm") ' The Set verb is mandatory in MSAccess but optional in AOO/LibO Basic
//}}}
{{{ofForm}}} contains after execution the instance of an object of class Form.
{{{AllForms}}} is called a [[collection|Collection]]. Individual members of a collection are reachable either by their index or by their name.
!Properties
!!!Property types
Within an object class one can distinguish in the current documentation next 2 property types:
| !Type of property | !Description |
|UNO |The property refers to a UNO object that can be used from user macros to invoke directly alternative properties and methods to those supported by the //~Access2Base// API. |
|Normal |Where it is really about in the //~Access2Base// software. Such a property complies with or is close to the //~MSAccess// object model. |
!!!Property names
The names of the properties are identical to their equivalent in //~MSAccess//.
However
*the semantics of the property might differ more or less,
*their arguments might differ,
*the returned values might be different.
Read the documentation about each individual property for more info.
!!!Get properties
To get the value of a __normal__ property named "~MyProperty", write :
{{indent{{{{vValue = myObject.MyProperty}}}
Depending on the context an error message can be generated stopping the execution of the macro. The error message can be issued either by AOO/~LibO Basic or by the API.
If the property is an array use :
{{indent{{{{vValue = myObject.MyProperty(i)}}}
!!!Set properties
To set the value of a __normal__ property named "~MyProperty", use next syntax :
{{indent{{{{myObject.MyProperty[(i)] = vValue}}}
the optional argument being the index if the property returns an array.
The macro will be stopped if the property setting failed.
!!!Indirection
To get the value of a __normal__ property of an object, one can write also:
{{indent{{{{vValue = myObject.getProperty("MyProperty"[, i])}}}
To set its value:
{{indent{{{{myObject.setProperty("MyProperty", vValue[, i])}}}
!!!Introspection
Finally it is possible to get the value of ALL normal properties of an object with the //Properties// function as in next example:
//{{{
Dim ofForm As Object, i As Integer, oProperty As Object
Set ofForm = AllForms("myForm")
For i = 0 To ofForm.Properties().Count - 1
Set oProperty = ofForm.Properties(i)
Print oProperty.Name & " = " & oProperty.Value & " / ",
Next i
Print
//}}}
Additionally all objects have a {{{hasProperty}}} method indicating if the given property argument is applicable or not, like in:
//{{{
Dim ofForm As Object
Set ofForm = AllForms("myForm")
If ofForm.hasProperty("AllowEdits") Then
...
End If
//}}}
!Methods
!!!Method names
The names of the methods are identical to their equivalent in //~MSAccess//.
However
*when the name is a ''reserved word'' in AOO/~LibO Basic the name is preceded by a "m" (like in method). E.g. //mClose// replaces //Close//,
*the semantics of the method might differ more or less,
*the arguments might be different in number or in admitted values or value types.
Read the documentation about each individual method for more info.
!!!Syntax
Example:
//{{{
Dim ofForm As Object
Set ofForm = AllForms("myForm")
ofForm.Move(100, 200)
//}}}
!Compatibility
Existing programs written with //~Access2Base// in versions older than 0.9.0 ''will not run normally''. The invocation of properties and methods like in
>{{{getPROPERTY(OBJECT)}}}
>{{{setPROPERTY(OBJECT, }}}//value//{{{)}}}
>{{{METHOD(OBJECT, }}}//arg1, ...//{{{)}}
''is not supported anymore as from ~Access2Base 1.7.0''.
</pre>
</div>
<div title="ObjectType" modifier="Jean-Pierre Ledure" created="201212281353" modified="201612181034" tags="Properties" changecount="7">
<pre>The //~ObjectType// property specifies the type of an [[object|Object Model]].
!!!Applies to ...
| !Object |!Description |
|[[Collection]] |A collection of objects |
|[[CommandBar]] |A toolbar or a menu |
|[[CommandBarControl]] |An element within a ~CommandBar |
|[[Control]] |A control of an open form |
|[[Database]] |The current database object |
|[[Dialog]] |A dialog, active or not |
|[[Event]] |An event object triggered by a form or control event |
|[[Field]] |A field of a table, a query or a recordset |
|[[Form]] |A form, open or not |
|[[Module]] |A Basic script |
|[[OptionGroup]] |A group of radio buttons |
|[[Property]] |A property of an object |
|[[QueryDef]] |A stored query definition |
|[[Recordset]] |A set of records related to a table, a query or a SQL statement |
|[[SubForm]] |A subform of an open form |
|[[TableDef]] |A stored table definition |
|[[TempVar]] |A temporary variable |
!!!Syntax and returned values
| !Syntax | !Returned string |
|//collection//{{{.ObjectType}}} |"COLLECTION" |
|//commandbar//{{{.ObjectType}}} |"COMMANDBAR" |
|//commandbarcontrol//{{{.ObjectType}}} |"COMMANDBARCONTROL" |
|//control//{{{.ObjectType}}} |"CONTROL" |
|//database//{{{.ObjectType}}} |"DATABASE" |
|//dialog//{{{.ObjectType}}} |"DIALOG" |
|//event//{{{.ObjectType}}} |"EVENT" |
|//field//{{{.ObjectType}}} |"FIELD" |
|//form//{{{.ObjectType}}} |"FORM" |
|//module//{{{.ObjectType}}} |"MODULE" |
|//optiongroup//{{{.ObjectType}}} |"OPTIONGROUP" |
|//property//{{{.ObjectType}}} |"PROPERTY" |
|//querydef//{{{.ObjectType}}} |"QUERYDEF" |
|//recordset//{{{.ObjectType}}} |"RECORDSET" |
|//subform//{{{.ObjectType}}} |"SUBFORM" |
|//tabledef//{{{.ObjectType}}} |"TABLEDEF" |
|//tempvar//{{{.ObjectType}}} |"TEMPVAR" |
!!!Remarks
The //~ObjectType// property is read-only.</pre>
</div>
<div title="Objects" modifier="Jean-Pierre Ledure" created="201106260832" modified="201106260845" tags="Menu">
<pre></pre>
</div>
<div title="On (control event)" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201611181607" modified="201710291452" tags="Properties" changecount="37">
<pre>The //on ... control events// properties set or return the Basic script function which is executed when the event occurs.
!!!Applies to ...
The list below details which event is applicable on which control type. Additionally a distinction is made depending on the location of the control: within a [[form|Form]] (or [[subform|SubForm]]), a [[dialog|Dialog]] or a [[grid control|GridControl]].
The last column indicates how the event is displayed in the properties box related to the control when the form or dialog is being edited.
|!<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />EVENT| !<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />When applied to ... | !<br /><br /><br /><br /><br /><br />&nbsp;C&nbsp;<br />&nbsp;h&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;c&nbsp;<br />&nbsp;k&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;x&nbsp; | !<br /><br /><br /><br /><br /><br />&nbsp;C&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;m&nbsp;<br />&nbsp;b&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;x&nbsp; | !<br />&nbsp;C&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;m&nbsp;<br />&nbsp;m&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;d&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;u&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;n&nbsp; | !<br />&nbsp;C&nbsp;<br />&nbsp;u&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;c&nbsp;<br />&nbsp;y&nbsp;<br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;d&nbsp; | !<br /><br /><br /><br /><br />&nbsp;D&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;d&nbsp; | !<br /><br /><br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;C&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;l&nbsp; | !<br /><br /><br /><br /><br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;x&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;d&nbsp;<br />&nbsp;L&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;e&nbsp; | !<br /><br /><br /><br /><br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;x&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;d&nbsp;<br />&nbsp;T&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;x&nbsp;<br />&nbsp;t&nbsp; | !&nbsp;F&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;m&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;d&nbsp;<br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;d&nbsp; | !<br /><br /><br />&nbsp;G&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;d&nbsp;<br />&nbsp;C&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;l&nbsp; | !<br /><br /><br /><br /><br /><br />&nbsp;G&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;u&nbsp;<br />&nbsp;p&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;x&nbsp; | !<br />&nbsp;H&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;d&nbsp;<br />&nbsp;d&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;C&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;l&nbsp; | !<br /><br /><br />&nbsp;I&nbsp;<br />&nbsp;m&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;g&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;u&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;n&nbsp; | !<br /><br />&nbsp;I&nbsp;<br />&nbsp;m&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;g&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;C&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;l&nbsp; | !<br /><br /><br /><br /><br /><br /><br />&nbsp;L&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;s&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;x&nbsp; | !<br />&nbsp;N&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;v&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;g&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;r&nbsp; | !<br /><br />&nbsp;N&nbsp;<br />&nbsp;u&nbsp;<br />&nbsp;m&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;c&nbsp;<br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;d&nbsp; | !<br /><br />&nbsp;P&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;d&nbsp; | !<br /><br /><br />&nbsp;P&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;g&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;s&nbsp;<br />&nbsp;s&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;r&nbsp; | !<br /><br /><br />&nbsp;R&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;d&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;u&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;n&nbsp; | !<br /><br /><br /><br /><br />&nbsp;S&nbsp;<br />&nbsp;c&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;a&nbsp;<br />&nbsp;r&nbsp; | !<br /><br /><br /><br />&nbsp;S&nbsp;<br />&nbsp;p&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;n&nbsp;<br />&nbsp;B&nbsp;<br />&nbsp;u&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;n&nbsp; | !<br /><br /><br /><br /><br /><br /><br />&nbsp;S&nbsp;<br />&nbsp;u&nbsp;<br />&nbsp;b&nbsp;<br />&nbsp;F&nbsp;<br />&nbsp;o&nbsp;<br />&nbsp;r&nbsp;<br />&nbsp;m&nbsp; | !<br /><br /><br /><br /><br />&nbsp;T&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;x&nbsp;<br />&nbsp;t&nbsp;<br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;d&nbsp; | !<br /><br /><br /><br /><br />&nbsp;T&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;m&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;F&nbsp;<br />&nbsp;i&nbsp;<br />&nbsp;e&nbsp;<br />&nbsp;l&nbsp;<br />&nbsp;d&nbsp; | !<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />Event as displayed in the (english) Base user interface |
| ''~OnActionPerformed'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||||||||||||background-color:#eee; X |||||background-color:#eee; X |||||| Execute action |
|~| //Datagrid// |background-color:#eee; X |||||||||||||||||||||||||~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||||||||||||background-color:#eee; X |||||background-color:#eee; X ||||||~|
| ''~OnAdjustmentValueChanged'' | //Form// |||||||||||||||||||||background-color:#eee; X |background-color:#eee; X |||| While adjusting |
|~| //Datagrid// ||||||||||||||||||||||||||~|
|~| //Dialog// |||||||||||||||||||||background-color:#eee; X |||||~|
| ''~OnApproveAction'' | //Form// |||background-color:#eee; X ||||||||||background-color:#eee; X ||||||||||||| Approve action |
|~| //Datagrid// ||||||||||||||||||||||||||~|
|~| //Dialog// ||||||||||||||||||||||||||~|
| ''~OnApproveReset'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Prior to reset |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// ||||||||||||||||||||||||||~|
| ''~OnApproveUpdate'' | //Form// ||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X |background-color:#eee; X |||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Before updating |
|~| //Datagrid// ||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// ||||||||||||||||||||||||||~|
| ''~OnChanged'' | //Form// |||||||||||||||background-color:#eee; X |||||||||background-color:#eee; X || Changed |
|~| //Datagrid// ||||||||||||||||||||||||background-color:#eee; X ||~|
|~| //Dialog// ||||||||||||||||||||||||||~|
| ''~OnErrorOccurred'' | //Form// ||background-color:#eee; X |||||||background-color:#eee; X |background-color:#eee; X |||||background-color:#eee; X ||||||||||| Error occurred |
|~| //Datagrid// ||background-color:#eee; X |||||||background-color:#eee; X ||||||background-color:#eee; X |||||||||||~|
|~| //Dialog// ||||||||||||||||||||||||||~|
| ''~OnFocusGained'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | When receiving focus |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnFocusLost'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | When losing focus |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnItemStateChanged'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||||||||||||background-color:#eee; X |||||background-color:#eee; X |||||| Item status changed |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X |||||||||||||background-color:#eee; X |||||||||||~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||||||||||||background-color:#eee; X |||||background-color:#eee; X ||||||~|
| ''~OnKeyPressed'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Key pressed |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnKeyReleased'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Key released |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnMouseDragged'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Mouse moved while key pressed |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnMouseEntered'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Mouse inside |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnMouseExited'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Mouse outside |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnMouseMoved'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Mouse moved |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnMousePressed'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Mouse button pressed |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnMouseReleased'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | Mouse button released |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnResetted'' | //Form// |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | After resetting |
|~| //Datagrid// |background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// ||||||||||||||||||||||||||~|
| ''~OnTextChanged'' | //Form// ||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X ||||||||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X | Text modified |
|~| //Datagrid// ||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// ||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X ||||||||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
| ''~OnUpdated'' | //Form// ||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X |background-color:#eee; X |||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X |||background-color:#eee; X |background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X | After updating |
|~| //Datagrid// ||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||background-color:#eee; X ||||||background-color:#eee; X ||background-color:#eee; X |background-color:#eee; X ||||||background-color:#eee; X |background-color:#eee; X |~|
|~| //Dialog// ||||||||||||||||||||||||||~|
!!!Syntax
//control.//{{{OnActionPerformed}}}
//control.//{{{OnActionPerformed}}}=//value//
...etc...
!!!Returned vales / Arguments
{{{String}}}
!!!Remarks
*The //value// argument or the returned value is a string pointing to a Basic (or other ...) subroutine: see the [[Scripting Framework URI Specification|https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework_URI_Specification]] for more info.<br />E.g.<br />&nbsp;&nbsp;&nbsp;&nbsp;{{{vnd.sun.star.script:Standard.myModule.myMacro?language=Basic&location=document}}}<br />designates the {{{myMacro}}} Function or Sub in the {{{myModule}}} module of the Basic {{{Standard}}} library belonging to the current document.<br />Note that ~Access2Base does not check the validity of the provided argument.
*Use an empty string ("") to remove the current setting.
*The new control events settings will ''NOT'' be saved in the form after its closure.
!!!Error messages
|Property 'On...' not applicable in this context |
|"Value '...' is invalid for property 'On...' |
!!!See also
[[On (database event)]]
[[On (dialog event)]]
[[On (form event)]]
!!!Example
<<tiddler "On control event example">></pre>
</div>
<div title="On (database event)" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201710291438" modified="201710291451" tags="Properties" changecount="6">
<pre>The //on ... database events// properties return the Basic script function which is executed when the event occurs.
!!!Applies to ...
The list below details which event is applicable on [[database documents|Database]].
The last column indicates how the event is displayed in the //Events// tab of the //Tools + Customize// dialog box.
| !EVENT | !DATABASE | !Event as dispayed in the (english) Base user interface |
|~OnCreate | X |Document created |
|~OnFocus | X |Activate Document |
|~OnLoad | X |Open Document |
|~OnLoadFinished | X |Document loading finished |
|~OnModifyChanged | X |'Modified’ status was changed |
|~OnNew | X |New Document |
|~OnPrepareUnload | X |Document is going to be closed |
|~OnPrepareViewClosing | X |View is going to be closed |
|~OnSave | X |Save Document |
|~OnSaveAs | X |Save Document As |
|~OnSaveAsDone | X |Document has been saved as |
|~OnSaveAsFailed | X |'Save as’ has failed |
|~OnSaveDone | X |Document has been saved |
|~OnSaveFailed | X |Saving of document failed |
|~OnSubComponentClosed | X |Closed a sub component |
|~OnSubComponentOpened | X |Loaded a sub component |
|~OnTitleChanged | X |Document title changed |
|~OnUnfocus | X |Deactivate Document |
|~OnUnload | X |Document closed |
|~OnViewClosed | X |View closed |
|~OnViewCreated | X |View created |
!!!Syntax
//database.//{{{OnLoad}}}
...etc...
!!!Returned value
{{{String}}}
!!!Remarks
*The returned value is a string pointing to a Basic (or other ...) subroutine: see the [[Scripting Framework URI Specification|https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework_URI_Specification]] for more info.<br />E.g.<br />&nbsp;&nbsp;&nbsp;&nbsp;{{{vnd.sun.star.script:Standard.myModule.myMacro?language=Basic&location=document}}}<br />designates the {{{myMacro}}} Function or Sub in the {{{myModule}}} module of the Basic {{{Standard}}} library belonging to the current document.<br />Note that ~Access2Base does not check the validity of the provided argument.
!!!Error messages
|Property 'On...' not applicable in this context |
!!!See also
[[On (control event)]]
[[On (dialog event)]]
[[On (form event)]]</pre>
</div>
<div title="On (dialog event)" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201703181602" modified="201710291451" tags="Properties" changecount="8">
<pre>The //on ... dialog events// properties set or return the Basic script function which is executed when the event occurs.
!!!Applies to ...
The list below details which event is applicable on [[dialogs|Dialog]].
The last column indicates how the event is displayed in the dialog properties box when the dialog is being edited.
| !EVENT | !DIALOG | !Event as dispayed in the (english) Base user interface |
|~OnFocusGained | X |When receiving focus |
|~OnFocusLost | X |When losing focus |
|~OnKeyPressed | X |Key pressed |
|~OnKeyReleased | X |Key released |
|~OnMouseDragged | X |Mouse moved while key pressed |
|~OnMouseEntered | X |Mouse inside |
|~OnMouseExited | X |Mouse outside |
|~OnMouseMoved | X |Mouse moved |
|~OnMousePressed | X |Mouse button pressed |
|~OnMouseReleased | X |Mouse button released |
!!!Syntax
//dialog.//{{{OnFocusGained}}}
//dialog.//{{{OnFocusGained}}}=//value//
...etc...
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
*The //value// argument or the returned value is a string pointing to a Basic (or other ...) subroutine: see the [[Scripting Framework URI Specification|https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework_URI_Specification]] for more info.<br />E.g.<br />&nbsp;&nbsp;&nbsp;&nbsp;{{{vnd.sun.star.script:Standard.myModule.myMacro?language=Basic&location=document}}}<br />designates the {{{myMacro}}} Function or Sub in the {{{myModule}}} module of the Basic {{{Standard}}} library belonging to the current document.<br />Note that ~Access2Base does not check the validity of the provided argument.
*Use an empty string ("") to remove the current setting.
*The dialog must at least be [[started|Start]] to change the script assigned to an event.
*The new dialog events settings will ''NOT'' be saved in the dialog library after its closure.
!!!Error messages
|Property 'On...' not applicable in this context |
|"Value '...' is invalid for property 'On...' |
!!!See also
[[On (control event)]]
[[On (database event)]]
[[On (form event)]]
!!!Example
<<tiddler "On dialog event example">></pre>
</div>
<div title="On (form event)" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201611300920" modified="201710291453" tags="Properties" changecount="10">
<pre>The //on ... form events// properties set or return the Basic script function which is executed when the event occurs.
!!!Applies to ...
The list below details which event is applicable either on [[forms|Form]] or on [[subforms|SubForm]]. In fact, there is no difference.
The last column indicates how the event is displayed in the form or (subform) control properties box when the form is being edited.
| !EVENT | !FORM | !SUBFORM | !Event as dispayed in the (english) Base user interface |
|~OnApproveCursorMove | X | X |Before record change |
|~OnApproveParameter | X | X |Fill parameters |
|~OnApproveReset | X | X |Prior to reset |
|~OnApproveRowChange | X | X |Before record action |
|~OnApproveSubmit | X | X |Before submitting |
|~OnConfirmDelete | X | X |Confirm deletion |
|~OnCursorMoved | X | X |After record change |
|~OnErrorOccurred | X | X |Error occurred |
|~OnLoaded | X | X |When loading |
|~OnReloaded | X | X |When reloading |
|~OnReloading | X | X |Before reloading |
|~OnResetted | X | X |After resetting |
|~OnRowChanged | X | X |After record action |
|~OnUnloaded | X | X |When unloading |
|~OnUnloading | X | X |Before unloading |
!!!Syntax
//form.//{{{OnApproveCursorMove}}}
//form.//{{{OnApproveCursorMove}}}=//value//
//subform.//{{{OnApproveCursorMove}}}
//subform.//{{{OnApproveCursorMove}}}=//value//
...etc...
!!!Returned vales / Arguments
{{{String}}}
!!!Remarks
*The //value// argument or the returned value is a string pointing to a Basic (or other ...) subroutine: see the [[Scripting Framework URI Specification|https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework_URI_Specification]] for more info.<br />E.g.<br />&nbsp;&nbsp;&nbsp;&nbsp;{{{vnd.sun.star.script:Standard.myModule.myMacro?language=Basic&location=document}}}<br />designates the {{{myMacro}}} Function or Sub in the {{{myModule}}} module of the Basic {{{Standard}}} library belonging to the current document.<br />Note that ~Access2Base does not check the validity of the provided argument.
*Use an empty string ("") to remove the current setting.
*The new form events settings will ''NOT'' be saved in the form after its closure.
!!!Error messages
|Property 'On...' not applicable in this context |
|"Value '...' is invalid for property 'On...' |
!!!See also
[[On (control event)]]
[[On (database event)]]
[[On (dialog event)]]
!!!Example
<<tiddler "On form event example">></pre>
</div>
<div title="On control event example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201611300838" modified="201611300839" tags="[[Snippets of Code]]" changecount="2">
<pre>Change the behaviour of the form when a control gets the focus
//{{{
Dim ocControl As Object
Set ocControl = Application.Forms("myForm").Controls("myControl")
' Change event "When receiving focus"
ocControl.OnFocusGained = "vnd.sun.star.script:Standard.myModule.myFunction?language=Basic&location=document"
' Cancel the event "When losing focus"
ocControl.OnFocusLost = ""
//}}}</pre>
</div>
<div title="On dialog event example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201703181628" tags="[[Snippets of Code]]" changecount="1">
<pre>Change the behaviour of the dialog when the mouse is pressed anywhere in the perimeter of the dialog
//{{{
Dim oDialog As Object
Set oDialog = Application.AllDialogs("myDialog")
oDialog.Start()
' Change event "OnMousePressed"
' The function might return True or False
oDialog.OnMousePressed = "vnd.sun.star.script:Standard.myModule.myFunction?language=Basic&location=document"
' Cancel the event "OnKey Pressed"
oDialog.OnKeyPressed = ""
//}}}</pre>
</div>
<div title="On form event example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201611300938" modified="201611300942" tags="[[Snippets of Code]]" changecount="2">
<pre>Change the behaviour of the form when the user erases a record from a subform
//{{{
Dim ocSubForm As Object
Set ocSubForm = Application.Forms("myForm").Controls("mySubForm").Form
' Change event "Confirm deletion"
' The function might return True or False
ocSubForm.OnConfirmDelete = "vnd.sun.star.script:Standard.myModule.myFunction?language=Basic&location=document"
' Cancel the event "SQL Error occurred"
ocSubForm.OnErrorOccurred = ""
//}}}</pre>
</div>
<div title="OnAction" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201507251218" modified="201507251404" tags="Properties" changecount="16">
<pre>The //~OnAction// property gets or sets the name of a Basic procedure or a menu-command that will run when the user clicks on a [[CommandBarControl]].
!!!Applies to ...
| !Object |!Description |
|[[CommandBarControl]] |A control belonging to a ~CommandBar. |
!!!Syntax
//commandbarcontrol//{{{.OnAction}}}
//commandbarcontrol//{{{.OnAction}}} = //value//
!!!Returned value / Argument
The returned value is always a {{{String}}}.
The argument may be either an {{{Integer/Long}}} or a {{{String}}}
!!!Remarks
The //value// argument can be 1 out of 3 types:
*any valid argument of the [[RunCommand]] action;
*any valid command with the leftmost characters = ''{{{".uno:"}}}'';
*or a string pointing to a Basic (or other ...) subroutine: see the [[Scripting Framework URI Specification|https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework_URI_Specification]] for more info.<br />E.g.<br />&nbsp;&nbsp;&nbsp;&nbsp;{{{vnd.sun.star.script:Standard.myModule.myMacro?language=Basic&location=document}}}<br />designates the {{{myMacro}}} Function or Sub in the {{{myModule}}} module of the Basic {{{Standard}}} library belonging to the current document.
!!!Error messages
|Property '~OnAction' not applicable in this context |
|Value '...' is invalid for property '~OnAction |
!!!See also
[[CommandBar]]
[[CommandBarControl]]
[[Execute|Execute (commandbarcontrol)]]
[[RunCommand]]
!!!Example
<<tiddler "CommandBarControl example">></pre>
</div>
<div title="OpenArgs" modifier="Jean-Pierre Ledure" created="201107181309" modified="201405291627" tags="Properties" changecount="2">
<pre>The //~OpenArgs// property determines the expression that was passed as argument of an [[OpenForm]] action.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
!!!Syntax
//form//{{{.OpenArgs}}}
!!!Returned values
{{{Variant}}}
!!!Remarks
*The //~OpenArgs// property is read-only.
*Being a variant, the ~OpenArgs argument of the OpenForm action might contain a complex value allowing complex processing (see example).
*The //form// argument must be the [[object|Object Model]] returned by the OpenForm action. Otherwise, f.i. if the object is the usual output of a [[Forms]] method, the ~OpenArgs property always returns a zero-length string.<br />__This is a major restriction to the functionality provided by ~MSAccess__.
*The //~OpenArgs// property applied to a [[standalone form|Standalone Forms]] stored in a non-Base (Writer, Calc, ...) document always returns a zero-length string.
!!!Error messages
!!!See also
[[Tag]]
!!!Example
<<tiddler "OpenArgs example">></pre>
</div>
<div title="OpenArgs example" modifier="Jean-PierreLedure" created="201107181246" modified="201212141454" tags="[[Snippets of Code]]">
<pre>In a 1st step open a form with the ~OpenArgs argument
//{{{
Dim ofForm As Object
Const acNormal = 0
Set ofForm = OpenForm("myForm", acNormal, , , , , Array("MICKEY", "WINNIE"))
//}}}
In a 2nd step compute a filter based on the ~OpenArgs property
//{{{
Dim sFilter As String, i As Integer
sFilter = ""
For i = 0 To UBound(ofForm.OpenArgs)
sFilter = sFilter & Iif(i=0, "", " Or ") & "[EMPLOYEE].[NAME] LIKE '*" & ofForm.OpenArgs(i) & "*'"
Next i
ofForm.Filter = sFilter
ofForm.FilterOn = True
//}}}</pre>
</div>
<div title="OpenConnection" modifier="Jean-Pierre Ledure" created="201201071457" modified="201408311553" tags="Methods" changecount="9">
<pre>{{firstletter{
@@color:#930;T@@
}}}he invocation of the //~OpenConnection// as a Sub is mandatory before any other use of the //~Access2Base// API. It initializes the resources needed to process inside the API the subsequent invocations to its methods and actions.
*If the document is a Base document (suffix = ".odb") then a link is established with its database.
*If the document is not a Base document (a Writer, Calc, ... document), then a link is established with each database associated with the [[standalone forms|Standalone Forms]] contained in the document.
<<tiddler "ApplyApplication">>
!!!Syntax when invoked from a usual Base document (.odb file)
{{{Call [Application.]OpenConnection (ThisDatabaseDocument)}}}
| !Argument | !Optional | !Type |!Description |
|{{{ThisDatabaseDocument}}} | No | com.sun.star.comp.dba.~ODatabaseDocument |Must be exactly spelled as is. |
!!!Syntax when invoked from document containing one or more standalone forms (Writer, Calc, ... file)
{{{Call [Application.]OpenConnection (ThisComponent)}}}
| !Argument | !Optional | !Type |!Description |
|{{{ThisComponent}}} | No | ~SwXTextDocument |Must be exactly spelled as is. |
!!!Remarks
*If the access to the database requires a //login// and if not yet done, the user will be prompted for entering a username and a password.
*The syntax that was valid up to //~Access2Base// version 1.0.0 is still accepted. However the //username// and //password// arguments are ignored.
!!!See also
[[CloseConnection]]
[[CurrentDb]]
[[Database]]
[[Install]]
[[OpenDatabase]]
[[Standalone Forms]]
!!!Example
The Call ~OpenConnection sentence is usually invoked in the macro linked to the //~OpenDocument event// of the (Base or non-Base) document.
<<tiddler "Openconnection example">>
<<tiddler "CurrentDb example">>
<<tiddler "Standalone Connect example">>
</pre>
</div>
<div title="OpenDatabase" modifier="Jean-Pierre Ledure" created="201402161525" modified="201405241306" tags="Methods" changecount="3">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~OpenDatabase// method returns a [[Database]] object that establishes a link with an external database represented by a database document (".odb" file).
The returned object allows data retrieval and update in the targeted database.
<<tiddler "ApplyApplication">>
!!!Syntax
{{{Set }}}//{{{database}}}//{{{ = [Application.]OpenDatabase (connectionstring, [username], [password], [readonly])}}}
| !Argument | !Optional | !Type |!Description |
|{{{connectionstring}}} || string |Either<br />- the name under which the targeted database is //registered//<br />- or the URL of the ".odb" file referring to the targeted database. |
|{{{username}}} | Y | string |The connection parameters to the effective database, if any. |
|{{{password}}} | Y |~|~|
|{{{readonly}}} | Y | Boolean |If {{{True}}} updates of the database data will be forbidden.<br />Default = {{{False}}} |
!!!Remarks
*The resulting [[Database]] object must be kept by the program in a Basic variable with a scope that is compatible with the duration of the operations done on the database. F.i. a {{{Global}}}, a {{{Static}}} or a module-level {{{Public}}} variable sometimes fit best for that purpose.
*After use the database should be closed with the [[Close|Close (method)]] method.
!!!Error messages
|Connection to the database is not active |
!!!See also
[[Close (method)]]
[[Database]]
[[CurrentDb]]
[[OpenConnection]]
[[Standalone Forms]]
!!!Example
<<tiddler "Opendatabase example">></pre>
</div>
<div title="OpenForm" modifier="Jean-Pierre Ledure" created="201112311435" modified="201409271453" tags="Actions" changecount="8">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~OpenForm// action opens a form in Form view or in form Design view. You can select data entry and window modes for the form and restrict the records that the form displays.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]OpenForm(}}}//{{{FormName, View, Filter, WhereCondition, DataMode, WindowMode, OpenArgs}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{FormName}}} | No | String |The name of the form to open. |
|{{{View}}} | Yes | acDesign<br />acNormal<br />acPreview |The view in which the form will open.<br />//acNormal// and //acPreview// are equivalent. Default is //acNormal//. |
|{{{Filter}}} |~| String |A valid __SQL WHERE clause__ (without the word WHERE). |
|{{{WhereCondition}}} |~| String |A valid __SQL WHERE clause__ (without the word WHERE). |
|{{{DataMode}}} |~| acFormAdd<br />acFormEdit<br />acFormPropertySettings<br />acFormReadOnly |Specifies if the user will be allowed to add new records (//acFormAdd//), add new and edit existing records (//acFormEdit//) or only read existing records (//acFormReadOnly//). //acFormPropertySettings// refers to the settings at form creation.<br />Only //acFormEdit// alows record deletions. |
|{{{WindowMode}}} |~| acHidden<br />acWindowNormal |Default is //acWindowNormal//. |
|{{{OpenArgs}}} |~| Variant |The argument is used to set the form's [[OpenArgs]] property. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acDesign = 1
Const acNormal = 0
Const acPreview = 2
Const acFormAdd = 0
Const acFormEdit = 1
Const acFormPropertySettings = -1
Const acFormReadOnly = 2
Const acHidden = 1
Const acWindowNormal = 0
//}}}
!!!Remarks
*The //Filter// and //~WhereCondition// arguments are simply concatenated and applied as filter to the form:
//{{{
( Filter ) And ( WhereCondition )
//}}}
*The //~OpenForm// action returns a [[Form]] object.
*If the //view// argument is //acDesign//, the form will get opened in Design mode. However any further action is not supported by the ~Access2Base API.
*The //~OpenForm// action cannot open and must not be triggered from a [[standalone form|Standalone Forms]].
!!!Error messages
|Action not applicable in this context |
|Form '...' could not be opened |
!!!See also
[[AllowAdditions]]
[[AllowDeletions]]
[[AllowEdits]]
[[Close]]
[[Filter]]
[[FilterOn]]
[[OpenArgs]]
[[OpenQuery]]
[[OpenReport]]
[[OpenSQL]]
[[OpenTable]]
!!!Example
<<tiddler "Openform example">></pre>
</div>
<div title="OpenQuery" modifier="Jean-Pierre Ledure" created="201201011504" modified="201409271454" tags="Actions" changecount="4">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~OpenQuery// action opens a query in normal view or in query design view.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]OpenQuery(}}}//{{{QueryName, View, DataMode}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{QueryName}}} | No | String |The name of the query to open. This argument is NOT case-sensitive. |
|{{{View}}} | Yes | acViewDesign<br />acViewNormal<br />acViewPreview |The view in which the query will open.<br />//acViewNormal// and //acViewPreview// are equivalent. Default is //acViewNormal//. |
|{{{DataMode}}} |~| acEdit |The user will be allowed to add new records and edit existing records. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acViewDesign = 1
Const acViewNormal = 0
Const acViewPreview = 2
Const acEdit = 1
//}}}
!!!Remarks
*If the //view// argument is //acDesign//, the query will get opened in Design mode. However any further action is not supported by the ~Access2Base API.
*The //~OpenQuery// action must not be triggered from a [[standalone form|Standalone Forms]].
!!!Error messages
|Query '...' could not be opened |
|Query '...' not found |
|Action not applicable in this context |
!!!See also
[[Close]]
[[OpenForm]]
[[OpenReport]]
[[OpenSQL]]
[[OpenTable]]
!!!Example
//{{{
Const acViewNormal = 0
OpenQuery("myQuery", acViewNormal)
//}}}</pre>
</div>
<div title="OpenRecordset" modifier="Jean-Pierre Ledure" created="201306141339" modified="201405241308" tags="Methods" changecount="5">
<pre>Creates a new [[Recordset]] object and appends it to the [[Recordsets]] collection of the concerned [[database object|Database]].
!!!Applies to ...
| !Object | !Description |
|[[Database]] |The representation of a database. |
|[[TableDef]] |The representation of a database table. |
|[[QueryDef]] |The representation of a database query. |
|[[Recordset]] |The representation of another recordset. |
!!!Syntax
For a database object:
>Set //recordset// = //database//.{{{Openrecordset}}} (//source, type, option, lockedit//)
For tabledef, querydef and recordset objects:
>Set //recordset// = //tabledef//.{{{Openrecordset}}} (//type, option, lockedit//)
>Set //recordset// = //querydef//.{{{Openrecordset}}} (//type, option, lockedit//)
>Set //recordset// = //recordset//.{{{Openrecordset}}} (//type, option, lockedit//)
!!!Arguments - Returned value
| !Argument | !Type | !Optional | !Description | !Returned value |
|source | String ||A table name, a query name, or an SQL statement that returns records | A [[recordset|Recordset]] object |
|type | Integer<br />Long | Y |If the argument is present its only allowed value = //dbOpenForwardOnly//.<br />Forces one-directional browsing of the records. |~|
|option | Integer<br />Long | Y |If the argument is present its only allowed value = //dbSQLPassThrough//.<br />Forces escape substitution before sending the SQL statement to the database. |~|
|lockedit | Integer<br />Long | Y |If the argument is present its only allowed value = //dbReadOnly//.<br />Forces dirty read and prevents from database updates. |~|
!!!Remarks
*A recordset object MUST be closed by the [[close|Close (method)]] method __as soon as it becomes useless__ to avoid eventual record (dead)locks. To close all open recordsets at once, use the [[CloseAllRecordsets]] method.
*If the //~OpenRecordset// method is applied to a //database// object and the //source// argument is not a SQL statement then the //source// is presumed to contain at first a TABLE name and secondly a QUERY name.
*To include the constants in your own code, copy and paste next lines:
//{{{
Const dbOpenForwardOnly = 8
Const dbSQLPassThrough = 64
Const dbReadOnly = 4
//}}}
*To access the recordset linked to a [[form|Form]] or a [[subform|SubForm]] use the [[recordset property|Recordset (property)]].
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|SQL error, SQL statement = '...' |
|Table/Query '...' not found |
!!!See also
[[Close|Close (method)]]
[[CloseAllRecordsets]]
[[Filter]]
[[Recordset object|Recordset]]
[[Recordset property|Recordset (property)]]
[[TableDefs]]
[[TableDef]]
[[QueryDefs]]
[[QueryDef]]
!!!Example
<<tiddler "OpenRecordset example">></pre>
</div>
<div title="OpenRecordset example" modifier="Jean-PierreLedure" created="201306141523" modified="201306291004" tags="[[Snippets of Code]]">
<pre>Create a new recordset on table //Invoices// and count the records (not the most efficient way to do it ... !)
//{{{
Const dbReadOnly = 4
Dim orsRecords As Object, lCount As Long
Set orsRecords = Application.CurrentDb().OpenRecordset("INVOICES", , , dbReadOnly)
lCount = 0
With orsRecords
If Not .BOF Then ' An empty recordset has both .BOF and .EOF set to True
Do While Not .EOF
lCount = lCount + 1
.MoveNext
Loop
End If
.mClose()
End With
Print "Number of records = " & lCount
//}}}</pre>
</div>
<div title="OpenReport" modifier="Jean-Pierre Ledure" created="201201011509" modified="201409271454" tags="Actions" changecount="3">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~OpenReport// action opens a report in normal view or in report design view.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]OpenReport(}}}//{{{ReportName, View}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{ReportName}}} | No | String |The name of the report to open. This argument is NOT case-sensitive. |
|{{{View}}} | Yes | acViewDesign<br />acViewNormal<br />acViewPreview |The view in which the query will open.<br />//acViewNormal// and //acViewPreview// are equivalent. Default is //acViewNormal//. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acViewDesign = 1
Const acViewNormal = 0
Const acViewPreview = 2
//}}}
!!!Remarks
*If the report was built with the Sun Report Builder extension, this extension is required to get the report open.
*If the //view// argument is //acDesign//, the query will get opened in Design mode. However any further action is not supported by the ~Access2Base API.
*The //~OpenReport// action must not be triggered from a [[standalone form|Standalone Forms]].
!!!Error messages
|Report '...' could not be opened |
|Report '...' not found |
|Action not applicable in this context |
!!!See also
[[Close]]
[[OpenForm]]
[[OpenQuery]]
[[OpenSQL]]
[[OpenTable]]
!!!Example
//{{{
Const acViewNormal = 0
OpenQuery("myQuery", acViewNormal)
//}}}</pre>
</div>
<div title="OpenSQL" modifier="Jean-Pierre Ledure" created="201303311533" modified="201502151536" tags="Actions" changecount="4">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~OpenSQL// action opens a datasheet containing the data described by the provided SELECT SQL statement.
<<tiddler "ApplyDoCmd">>
or to ...
| !Object | !Description |
|[[Database]] |A database object returned by the [[CurrentDb]] or [[OpenDatabase]] methods. |
!!!Syntax
{{{[DoCmd.]OpenSQL(}}}//{{{SQL, option}}}//{{{)}}}
//{{{database}}}//{{{.OpenSQL(}}}//{{{SQL, option}}}//{{{)}}}
| !Argument | !Optional | !Type |!Description |
|database || Object |A database object opened with the //~OpenDatabase// method. |
|SQL | No | String |A SELECT SQL statement. |
|option | Yes | Integer<br />Long |If the argument is present its only allowed value = //dbSQLPassThrough//.<br />Forces escape substitution before sending the SQL statement to the database. |~|
!!!Remarks
*Statements
//{{{
DoCmd.OpenSQL( ... )
//}}}
and
//{{{
Application.CurrentDb().OpenSQL( ... )
//}}}
are equivalent.
*The tablenames and columnnames used in the SQL statement may be surrounded by square brackets "[]". They will be replaced by the character(s) expected by their RDBMS (//Relational Database Management System//).
*To include the constant in your own code, copy and paste next lines:
//{{{
Const dbSQLPassThrough = 64
//}}}
!!!Error messages
If the syntax of the SQL statement is wrong a system error will be raised.
!!!See also
[[CurrentDb]]
[[OpenDatabase]]
[[OpenForm]]
[[OpenQuery]]
[[OpenReport]]
[[OpenTable]]
!!!Example
//{{{
OpenSQL("SELECT * FROM [EMPLOYEES]")
//}}}</pre>
</div>
<div title="OpenTable" modifier="Jean-Pierre Ledure" created="201201011448" modified="201409271454" tags="Actions" changecount="3">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~OpenTable// action opens a table in normal view or in table design view.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]OpenTable(}}}//{{{TableName, View, DataMode}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{TableName}}} | No | String |The name of the table to open. This argument is NOT case-sensitive. |
|{{{View}}} | Yes | acViewDesign<br />acViewNormal<br />acViewPreview |The view in which the table will open.<br />//acViewNormal// and //acViewPreview// are equivalent. Default is //acViewNormal//. |
|{{{DataMode}}} |~| acEdit |The user will be allowed to add new records and edit existing records. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acViewDesign = 1
Const acViewNormal = 0
Const acViewPreview = 2
Const acEdit = 1
//}}}
!!!Remarks
*If the //view// argument is //acDesign//, the table will get opened in Design mode. However any further action is not supported by the ~Access2Base API.
*The //~OpenTable// action must not be triggered from a [[standalone form|Standalone Forms]].
!!!Error messages
|Table '...' could not be opened |
|Table '...' not found |
|Action not applicable in this context |
!!!See also
[[Close]]
[[OpenForm]]
[[OpenQuery]]
[[OpenReport]]
[[OpenSQL]]
!!!Example
//{{{
Const acViewNormal = 0
OpenTable("myTable", acViewNormal)
//}}}</pre>
</div>
<div title="Openconnection example" modifier="Jean-Pierre Ledure" created="201201071458" modified="201703041600" tags="[[Snippets of Code]]" changecount="2">
<pre>//{{{
Sub DBOpen(Optional poEvent As Object)
If GlobalScope.BasicLibraries.hasByName("Access2Base") Then
GlobalScope.BasicLibraries.loadLibrary("Access2Base")
End If
Call Application.OpenConnection(ThisDatabaseDocument)
End Sub
//}}}</pre>
</div>
<div title="Opendatabase example" modifier="Jean-Pierre Ledure" created="201402161613" modified="201408011521" tags="[[Snippets of Code]]" changecount="1">
<pre>List all table names of an external database
//{{{
Public oDatabase As Object
Sub ScanTables()
Dim oTable As Object, oField As Object, i As Integer
Set oDatabase = Application.OpenDatabase("/home/somedir/TT NorthWind.odb",,,)
With oDatabase
For i = 0 To .TableDefs.Count - 1
Set oTable = .TableDefs(i)
DebugPrint oTable.Name
Next i
End With
oDatabase.mClose()
End Sub
//}}}</pre>
</div>
<div title="Openform example" modifier="Jean-PierreLedure" created="201112311558" modified="201212141458" tags="[[Snippets of Code]]">
<pre>Open a form
//{{{
OpenForm "myForm"
//}}}
Open a form in read only mode
//{{{
OpenForm "myForm", , , , acFormReadOnly
//}}}
Open a form in read only mode. The form must be hidden.
//{{{
Dim ofForm As Object
ofForm = OpenForm "myForm", , , , acFormReadOnly, acHidden
//}}}
Make it later visible
//{{{
ofForm.Visible = True
//}}}</pre>
</div>
<div title="OptionGroup" modifier="Jean-Pierre Ledure" created="201112271348" modified="201405251535" tags="Objects" changecount="6">
<pre>{{firstletter{
@@color:#930;A@@
}}}n //~OptionGroup// [[object|Object Model]] represents a set of [[RadioButton]] controls in a [[form|Form]], a [[subform|SubForm]] or a [[dialog|Dialog]], having in common the characteristic that selecting one button deselects automatically all the others.
Most properties can be set at //~RadioButton// level and individually for each of them. However the key reason for having introduced //~OptionGroups// (an artificial entity with no equivalent in //~OpenOffice/~LibreOffice//) in //~Access2Base// is to give the programmer an easy mean to determine which //~RadioButton// is currently selected.
!!!How to identify the set of //~RadioButtons// constituting an //~OptionGroup// ?
| !Container | !Identification of the //~OptionGroup// |!Name of the //~OptionGroup// |
|[[Form]]<br />[[SubForm]] |All the //~RadioButtons// sharing the same name |That unique name |
|[[Dialog]] |All the //~RadioButtons// having contiguous //~TabIndexes//<br />(= //Order// in the control's property sheet) |The name of the __first__ //~RadioButton// of the set |
!!!Function returning an ~OptionGroup object
| !Parent object | !Method | !Arg |!Description |
|[[Form]]<br />[[SubForm]]<br />[[Dialog]] |[[OptionGroup|OptionGroup (Method)]] | String |Returns an //~OptionGroup// object in the form, the subform or the dialog on which the method is applied having its argument as name. The name is the common name of all //radio buttons// belonging to the ~OptionGroup.|
!!!Properties
| !Property | !Read only | !Description or UNO object |
|[[Name]] | Y |Specifies the exact name of the option group. |
|[[Count]] | Y |Specifies the number of radio buttons belonging to the group. |
|[[ObjectType]] | Y |Returns "OPTIONGROUP" |
|[[Value]] ||Specifies the index of the radio button being currently selected. |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the ~OptionGroup has the given property. |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
!!Remarks
The //Value// property holds a value between 0 and //Count// - 1.
!!!See also
[[Controls]]
[[OptionGroup (Method)]]
[[RadioButton]]
[[TabIndex]]
!!!Example
<<tiddler "Optiongroup example">></pre>
</div>
<div title="OptionGroup (Method)" modifier="Jean-PierreLedure" created="201112271512" modified="201304211013" tags="Methods">
<pre>The //~OptionGroup// method returns an [[object|Object Model]] of type [[OptionGroup]]
!!!Syntax
//form//.{{{OptionGroup(}}}//groupname//{{{)}}}
//subform//.{{{OptionGroup(}}}//groupname//{{{)}}}
//dialog//.{{{OptionGroup(}}}//groupname//{{{)}}}
| !ObjectType | !Argument |!Returned value |
| [[Form]]<br />[[SubForm]] | String |An object of type //~OptionGroup// having the //groupname// as name. The name is the common name of all radio buttons sharing the same selection group. |
| [[Dialog]] |~|An object of type //~OptionGroup// having the //groupname// as name. The name is the name of the first radio button belonging to the same selection group. |
!!!Remarks
The individual //~RadioButtons// can be retrieved with the [[Controls]] method applied to the //~OptionGroup// object. Use their //index// as second argument. The //index// is determined
*in //forms// and //subforms// by the ~X-Y coordinates of the //~RadioButton// on the screen
*in //dialogs// by the rank of the //~TabIndex// property in the sequence of contiguous //~TabIndexes// determining the //~OptionGroup//.
The //index// starts from 0.
!!!See also
[[Controls]]
[[OptionGroup]]
[[RadioButton]]
[[TabIndex]]
!!!Example
<<tiddler "Optiongroup example">></pre>
</div>
<div title="OptionValue" modifier="Jean-PierreLedure" created="201112271522" modified="201306151424" tags="Properties">
<pre>The //~OptionValue// property specifies the value stored in the database as determined by the selected [[RadioButton]].
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl |!Description |
|[[Control]] | [[RadioButton]] | None |A control on an open form. |
!!!Syntax
//control//{{{.OptionValue}}}
!!!Returned value
{{{String}}}
!!!Remarks
The //~OptionValue// property is read-only.
!!!Error messages
!!!See also
[[RadioButton]]
[[OptionGroup]]
!!!Example
<<tiddler "OptionValue example">></pre>
</div>
<div title="OptionValue example" modifier="Jean-PierreLedure" created="201212141506" tags="[[Snippets of Code]]">
<pre>Browse thru the values to store in the database by button
//{{{
Dim ofForm As Object, ocOptionGroup As Object, ocControl As Object, i as integer
Set ofForm = Forms("myform")
Set ocOptionGroup = ofForm.OptionGroup("myRadioButton")
ocOptionGroup.Value = 2
For i = 0 to ocOptionGroup.Count - 1
ocControl = ocOptionGroup.Controls(i)
Print ocControl.OptionValue & "/",
Next i
//}}}</pre>
</div>
<div title="Optiongroup example" modifier="Jean-PierreLedure" created="201112271438" modified="201212081408" tags="[[Snippets of Code]]">
<pre>Change the currently selected radio button and modify its appearance
//{{{
Dim ofForm As Object, ocOptionGroup As Object, ocControl As Object, i as integer
Set ofForm = Forms("myform")
Set ocOptionGroup = ofForm.OptionGroup("myRadioButton")
ocOptionGroup.Value = 2
For i = 0 to ocOptionGroup.Count - 1
ocControl = ocOptionGroup.Controls(i)
If i = ocOptionGroup.Value Then
ocControl.ForeColor = RGB(255, 0 ,0)
Else
ocControl.ForeColor = RGB(0, 0 ,0)
End If
Next i
//}}}</pre>
</div>
<div title="OrderBy" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201407261334" modified="201407261344" tags="Properties" changecount="3">
<pre>You can use the //OrderBy// property to specify how you want to sort records in a [[form|Form]] or a [[subform|SubForm]].
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
|[[SubForm]] |A subform in an open form |
!!!Syntax
//form//{{{.OrderBy}}}
//form//{{{.OrderBy = }}}//value//
//subform//{{{.OrderBy}}}
//subform//{{{.OrderBy = }}}//value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
*The //~OrderBy// property is a string expression consisting of a ''ORDER BY'' SQL clause without the ORDER BY keywords. Like in //~MsAccess// __table names__, or __field names__ (e.g. when containing a space) may be surrounded by square brackets ([]).
*The ordering sequence is effectively applied only when the [[OrderByOn]] property is set to {{{True}}}.
!!!Error messages
|Form '...' is currently not open|
|Value '...' is invalid for property '~OrderBy' |
!!!See also
[[OrderByOn]]
!!!Example
<<tiddler "OrderBy example">></pre>
</div>
<div title="OrderBy example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201407261343" tags="[[Snippets of Code]]" changecount="1">
<pre>Set and apply an ordering sequence on a form
//{{{
Dim ofForm As Object, sOrderBy As String
Set ofForm = Forms("myForm")
sOrderBy = "[DENOMINATION] DESC"
ofForm.OrderBy = sOrderBy
ofForm.OrderByOn = True
//}}}</pre>
</div>
<div title="OrderByOn" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201407261340" modified="201407261342" tags="Properties" changecount="2">
<pre>Use the //~OrderByOn// property to specify or determine whether the [[OrderBy]] property for a form is applied.
!!!Applies to ...
| !Object | !Description |
|[[Form]] |An open form |
|[[SubForm]] |A subform in an open form |
!!!Syntax
//form//{{{.OrderByOn}}}
//form//{{{.OrderByOn = }}}//value//
//subform//{{{.OrderByOn}}}
//subform//{{{.OrderByOn = }}}//value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
When a //~OrderBy// is applied, the form is [[requeried|Requery]].
!!!Error messages
|Form '...' is currently not open|
|Value '...' is invalid for property '~OrderByOn' |
!!!See also
[[OrderBy]]
[[Requery]]
!!!Example
<<tiddler "OrderBy example">></pre>
</div>
<div title="OrderDetailsTable" modifier="Jean-PierreLedure" created="201212161600" modified="201308241518" tags="HowTo">
<pre>*Order Details table
| !Fields | !Field Type | !Primary |
|Discount | Float ||
|~OrderID | ~BigInt | Y |
|~ProductID | ~BigInt | Y |
|Quantity | Integer ||
|~UnitPrice | Number ||</pre>
</div>
<div title="OrdersTable" modifier="Jean-PierreLedure" created="201212161553" modified="201212161621" tags="HowTo">
<pre>*Orders table
| !Fields | !Field Type | !Primary |
|~CustomerID | Text ||
|~EmployeeID | Integer ||
|Freight | Number ||
|~OrderDate | Date/Time ||
|~OrderID | ~BigInt | Y |
|~RequiredDate | Date/Time ||
|~ShipAddress | Text ||
|~ShipCity | Text ||
|~ShipCountry | Text ||
|~ShipName | Text ||
|~ShippedDate | Date/Time ||
|~ShipPostalCode | Text ||
|~ShipRegion | Text ||
|~ShipVia | Integer ||</pre>
</div>
<div title="OutputTo" modifier="YourName" created="201208031317" modified="201802161401" tags="Actions" changecount="59">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~OutputTo// action outputs the data located
*in a specified [[form|Form]]
*in a specified [[table|TableDef]] or [[query|QueryDef]]
to several output formats
<<tiddler "ApplyDoCmd">>
or, when applicable to a table or a query, to ...
| !Object | !Description |
|[[Database]] |A database object opened with the [[OpenDatabase]] or returned by the [[CurrentDb]] methods. |
!!!Syntax
{{{[DoCmd.]OutputTo(}}}//{{{ObjectType, ObjectName, OutputFormat, OutputFile, AutoStart, TemplateFile, Encoding, Quality}}}//{{{)}}}
//database//{{{.OutputTo(}}}//{{{ObjectType, ObjectName, OutputFormat, OutputFile, AutoStart, TemplateFile, Encoding, Quality}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description | !Returned value |
|{{{ObjectType}}} | No | acOutputTable<br />acOutputQuery<br />acOutputForm |The type of object to output. | {{{True}}} if success |
|{{{ObjectName}}} | Yes | String |The valid name of an object of the type selected by the //~ObjectType// argument.<br />If the //~ObjectType// is acOutputForm and you want to output the active form, leave this argument blank. |~|
|{{{OutputFormat}}} | Yes | acFormatPDF<br />acFormatODT<br />acFormatDOC<br />acFormatHTML<br />acFormatODS<br />acFormatXLS<br />acFormatXLSX<br />acFormatTXT |The output format, expressed as an acFormatXXX constant. If this argument is omitted, the user will be prompted for the output format. |~|
|{{{OutputFile}}} | Yes | String |The full name, including the path, of the file you want to output the object to. If this argument is left blank, the user will be prompted for an output file name. |~|
|{{{AutoStart}}} | Yes | Boolean |If {{{True}}}, specifies that you want the appropriate application to start immediately after the //~OutputTo// action runs, with the file specified by the //~OutputFile// argument opened. |~|
|{{{TemplateFile}}} | Yes | String |Meaningful only if the //~ObjectType// argument is {{{acOutputTable}}} or {{{acOutputQuery}}} and the //~OutputFormat// argument is HTML. Otherwise must contain the null-length string.<br />The full name, including the path, of the template file. |~|
|{{{Encoding}}} | Yes | acUTF8Encoding |Meaningful only if the //~ObjectType// argument is {{{acOutputTable}}} or {{{acOutputQuery}}}. Otherwise must be zero. |~|
|{{{Quality}}} | Yes | acExportQualityPrint<br />acExportQualityScreen |This argument is ignored. |~|
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Global Const acOutputTable = 0
Global Const acOutputQuery = 1
Global Const acOutputForm = 2
Global Const acUTF8Encoding = 76
Global Const acFormatPDF = "writer_pdf_Export"
Global Const acFormatODT = "writer8"{{{date}}}<br />
Global Const acFormatDOC = "MS Word 97"
Global Const acFormatHTML = "HTML"
Global Const acFormatODS = "calc8"
Global Const acFormatXLS = "MS Excel 97"
Global Const acFormatXLSX = "Calc MS Excel 2007 XML"
Global Const acFormatTXT = "Text - txt - csv (StarCalc)"
Global Const acExportQualityPrint = 0
Global Const acExportQualityScreen = 1
//}}}
!!!Remarks
*When applied to a table or a query data {{{DoCmd.OutputTo(...)}}} and {{{Application.CurrentDb().OutputTo(...)}}} are strictly equivalent.
*The designated form MUST be open before the //~OutputTo// action is called.
*If the {{{OutputFile}}} argument is not equal to space, and If the output file already exists, it will be overwritten without warning. If the user is prompted for the output file ({{{OutputFile}}} = space), the user will be requested to confirm the Save.
*The {{{OutputFile}}} argument may be expressed either in the (recommended) URL format (i.e. "{{{file:// ...}}}") or by using the operating system usual syntax (e.g. "{{{C:\...}}}" in Windows).
*Outputting a table or a query to a Calc, Excel or text file goes first through the generation of a Calc document which is saved via the adequate filter.
*A text/csv file will always be encoded using the __Unicode (~UTF-8)__ character set. The choice of the field separator will depend on the locale setting for the decimal point: if it is a dot, then the field separator will be the comma, if it is a comma, then it will be the semi-colon. All text strings will be enclosed in double quotes.
!!!Templating and styling
Templates and CSS styles can be used when the output format is HTML and when the source of the exported data is a table or a query.
The {{{TemplateFile}}} given as argument of the //~OutputTo// action may contain abreakny HTML tags, ~JavaScript code or any other element that is acceptable in a HTML page. ~Access2Base will leave them unchanged, except when a //token// is encountered. The only accepted tokens are
| !Token | !Description |
|{{{<!--Template_Title-->}}} |Will be replaced by the name of the table or the query. |
|{{{<!--Template_Body-->}}} |Will be replaced by the effective data contained in the table or the query. |
({{{<!--AccessTemplate_Title-->}}} and {{{<!--AccessTemplate_Body-->}}} are also accepted for compatibility with ~MSAccess)
If the {{{TemplateFile}}} argument is absent, the default template used by ~Access2Base is:
//{{{
<!DOCTYPE html>
<html>
<head>
<title><!--Template_Title--></title>
</head>
<body>
<!--Template_Body-->
</body>
</html>
//}}}
To make CSS styling easy the data themselves will be generated together with next classes:
| !Class | !Tags | !Typical usage |
|{{{dbdatatable}}} | {{{<table>}}} |To not confuse the data table with other tables present in the template. |
|{{{odd}}}<br />{{{even}}} | {{{<tr>}}} |To display alternate colors or backgrounds..|
|{{{firstrow}}}<br />{{{lastrow}}} |~|To define specific borders above or under the first or the last row. |
|{{{firstcol}}}<br />{{{lastcol}}} | {{{<th>}}}<br />{{{<td>}}} |To define specific borders on the left or the right of the first or the last column. |
|{{{char}}}<br />{{{numeric}}}<br />{{{negative}}}<br />{{{date}}}<br />{{{bool}}}<br />{{{false}}}<br />{{{null}}} | {{{<td>}}} |To define display effects depending on the content of the table cell.<br />Like right justifying numbers, red fonts for negative numbers, special background for empty cells, etc. |
//Body// output example:
//{{{
<table class="dbdatatable">
<caption>myQuery</caption>
<thead>
<tr>
<th scope="col" class="firstcol">Month</th>
<th scope="col">Dept</th>
<th scope="col">Savings</th>
<th scope="col" class="lastcol">Comments</th>
</tr>
</thead>
<tfoot>
</tfoot>
<tbody>
<tr class="odd firstrow">
<td class="char firstcol">January</td>
<td class="char">Dept1</td>
<td class="numeric">100.0</td>
<td class="char lastcol">Some comments about this department</td>
</tr>
<tr class="even">
<td class="char firstcol">February</td>
<td class="char">Dept2</td>
<td class="numeric negative">-80.5</td>
<td class="char lastcol">No comment</td>
</tr>
<tr class="odd lastrow">
<td class="char firstcol">March</td>
<td class="char">Dept3</td>
<td class="numeric">75.9</td>
<td class="char null lastcol"></td>
</tr>
</tbody>
</table>
//}}}
!!!String encoding
When exporting data from a table or a query, all strings will be "~UTF-8 encoded". See f.i. [[here|http://www.w3schools.com/charsets/ref_html_utf8.asp]] for more explanation.
There are however a few exceptions. Some HTML tags (= NOT ALL) found within data strings will not be encoded. Typically links to pages located in <a> tags will remain unchanged.
Next patterns will not be encoded:
| !Pattern | !Remark |
|{{{&quot;}}}<br />{{{&apos;}}} ||
|{{{&amp;}}} |"&" will be encoded as {{{&amp;}}}. "{{{&amp;}}}" will not be encoded as {{{&amp;amp;}}} |
|{{{&lt;}}}<br />{{{&gt;}}} ||
|{{{&nbsp;}}} |Multiple normal spaces will probably appear as one single space |
|{{{<pre>}}}<br />{{{</pre>}}} |To preserve spacing and line breaks |
|{{{<br>}}} |To force a line break |
|{{{<a href="..."}}}<br />{{{<a id="..."}}}<br />{{{</a>}}} |References to hyperlinks or anchors may be present and will be preserved in strings |
|{{{<img src="..."}}} |~|
|{{{<span class="..."}}}<br />{{{</span>}}} |The <span> tag provides a way to add a specific class name or other hook to a part of a text or a part of a document |
|{{{<b> </b>}}}<br />{{{<u> </u>}}}<br />{{{<i> </i>}}} |Usual editing tags |
!!!Error messages
|Object '...' not found |
|Action not applicable in this context |
!!!See also
[[HtmlEncode]]
[[RunApp]]
[[SelectObject]]
[[SendObject]]
!!!Examples
<<tiddler "OutputTo example">>
Additionally, styling examples can be found in [[Output table or query to html - styling examples|OutputToStyling]].</pre>
</div>
<div title="OutputTo example" modifier="Jean-PierreLedure" created="201208100834" modified="201208100835" tags="[[Snippets of Code]]">
<pre>Output form in PDF format to a file (you will be prompted for the file name and location) and open the generated file (asynchronously)
//{{{
Const acOutputForm = 2
Const acFormatPDF = "writer_pdf_Export"
OutputTo(acOutputForm, "myform", acFormatPDF,, True)
//}}}</pre>
</div>
<div title="OutputToStyling" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201511141443" modified="201601161503" tags="HowTo" changecount="46">
<pre>Q: How can I output data to a web page and make it nice to read ?
R: Data can be inserted statically in a web page thanks to the [[OutputTo]] action which will export the data to a static HTML page. The exported output shall contain predefined classes which can help producing nice effects. See the examples below.
For all the examples we will use the //~EmployeesList// query.
The query embeds html tags to allow browsing from the last column rapidly to the employee's manager.
//{{{
SELECT
'<a id="' || "Employees"."EmployeeID" || '">' || "Employees"."LastName" || '</a>' AS "Last name"
, "Employees"."FirstName" AS "First name"
, "Employees"."BirthDate" AS "Birth"
, "Employees"."Extension" AS "Phone"
, "Employees"."HomePhone" AS "Home phone"
, "Employees"."Title"
, '<a href="#' || "ReportingTo"."EmployeeID" || '">' || "ReportingTo"."LastName" || '</a>' AS "Manager"
FROM
{ OJ "Employees" AS "ReportingTo" RIGHT OUTER JOIN "Employees" ON "ReportingTo"."EmployeeID" = "Employees"."ReportsTo" }
//}}}
based on the //Employees// table:
<<tiddler EmployeesTable>>
The data will be generated by next statement:
//{{{
DoCmd.OutputTo(acOutputQuery, "EmployeesList", acFormatHtml, sOutputFile, False, sTemplateFile, acUTF8Encoding)
//}}}
The template file contains nothing else but:
//{{{
<!DOCTYPE html>
<html>
<head>
<title><!--Template_Title--></title>
<link rel="stylesheet" type="text/css" href="styleX.css">
</head>
<body>
<!--Template_Body-->
</body>
</html>
//}}}
Only the content of the css stylesheet will vary in next examples.
!!Raw data without styling effects
!!!Stylesheet
The stylesheet is empty.
!!!Result
<html>
<iframe style="background-color:#ffffff; border-color:#ffffff; border:none;" width="1000" height="270" frameborder="0" scrolling="yes" src="_outputto/output1.html" title="Raw Data"></iframe>
</html>
!!Specify the table and the table caption
The ''.dbdatatable'' class designates the whole table. Use it to avoid confusion when other tables are present in the template file.
!!!Stylesheet
//{{{
body {
font-size: 100%;
}
.dbdatatable {
padding: 0;
margin: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #bcd0e4;
}
.dbdatatable caption {
caption-side: bottom;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}
//}}}
!!!Result
<html>
<iframe style="background-color:#ffffff; border-color:#ffffff; border:none;" width="1000" height="250" frameborder="0" scrolling="yes" src="_outputto/output2.html" title="Sample border"></iframe>
</html>
!!Specify the table cells
Both the header row and data cells receive in the example the same styles. The bold character of table header cells is implicit.
!!!Stylesheet
Same as before + ...
//{{{
.dbdatatable th, .dbdatatable td {
border: 1px dotted #666;
padding: 0.5em;
text-align: left;
color: #632a39;
vertical-align: middle;
}
//}}}
!!!Result
<html>
<iframe style="background-color:#ffffff; border-color:#ffffff; border:none;" width="1000" height="380" frameborder="0" scrolling="yes" src="_outputto/output3.html" title="Sample border"></iframe>
</html>
!!Specify the header row
Uppercases, white text.
!!!Stylesheet
Same as before + ...
//{{{
.dbdatatable th {
color: #fff;
background-color: #8fadcc;
text-transform: uppercase;
background-color: #7d98b3;
border-right: 1px dotted #666;
text-align: center;
}
//}}}
!!!Result
<html>
<iframe style="background-color:#ffffff; border-color:#ffffff; border:none;" width="1000" height="380" frameborder="0" scrolling="yes" src="_outputto/output4.html" title="Sample border"></iframe>
</html>
!!Specify alternate colors for the table rows
Use the ''.odd'' and/or ''.even'' classes to specify different styles for the table rows
!!!Stylesheet
The same as before + ...
//{{{
.dbdatatable tr.odd th, .dbdatatable tr.odd td {
background-color: #fff;
}
//}}}
!!!Result
<html>
<iframe style="background-color:#ffffff; border-color:#ffffff; border:none;" width="1000" height="380" frameborder="0" scrolling="yes" src="_outputto/output5.html" title="Sample border"></iframe>
</html>
!!Specify a row appearance change when mouse hovers it
!!!Stylesheet
The same as before + ...
//{{{
.dbdatatable tr:hover td {
background-color: #632a2a;
color: #fff;
}
.dbdatatable tr:hover a {
background-color: #632a2a;
color: #fff;
}
//}}}
!!!Result
<html>
<iframe style="background-color:#ffffff; border-color:#ffffff; border:none;" width="1000" height="380" frameborder="0" scrolling="yes" src="_outputto/output6.html" title="Sample border"></iframe>
</html>
!!Specify cells depending on their content or type
Use the ''.char'', ''.numeric'', ''.bool'', ''.date'', ''.negative'' and ''.null'' classes.
!!!Stylesheet
Same as before + ...
//{{{
.dbdatatable td.numeric {
text-align: right;
}
.dbdatatable td.negative {
color: red;
}
.dbdatatable td.null {
background-color: red;
}
//}}}
!!!Result
<html>
<iframe style="background-color:#ffffff; border-color:#ffffff; border:none;" width="1000" height="380" frameborder="0" scrolling="yes" src="_outputto/output7.html" title="Sample border"></iframe>
</html>
!!Emphasize first and last row borders
Use the ''.firstrow'', ''.lastrow'', .''firstcol'' and/or ''.lastcol'' classes to mark their borders specifically
!!!Stylesheet
All Together
//{{{
body {
font-size: 100%;
}
.dbdatatable {
padding: 0;
margin: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #bcd0e4;
}
.dbdatatable caption {
caption-side: bottom;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}
.dbdatatable th, .dbdatatable td {
border: 1px dotted #666;
padding: 0.5em;
text-align: left;
color: #632a39;
vertical-align: middle;
}
.dbdatatable th {
color: #fff;
background-color: #8fadcc;
text-transform: uppercase;
background-color: #7d98b3;
border-right: 1px dotted #666;
text-align: center;
}
.dbdatatable tr.odd th, .dbdatatable tr.odd td {
background-color: #fff;
}
.dbdatatable tr:hover td {
background-color: #632a2a;
color: #fff;
}
.dbdatatable tr:hover a {
background-color: #632a2a;
color: #fff;
}
.dbdatatable td.numeric {
text-align: right;
}
.dbdatatable td.negative {
color: red;
}
.dbdatatable td.null {
background-color: red;
}
.dbdatatable tr.firstrow {
border-top: 3px solid #444;
}
.dbdatatable tr.lastrow {
border-bottom: 3px solid #444;
}
//}}}
!!!Result
<html>
<iframe style="background-color:#ffffff; border-color:#ffffff; border:none;" width="1000" height="390" frameborder="0" scrolling="yes" src="_outputto/output8.html" title="Sample border"></iframe>
</html></pre>
</div>
<div title="Page" modifier="Jean-PierreLedure" created="201303301748" modified="201306151424" tags="Properties">
<pre>A dialog may have several pages that can be traversed by the user step by step. The //Page// property of the [[Dialog object|Dialog]] defines which page of the dialog is active. At runtime the next page of a dialog is displayed by increasing the page value by 1.
The //Page// property of a control defines the page of the dialog on which the control is visible. For example, if a control has a page value of 1, it is only visible on page 1 of the dialog. If the page value of the dialog is increased from 1 to 2, then all controls with a page value of 1 disappear and all controls with a page value of 2 become visible.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a Dialog |!Description |
|[[Dialog]] |>|>| NA |The page to be displayed |
|[[Control]] | None | None | All |The page to which the control belongs |
!!!Syntax
//dialog//{{{.Page}}}
//dialog//{{{.Page}}} = //value//
//control//{{{.Page}}}
//control//{{{.Page}}} = //value//
!!!Returned values / Arguments
{{{Long}}}
!!!Remarks
The page value 0 has a special role. If a control has a page value of 0, the control is displayed on all dialog pages. If a dialog has a page value of 0, all controls of the dialog are displayed, regardless of the page value of the individual controls.
!!!Error messages
|Property 'Page' not applicable in this context |
|Value '...' is invalid for property 'Page' |</pre>
</div>
<div title="PageTemplate" modifier="Jean-PierreLedure" created="201106250821" modified="201212311225" tags="excludeLists">
<pre><!--{{{-->
<div class='header'>
<div class='titleLine'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div macro='gradient vert #ffffff #cc9900'><a> </a><div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
</div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}--></pre>
</div>
<div title="Parent" modifier="Jean-Pierre Ledure" created="201212221430" modified="201507121403" tags="Properties" changecount="1">
<pre>The //Parent// property returns the parent object of a [[Control]] or of a [[SubForm]].
!!!Applies to ...
| !Object |!Description |
|[[SubForm]] |A subform of an open form. |
|[[Control]] |A control of an open form. |
|[[CommandBarControl]] |An element of a commandbar. |
!!!Syntax
//subform//{{{.Parent}}}
//control//{{{.Parent}}}
//commandbarcontrol//{{{.Parent}}}
!!!Returned values
{{{Object}}}
!!!Remarks
*The Parent property is read-only.
*The parent can be itself an object of type [[Control]], [[SubForm]], [[Form]], [[Dialog]] or [[CommandBar]].
!!!Error messages
!!!Example
<<tiddler "Parent example">></pre>
</div>
<div title="Parent example" modifier="Jean-PierreLedure" created="201212221507" modified="201212221508" tags="[[Snippets of Code]]">
<pre>Browse objects tree upwards
//{{{
Dim oSomeObject As Object
Set oSomeObject = getObject("Forms!Invoice!SubForm.Form!SubForm_Grid![SeqNr Invoice]")
While Not IsNull(oSomeObject)
Print oSomeObject.Name,
Set oSomeObject = oSomeObject.Parent
Wend
//}}}</pre>
</div>
<div title="Picture" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201603280952" modified="201603281013" tags="Properties" changecount="8">
<pre>The //Picture// property specifies a bitmap or other type of graphic to be displayed on the specified control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when in a Dialog |!Description |
|[[Control]] | ~CommandButton<br />~ImageButton<br />~ImageControl | None | ~CommandButton<br />~ImageControl |A control on an open form or a dialog of one of the listed types. |
!!!Syntax
//control//{{{.Picture}}}
//control//{{{.Picture}}} = //value//
!!!Returned value / Argument
{{{String}}}
!!!Remarks
*The control MUST NOT be bound to a database field.
*The {{{value}}} argument may be provided either in the (recommended) URL format (i.e. "{{{file:// ...}}}") or by using the operating system usual syntax (e.g. "{{{C:\...}}}" in Windows).<br />However the argument is always returned in the URL format.
!!!Error messages
|Property 'Picture' not applicable in this context |
|Value '...' is invalid for property 'Caption' |
!!!Example
<<tiddler "Picture example">></pre>
</div>
<div title="Picture example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201603281007" modified="201603281010" tags="[[Snippets of Code]]" changecount="2">
<pre>Modify the picture displayed in an ~ImageControl control.
//{{{
Dim ofForm As Object, ocControl As Object
Set ofForm = Forms("myForm") ' Form must be open
Set ocControl = ofForm.Controls("MyImage")
ocControl.Picture = "C:\MyPicture.jpg"
//}}}</pre>
</div>
<div title="ProcBodyLine" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181550" modified="201612181628" tags="Properties" changecount="8">
<pre>The //~ProcBodyLine// property returns the number of the line at which the body of a specified procedure begins in a standard or a class [[module|Module]].
!!!Applies to ...
| !Object |!Description |
|[[Module]] |The representation of a Basic script. |
!!!Syntax
//module//{{{.ProcBodyLine(}}}//~ProcName, ~ProcKind//{{{)}}}
!!!Returned values / Arguments
| !Argument | !Type | !Optional | !Description | !Returned type |
|module | Object ||The concerned module. | Long |
|~ProcName | String | N |The name of a procedure in the module. |~|
|~ProcKind | Integer | N |The type of procedure. It can be one of the following constants:<br />vbext_pk_Get<br />vbext_pk_Let<br />vbext_pk_Proc<br />vbext_pk_Set |~|
!!!Remarks
*Lines in a module are numbered beginning with 1.
*The body of a procedure begins with the procedure definition, denoted by one of the following:
**A {{{Sub}}} statement.
**A {{{Function}}} statement.
**A {{{Property Get}}} statement.
**A {{{Property Let}}} statement.
**A {{{Property Set}}} statement.
*The //~ProcBodyLine// property returns a number that identifies the line on which the procedure definition begins. In contrast, the [[ProcStartLine]] property returns a number that identifies the line at which a procedure is separated from the preceding procedure in a module. Any comments that precede the procedure definition (the body of a procedure) are considered part of the procedure, but the //~ProcBodyLine// property ignores them.
*The //~ProcStartLine// and //~ProcBodyLine// properties can have the same value, if the procedure definition is the first line of the procedure. If the procedure definition isn't the first line of the procedure, the //~ProcBodyLine// property will have a greater value than the //~ProcStartLine// property.
*If useful, insert the following constants in your own code:
//{{{
Const vbext_pk_Get = 1 ' A Property Get procedure
Const vbext_pk_Let = 2 ' A Property Let procedure
Const vbext_pk_Proc = 0 ' A Sub or Function procedure
Const vbext_pk_Set = 3 ' A Property Set procedure
//}}}
!!!Error messages
|Property '~ProcBodyLine' not applicable in this context |
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[ProcCountLines]]
[[ProcOfLine]]
[[ProcStartLine]]
!!!Example
<<tiddler "Module example">></pre>
</div>
<div title="ProcCountLines" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181600" modified="201612181627" tags="Properties" changecount="5">
<pre>The //~ProcCountLines// property eturns the number of lines in a specified procedure in a standard or a class [[module|Module]].
!!!Applies to ...
| !Object |!Description |
|[[Module]] |The representation of a Basic script. |
!!!Syntax
//module//{{{.ProcCountLines(}}}//~ProcName, ~ProcKind//{{{)}}}
!!!Returned values / Arguments
| !Argument | !Type | !Optional | !Description | !Returned type |
|module | Object ||The concerned module. | Long |
|~ProcName | String | N |The name of a procedure in the module. |~|
|~ProcKind | Integer | N |The type of procedure. It can be one of the following constants:<br />vbext_pk_Get<br />vbext_pk_Let<br />vbext_pk_Proc<br />vbext_pk_Set |~|
!!!Remarks
*A procedure begins with any comments that immediately precede the procedure definition, denoted by one of the following:
**A {{{Sub}}} statement.
**A {{{Function}}} statement.
**A {{{Property Get}}} statement.
**A {{{Property Let}}} statement.
**A {{{Property Set}}} statement.
*The //~ProcCountLines// property returns the number of lines in a procedure, beginning with the line returned by the [[ProcStartLine]] property and ending with the line that ends the procedure. The procedure may be ended with {{{End Sub}}}, {{{End Function}}}, or {{{End Property}}}.
*If useful, insert the following constants in your own code:
//{{{
Const vbext_pk_Get = 1 ' A Property Get procedure
Const vbext_pk_Let = 2 ' A Property Let procedure
Const vbext_pk_Proc = 0 ' A Sub or Function procedure
Const vbext_pk_Set = 3 ' A Property Set procedure
//}}}
!!!Error messages
|Property '~ProcCountLines' not applicable in this context |
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[ProcBodyLine]]
[[ProcOfLine]]
[[ProcStartLine]]
!!!Example
<<tiddler "Module example">></pre>
</div>
<div title="ProcOfLine" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181612" modified="201612181626" tags="Properties" changecount="4">
<pre>The //~ProcOfLine// property returns the name of the procedure that contains a specified line in a standard or a class [[module|Module]].
!!!Applies to ...
| !Object |!Description |
|[[Module]] |The representation of a Basic script. |
!!!Syntax
//module//{{{.ProcOfLine(}}}//Line, ~ProcKind//{{{)}}}
!!!Returned values / Arguments
| !Argument | !Type | !Optional | !Description | !Returned type |
|module | Object ||The concerned module. | String |
|Line | Long | N |The number of a line in the module. |~|
|~ProcKind | Integer | N |The type of procedure. After execution it will contain one of the following constants:<br />vbext_pk_Get<br />vbext_pk_Let<br />vbext_pk_Proc<br />vbext_pk_Set |~|
!!!Remarks
*Lines in a module are numbered beginning with 1.
*For any given line number, the //~ProcOfLine// property returns the name of the procedure that contains that line. Since comments immediately preceding a procedure definition are considered part of that procedure, the //~ProcOfLine// property may return the name of a procedure for a line that isn't within the body of the procedure. The [[ProcStartLine]] property indicates the line on which a procedure begins; the [[ProcBodyLine]] property indicates the line on which the procedure definition begins (the body of the procedure).
*Note that the //~ProcKind// argument indicates whether the line belongs to a {{{Sub}}} or {{{Function}}} procedure, a {{{Property Get}}} procedure, a {{{Property Let}}} procedure, or a {{{Property Set}}} procedure. To determine what type of procedure a line is in, pass a variable of type {{{Integer}}} to the ProcOfLine property, then check the value of that variable.
*If useful, insert the following constants in your own code:
//{{{
Const vbext_pk_Get = 1 ' A Property Get procedure
Const vbext_pk_Let = 2 ' A Property Let procedure
Const vbext_pk_Proc = 0 ' A Sub or Function procedure
Const vbext_pk_Set = 3 ' A Property Set procedure
//}}}
!!!Error messages
|Property '~ProcOfLine' not applicable in this context |
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[ProcBodyLine]]
[[ProcCountLines]]
[[ProcStartLine]]
!!!Example
<<tiddler "Module example">> in a standard or a class [[module|Module]].
</pre>
</div>
<div title="ProcStartLine" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201612181443" modified="201612181628" tags="Properties" changecount="10">
<pre>The //~ProcStartLine// property returns a value identifying the line at which a specified procedure begins in a standard or a class [[module|Module]].
!!!Applies to ...
| !Object |!Description |
|[[Module]] |The representation of a Basic script. |
!!!Syntax
//module//{{{.ProcStartLine(}}}//~ProcName, ~ProcKind//{{{)}}}
!!!Returned values / Arguments
| !Argument | !Type | !Optional | !Description | !Returned type |
|module | Object ||The concerned module. | Long |
|~ProcName | String | N |The name of a procedure in the module. |~|
|~ProcKind | Integer | N |The type of procedure. It can be one of the following constants:<br />vbext_pk_Get<br />vbext_pk_Let<br />vbext_pk_Proc<br />vbext_pk_Set |~|
!!!Remarks
*Lines in a module are numbered beginning with 1.
*A procedure begins with any comments that immediately precede the procedure definition, denoted by one of the following:
**A {{{Sub}}} statement.
**A {{{Function}}} statement.
**A {{{Property Get}}} statement.
**A {{{Property Let}}} statement.
**A {{{Property Set}}} statement.
*The //~ProcStartLine// property returns the number of the line on which the specified procedure begins. The beginning of the procedure may include comments that precede the procedure definition.<br />To determine the line on which the procedure definition begins, use the [[ProcBodyLine]] property. This property returns the number of the line that begins with a {{{Sub}}}, {{{Function}}}, {{{Property Get}}}, {{{Property Let}}}, or {{{Property Set}}} statement.
*The //~ProcStartLine// and //~ProcBodyLine// properties can have the same value, if the procedure definition is the first line of the procedure. If the procedure definition isn't the first line of the procedure, the //~ProcBodyLine// property will have a greater value than the //~ProcStartLine// property.
*If useful, insert the following constants in your own code:
//{{{
Const vbext_pk_Get = 1 ' A Property Get procedure
Const vbext_pk_Let = 2 ' A Property Let procedure
Const vbext_pk_Proc = 0 ' A Sub or Function procedure
Const vbext_pk_Set = 3 ' A Property Set procedure
//}}}
!!!Error messages
|Property '~ProcStartLine' not applicable in this context |
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[ProcBodyLine]]
[[ProcCountLines]]
[[ProcOfLine]]
!!!Example
<<tiddler "Module example">></pre>
</div>
<div title="ProductCode" modifier="Jean-Pierre Ledure" created="201312261112" modified="201405291527" tags="Properties" changecount="3">
<pre>The //~ProductCode// property returns "~Access2Base x.y.z" where x.y.z equals the version number of the library.
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]ProductCode}}}
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
!!!Error messages
!!!See also
[[CurrentUser]]
[[Version]]
!!!Example
<<tiddler "Identification example">></pre>
</div>
<div title="ProductsTable" modifier="Jean-PierreLedure" created="201212211624" modified="201212241135" tags="HowTo">
<pre>*Products table
| !Fields | !Field Type | !Primary |
|~CategoryID | ~BigInt ||
|~ProductName | Text ||
|~QuantityPerUnit | Text ||
|~ReorderLevel | Integer ||
|~SupplierID | ~BigInt ||
|~UnitPrice | Number ||
|~UnitsInStock | Integer ||
|~UnitsOnOrder | Integer ||
|Discontinued | Boolean ||
|~ProductID | ~BigInt | Y |
|Picture | Image ||</pre>
</div>
<div title="Properties" modifier="Jean-PierreLedure" created="201306151415" tags="Menu">
<pre></pre>
</div>
<div title="Properties (collection)" modifier="Jean-Pierre Ledure" created="201107021457" modified="201405241129" tags="Collections" changecount="1">
<pre>The //Properties// collection describes instances of all __properties__ of an [[object|Object Model]]
!!!Syntax
//object//.{{{Properties()}}}
//object//.{{{Properties(index)}}} or //object//.{{{Properties(propertyname)}}}
| !Argument | !Type |!Returned value |
|| absent |A [[Collection]] of the properties of the object |
| index | integer<br />long |A [[property|Property]] object |
| propertyname | string |~|
!!!Remarks
*Property [[collections|Collection]] are numbered from 0 to //object//.{{{Properties(...).Count - 1}}}
*The //propertyname// argument is not case sensitive.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection Properties() |
!!!See also
[[Property]]
[[hasProperty]]
[[getProperty]]
[[setProperty]]
!!!Examples
<<tiddler "Properties example">>
</pre>
</div>
<div title="Properties example" modifier="Jean-Pierre Ledure" created="201107021639" modified="201611261226" tags="[[Snippets of Code]]" changecount="1">
<pre>To list the value of each property of a form ...
//{{{
Dim ofForm As Object, i As Integer, iCount As Integer, oProperty As Object
Set ofForm = Forms("myForm")
iCount = ofForm.Properties.Count
For i = 0 To iCount - 1
Set oProperty = ofForm.Properties.Item(i)
Print oProperty.Name & "=" & oProperty).Value
Next i
Print
//}}}</pre>
</div>
<div title="Property" modifier="Jean-Pierre Ledure" created="201110010743" modified="201405251537" tags="Objects" changecount="3">
<pre>The {{{Property}}} [[object|Object Model]] describes a ~Name-Value pair of any property of any other object.
!!!Functions returning a property object
| !Parent object | !Function | !Type |!Description |
| Any |[[Properties|Properties (collection)]] | [[Collection]] |//object//.{{{Properties(}}}//property-name//{{{)}}} returns a //Property// object. |
!!!Properties of the returned object
| !Property | !Type | !Description |
|[[Name]] | String ||
|[[ObjectType]] | String |Returns "PROPERTY" |
|[[Value]] | Variant |The value of the considered property (might be an array). |
!!!Syntax
//property//{{{.Name}}}
//property//{{{.Value}}}
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the Property object has the given property. |
!!!Remarks
*All properties of a //Property// object are read-only.
!!!See also
[[Properties|Properties (collection)]]
[[hasProperty]]
[[getProperty]]
[[setProperty]]
!!!Example
<<tiddler "Properties example">></pre>
</div>
<div title="QueryDef" modifier="Jean-Pierre Ledure" created="201306141626" modified="201405251547" tags="Objects" changecount="5">
<pre>{{firstletter{
@@color:#930;A@@
}}}//~QueryDef// [[object|Object Model]] describes one of the Queries located in a database document (".odb" file).
!!!Function returning a //~QueryDef// object
| !Parent object | !Function | !Type | !Argument |!Description |
|[[Database]] |[[QueryDefs]] | [[Collection]] | Integer or String |{{{Application.CurrentDb().QueryDefs("myQuery")}}} returns an object corresponding with the {{{myQuery}}} query |
!!!Properties
| !Property | !Type | !Read only | !Description or UNO object |
|[[Name]] || Y |Specifies the exact name of the query |
|[[ObjectType]] || Y |Returns "QUERYDEF" |
|[[SQL]] |||Specifies the SQL statement related to the query |
|[[Type]] || Y |Classifies the query |
|Query | UNO | Y |com.sun.star.sdb.dbaccess.~OQuery |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[Execute|Execute (query)]] | options | Boolean |Execute an action query. |
|[[Fields]] | None<br />Index<br />Name | [[Collection]] |Return the collection of the fields belonging to the query. |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the //~QueryDef// has the given property. |
|[[OpenRecordset]] | options | [[Recordset]] |Return a recordset object allowing access to the query data. |
|[[setProperty]] | property<br />value | Boolean |Return True if the given property could be set. |
!!!Remarks
!!!See also
[[TableDef]]
!!!Examples
<<tiddler "Datadef example">></pre>
</div>
<div title="QueryDefs" modifier="Jean-Pierre Ledure" created="201306081259" modified="201405241129" tags="Collections" changecount="1">
<pre>The //~QueryDefs// collection describes instances of all __queries__ present in the current database.
!!!Syntax
{{{database.QueryDefs()}}}
{{{database.QueryDefs(index)}}}
{{{database.QueryDefs(queryname)}}}
| !Object | !Type | !Argument | !Type |!Returned value |
|database |[[Database object|Database]] | absent ||A [[Collection]] object |
|~|~| index | integer<br>long |A [[QueryDef]] object corresponding to the index-th item in the ~QueryDefs() collection. The 1st query is ~QueryDefs(0), the 2nd is ~QueryDefs(1) and so on ... The last one is ~QueryDefs.Count - 1.|
|~|~| queryname | string |A [[QueryDef]] object having the argument as name. The argument is NOT case-sensitive.|
!!!Methods
| !Method | !Description |
|[[Delete|Delete (table-query)]]|Delete an existing //~QueryDef//. |
!!!Remarks
The //queryname// argument is not case sensitive.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection ~QueryDefs() |
|Query '...' not found |
!!!See also ...
[[CreateQueryDef]]
[[TableDefs]]
[[Recordsets]]
!!!Example
<<tiddler "Datadef example">>
</pre>
</div>
<div title="Quit" modifier="Jean-Pierre Ledure" created="201112311418" modified="201409271455" tags="Actions" changecount="4">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //Quit// action quits //~OpenOffice/~LibreOffice Base//. You can select one of several options for saving the database document before quitting.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]Quit(}}}//{{{Option}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{Option}}} | Yes | acQuitPrompt, acQuitSaveAll, acQuitSaveNone |//acQuitPrompt// Displays a dialog box that asks whether you want really to quit or not.<br />//acQuitSaveAll// (default) Saves all objects without displaying a dialog box.<br />//acQuitSaveNone// Quits without saving any objects. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acQuitPrompt = 0
Const acQuitSaveAll = 1
Const acQuitSaveNone = 2
//}}}
!!!Remarks
*The Quit action has the same effect as clicking Exit on the File menu in the //~OpenOffice/~LibreOffice Base// window.
*In //~MSAccess// the //Quit// method is linked to the [[Application]] object.
*The //Quit// action must not be triggered from a [[standalone form|Standalone Forms]].
!!!Error messages
|Action not applicable in this context |
!!!See also
!!!Example
Display next message box: ''Do you really want to quit the application ? Changed data will be saved.''
If Yes pressed, the application will close.
//{{{
DoCmd.Quit(acQuitPrompt)
//}}}
</pre>
</div>
<div title="RadioButton" modifier="Jean-Pierre Ledure" created="201112271447" modified="201405300636" tags="[[Special controls]]" changecount="4">
<pre>{{firstletter{
@@color:#930;A@@
}}} //~RadioButton// [[control|Control]] enables the user to choose among one of several options.
Radio buttons are grouped in the sense that selecting one deselects all the others.
>In [[forms|Form]] and [[subforms|SubForm]] all //~RadioButtons// in a group share the same name (Name property).
>In [[dialogs|Dialog]] the //~RadioButtons// constituting a group have contiguous [[TabIndex]] properties.
Usually, //~RadioButtons// are grouped in a group box. In //AOO/~LibO// group boxes play only a graphical role.
!!!Specific properties of radio buttons
| !Property | !Read only | !Description |
|[[Name]] | Y |Specifies the exact name of the [[OptionGroup]]. |
|[[OptionValue]] | Y |Specifies the value that is stored in the database when the radio button is selected and the record saved. |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the ~RadioButton has the given property. |
|[[Requery]] ||~|True if data reloaded in the ~RadioButton |
|[[SetFocus]] | none |~|Return True if focus set on Control successfully. |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
!!!Remarks
The ~RadioButton control has no //Value// property.
To identify the selected radio button, use the [[OptionGroup method|OptionGroup (Method)]] and the [[Value]] property of the returned [[OptionGroup]] object.
!!!See also
[[OptionGroup (Method)]]
[[OptionGroup]]
[[TabIndex]]
!!!Example
<<tiddler "Optiongroup example">></pre>
</div>
<div title="ReadAllBytes" modifier="Jean-Pierre Ledure" created="201308041222" modified="201405241314" tags="Methods" changecount="2">
<pre>The //~ReadAllBytes// method imports the content of a file specified by its full name into a binary [[Field]] belonging to a [[Recordset]].
!!!Applies to ...
| !Object | !Type of field |
|[[Field]] |com.sun.star.sdbc.~DataType.BINARY<br />com.sun.star.sdbc.~DataType.VARBINARY<br />com.sun.star.sdbc.~DataType.LONGVARBINARY |
!!!Syntax
//field//{{{.ReadAllBytes(}}}//file//{{{)}}}
!!!Arguments
| !Argument | !Type | !Description |
| file | String |The full name, including the path, of the file you want to import the data from. |
!!!Remarks
*The //~ReadAllBytes// method must be preceeded by a [[AddNew]] or [[Edit]] method and followed by an [[Update]] method, both applied to the concerned //Recordset//.
*The {{{file}}} argument may be expressed either in the (recommended) URL format (i.e. "{{{file:// ...}}}") or by using the operating system usual syntax (e.g. "{{{C:\...}}}" in Windows).
!!!Error messages
|Method '~ReadAllBytes' not applicable in this context |
|File access error on file '...' |
|Recordset or field is not updatable |
|Recordset update sequence error |
!!!See also
[[ReadAllText]]
[[Value|Value (field)]]
[[WriteAllBytes]]
[[WriteAllText]]
!!!Example
<<tiddler "ReadAllBytes example">></pre>
</div>
<div title="ReadAllBytes example" modifier="Jean-PierreLedure" created="201308041302" modified="201308041303" tags="[[Snippets of Code]]">
<pre>Save the image stored in a file into a new record
//{{{
Dim oRecordset As Object, sFile As String
sFile = "C:\..."
Set oRecordset = Application.CurrentDb().OpenRecordset("Products")
With oRecordset
.AddNew ' All fields are initialized with their default value
.Fields("IMAGE").ReadAllBytes(sFile)
' ... Other fields can be set by setting their Value property
.Update
End With
oRecordset.mClose()
//}}}</pre>
</div>
<div title="ReadAllText" modifier="Jean-PierreLedure" created="201308041304" modified="201308041307" tags="Methods">
<pre>The //~ReadAllText// method imports the content of a file specified by its full name into a memo [[Field]] belonging to a [[Recordset]].
!!!Applies to ...
| !Object | !Type of field |
|[[Field]] |com.sun.star.sdbc.DataType.LONGVARCHAR |
!!!Syntax
//field//{{{.ReadAllText(}}}//file//{{{)}}}
!!!Arguments
| !Argument | !Type | !Description |
| file | String |The full name, including the path, of the file you want to import the data from. |
!!!Remarks
*The //~ReadAllText// method must be preceeded by a [[AddNew]] or [[Edit]] method and followed by an [[Update]] method, both applied to the concerned //Recordset//.
*The {{{file}}} argument may be expressed either in the (recommended) URL format (i.e. "{{{file:// ...}}}") or by using the operating system usual syntax (e.g. "{{{C:\...}}}" in Windows).
*The text file must NOT BE LONGER than 64K.
!!!Error messages
|Method '~ReadAllText' not applicable in this context |
|File access error on file '...' |
|Recordset or field is not updatable |
|Recordset update sequence error |
!!!See also
[[ReadAllBytes]]
[[Value|Value (field)]]
[[WriteAllBytes]]
[[WriteAllText]]
!!!Example
<<tiddler "ReadAllText example">></pre>
</div>
<div title="ReadAllText example" modifier="Jean-PierreLedure" created="201308041313" tags="[[Snippets of Code]]">
<pre>Save the image stored in a file into a new record
//{{{
Dim oRecordset As Object, sFile As String
sFile = "C:\..."
Set oRecordset = Application.CurrentDb().OpenRecordset("Products")
With oRecordset
.AddNew ' All fields are initialized with their default value
.Fields("MEMOFIELD").ReadAllText(sFile)
' ... Other fields can be set by setting their Value property
.Update
End With
oRecordset.mClose()
//}}}</pre>
</div>
<div title="RecordCount" modifier="Jean-PierreLedure" created="201306231523" modified="201306231544" tags="Properties">
<pre>You can use the //~RecordCount// property to specify the number of records accessed in a [[Recordset]] object.
!!!Applies to ...
| !Object |!Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement |
!!!Syntax
//recordset//{{{.RecordCount}}}
!!!Returned values
{{{Long}}}
!!!Remarks
*The //~RecordCount// property is read-only.
*Use the //~RecordCount// property to find out how many records in a //Recordset// object have been accessed. The //~RecordCount// property doesn't indicate how many records are contained in a //Recordset// object until all records have been accessed. Once the last record has been accessed, the //~RecordCount// property indicates the total number of undeleted records in the //Recordset// object. To force the last record to be accessed, use the [[MoveLast|Move (recordset)]] method on the //Recordset// object. You can also use an SQL Count function to determine the approximate number of records your query will return.
*Note: using the //~MoveLast// method to populate a newly opened //Recordset// negatively impacts performance. Unless it is necessary to have an accurate //~RecordCount// as soon as you open a //Recordset//, it's better to wait until you populate the //Recordset// with other portions of code before checking the //~RecordCount// property.
!!!Error messages
!!!See also
[[MoveLast|Move (recordset)]]
[[Recordset|Recordset (property)]]
!!!Example
<<tiddler "Filter2 example">></pre>
</div>
<div title="RecordSource" modifier="Jean-PierreLedure" created="201107181337" modified="201306151430" tags="Properties">
<pre>You can use the //~RecordSource// property to specify the source of the data displayed in a form.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
|[[SubForm]] |The subform of an open form |
!!!Syntax
//form//{{{.RecordSource}}}
//form//{{{.RecordSource}}} = //value//
//subform//{{{.RecordSource}}}
//subform//{{{.RecordSource}}} = //value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
The //~RecordSource// property is a string expression consisting of either
*a table name
*a query name
*a SQL statement including the SELECT verb
However to modify the ~RecordSource property, use __only a SQL statement__. When the ~RecordSource property value is changed, the //form// or //subform// is reloaded automatically.
After modification of the //~RecordSource// any preexisting filter on the form is reset.
!!!Error messages
|Form '...' is currently not open |
|Value '...' is invalid for property '~RecordSource' |
!!!See also
[[ControlSource]]
[[Requery]]
!!!Example
<<tiddler "RecordSource example">></pre>
</div>
<div title="RecordSource example" modifier="Jean-PierreLedure" created="201107181410" modified="201212141527" tags="[[Snippets of Code]]">
<pre>Set new data source on open form
//{{{
Dim ofForm As Object, sSQL As String
ofForm = Forms("myForm")
sSQL = "SELECT * FROM [EMPLOYEE] WHERE " _
& "[EMPLOYEE].[NAME] LIKE '*MICKEY*' Or [EMPLOYEE].[NAME] LIKE '*WINNIE*'"
ofForm.RecordSource = sSQL
//}}}</pre>
</div>
<div title="Recordset" modifier="Jean-Pierre Ledure" created="201306221335" modified="201407121454" tags="Objects" changecount="11">
<pre>{{firstletter{
@@color:#930;A@@
}}} //Recordset// object represents the records in a base table or the records that result from running a query. A cursor technique allows to walk through the records of the recordset.
!!!Functions returning a recordset object
| !Parent object | !Method | !Type |
|[[Database]] |[[Recordsets]] | [[Collection]] |
|[[Database]] |[[OpenRecordset]] ||
|[[TableDef]] |~|~|
|[[QueryDef]] |~|~|
|//Recordset// |[[OpenRecordset]] |~|
|~|[[Clone]] |~|
|[[Form]] |[[Recordset|Recordset (property)]] |~|
|[[SubForm]] |~|~|
!!!Properties
| !Property | !Type | !Read only |!Description or UNO object |
|[[AbsolutePosition]] |||Sets or returns the relative record number of a //Recordset//. |
|[[BOF|BOF, EOF]] || Y |Specifies if the recordset cursor is placed before the first record. |
|[[Bookmark]] |||Sets or returns a bookmark that uniquely identifies the current record in a //Recordset// object. |
|[[Bookmarkable]] || Y |Returns a value that indicates whether a //Recordset// object supports bookmarks. |
|[[EditMode]] || Y |Indicates the state of editing for the current record. |
|[[EOF|BOF, EOF]] || Y |Specifies if the recordset cursor is placed after the last record. |
|[[Filter]] |||Specifies a selection to be set on the current recordset before opening with [[OpenRecordset]] a new derived recordset. |
|[[Name]] || Y |Specifies the name assigned by ~Access2Base to the recordset. |
|[[ObjectType]] || Y |Returns "RECORDSET". |
|[[RecordCount]] || Y |Returns the number of records of the recordset. |
|~RowSet | UNO | Y |com.sun.star.comp.dba.~ORowSet |
!!!Methods
| !Method | !Description |
|[[AddNew]] |Initiate the creation of a new record. |
|[[CancelUpdate]] |Cancel on-going updates. |
|[[Clone]] |Create a duplicate //Recordset// object that refers to the current one. |
|[[Close|Close (method)]] |Close the //Recordset// object. The object is not usable anymore. |
|[[Delete]] |Delete the current record. |
|[[Edit]] |Initiate the update of fields in the current record. |
|[[Fields]] |Access the collection of fields of the recordset. |
|[[getProperty]] |Return the value of the given property. |
|[[GetRows]] |Retrieve multiple rows at once. |
|[[hasProperty]] |Return True if the Recordset has the given property. |
|[[Move|Move (recordset)]]|Walk through the recordset. |
|[[MoveFirst|Move (recordset)]] |~|
|[[MoveLast|Move (recordset)]] |~|
|[[MoveNext|Move (recordset)]] |~|
|[[MovePrevious|Move (recordset)]] |~|
|[[OpenRecordset]] |derive a new //Recordset// object from the current one. |
|[[setProperty]] |Return True if the given property could be set. |
|[[Update]] |Confirm on-going updates. |
!!!Remarks
*A new //Recordset// object is automatically added to the [[Recordsets]] collection when you open the object, and is automatically removed when you close it.
*You can create as many //Recordset// object variables as needed. Different //Recordset// objects can access the same tables, queries, and fields without conflicting.
*When you create a //Recordset// object, the current record is positioned to the first record if there are any records. If there are no records, the [[RecordCount]] property setting is 0, and the [[BOF|BOF, EOF]] and [[EOF|BOF, EOF]] property settings are {{{True}}}.
*Information about the structure of a base table, such as the names and data types of each [[Field]] object, is contained in a [[TableDef]] object.
!!!Example
<<tiddler "OpenRecordset example">></pre>
</div>
<div title="Recordset (property)" modifier="Jean-Pierre Ledure" created="201306231553" modified="201405291634" tags="Properties" changecount="1">
<pre>Returns a [[Recordset]] object representing the record source for the specified form or subform.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form. |
|[[SubForm]] |A subform in an open form. |
!!!Syntax
//form//{{{.Recordset}}}
//subform//{{{.Recordset}}}
!!!Returned values
[[Recordset object|Recordset]]
!!!Remarks
*The //Recordset// property is read-only.
*The //Recordset// property returns the recordset object that provides the data being browsed in a form. However walking thru the form or walking thru the recordset will remain independent from each other.
!!!Error messages
|Property 'Recordset' not applicable in this context |
!!!See also
[[OpenRecordset]]
[[Recordset]]
!!!Example</pre>
</div>
<div title="Recordsets" modifier="Jean-Pierre Ledure" created="201306221336" modified="201405241130" tags="Collections" changecount="2">
<pre>The //Recordsets// collection describes instances of all __recordsets__ that are currently open in relation with a given [[database object|Database]].
!!!Syntax
{{{database.Recordsets()}}}
{{{database.Recordsets(index)}}}
{{{database.Recordsets(recordsetname)}}}
| !Object | !Type | !Argument | !Type |!Returned value |
|database |[[Database object|Database]] | absent ||A [[Collection]] object |
|~|~| index | integer<br>long |A [[Recordset]] object corresponding to the index-th item in the ~Recordsets() collection. The 1st recordset is Recordsets(0), the 2nd is Recordsets(1) and so on ... The last one is Recordsets.Count - 1.|
|~|~| recordsetname | string |A [[Recordset]] object having the argument as name. The argument is NOT case-sensitive.|
!!!Remarks
*The //recordsetname// argument is not case sensitive.
*The name of a recordset is not chosen by the user or the programmer. It is defined as a unique name by ~Access2Base. As a consequence the use of the syntax based on the recordsetname requires the name to be kept somewhere to allow the retrieval of the recordset object. See the example.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection Recordsets() |
|Recordset '...' not found |
!!!See also ...
[[QueryDefs]]
[[TableDefs]]
!!!Example
<<tiddler "Recordsets example">></pre>
</div>
<div title="Recordsets example" modifier="Jean-PierreLedure" created="201306221354" modified="201306221356" tags="[[Snippets of Code]]">
<pre>A recordset is created somewhere
//{{{
Global sRSName As String
'---------------------------------------
Dim oRecordset As Object
Set oRecordset = Application.CurrentDb().OpenRecordset("SELECT * FROM [PRODUCTS]")
sRSName = oRecordset.Name
//}}}
... then, elsewhere, for instance in an event ... next construction is valid:
//{{{
Dim oRecordset As Object
Set oRecordset = Application.CurrentDb().Recordsets(sRSName)
'...
//}}}
</pre>
</div>
<div title="Refresh" modifier="Jean-Pierre Ledure" created="201111191343" modified="201405241315" tags="Methods" changecount="1">
<pre>The //Refresh// method immediately updates the records in the underlying record source for a specified form to reflect changes made to the data by you or other users in a multiuser environment.
!!!Applies to ...
| !Object | !Description |
|[[Form]] |The representation of an open database form. |
|[[SubForm]] |A subset of the [[Controls|Control]] present in a Form. |
!!!Syntax
//form.//{{{Refresh}}}
//subform.//{{{Refresh}}}
!!!Remarks
!!!Error messages
!!!See also
[[RecordSource]]
[[Requery]]
!!!Example
<<tiddler "Refresh example">></pre>
</div>
<div title="Refresh example" modifier="Jean-Pierre Ledure" created="201111191435" modified="201405241316" tags="[[Snippets of Code]]" changecount="1">
<pre>Refresh the data in the current record of a form
//{{{
Dim ofForm As Object
Set ofForm = Application.Forms("myForm")
ofForm.Refresh
//}}}</pre>
</div>
<div title="ReleaseNotes" modifier="YourName" created="201203171447" modified="201902151438" tags="NoTag" changecount="69">
<pre>| !Release | !Date | !Description | !Embedded in ... |
| 6.2.0 | 02/2019 |Support of hierarchical form names.<br />Support of (embedded) Firebird 3.0 database system. | ~LibreOffice 6.2 |
| 1.9.0 | 07/2018 |Base forms may contain more than 1 root form, all belonging to a forms collection, each of them having its own data source (NB: ~MSAccess does not have that feature). It is now supported by ~Access2Base<br />A translation in german is provided (thanks to Gisbert Friege). | ~LibreOffice 6.1 |
| 1.8.0 | 01/2018 |Database document and dialog events can be dynamically got and updated with the new [[On database events|On (database event)]] and [[On dialog events|On (dialog event)]]. | ~LibreOffice 6.0 |
| 1.7.0 | 07/2017 |Form, subform and control events can be dynamically got and updated with the new [[On form events|On (form event)]] and [[On control events|On (control event)]] properties.<br />The new [[module|Module]] object class and its properties and methods makes it easy to navigate through the Basic libraries attached to the current file or application. | ~LibreOffice 5.4 |
| 1.6.0 | 01/2017 |The [[CopyObject]] action may copy tables (structure and data) from one database to another. As an experimental feature involved tables may even reside in different database systems.<br />The //database// class has received new properties: [[Name]], [[Connect]] and [[Version]].<br />Additionally, a spanish translation is provided (thanks to Iñigo Zuluaga). | ~LibreOffice 5.3 |
| 1.5.0 | 08/2016 |More flexible management of (long) binary fields in databases with the addition of the [[GetChunk]] and [[AppendChunk]] methods to the [[field object|Field]].<br />Addition of the [[Picture]] property for //~ImageControl// controls. | ~LibreOffice 5.2 |
| 1.4.0 | 01/2016 |The [[OutputTo]] action has been significantly enhanced. Output in one single Basic statement the content of a table or of a SELECT query into<br />- an html file. The data table can be embedded in a template file. Examples of table styling to make the output more attractive are available in this [[tutorial|OutputToStyling]];<br />- a Calc spreadsheet<br />- a text/csv file<br />The [[OpenQuery]] action is now applicable to action queries. | ~LibreOffice 5.1 |
| 1.3.0 | 07/2015 |New [[CommandBars]] collection of [[CommandBar]] objects:<br />Easily show/hide menu bar, status bar, toolbars and toolbar elements. | ~LibreOffice 5.0 |
| 1.2.0 | 01/2015 |All the methods which can meaningfully be used without a database connection (error handling, dialogs manipulations, status bar and window handling, commands launch, ...) have been reviewed and documented as acceptable before any //~OpenConnection// call.<br />A [[CloseConnection]] method has been added to allow freeing resources.<br />To pass values from one open document to another, use the [[TempVars]] collection of [[TempVar]] objects.<br />New properties for forms and subforms: [[OrderBy]] and [[OrderByOn]].<br />Additionally the new [[ApplyFilter]] and [[SetOrderBy]] actions are applicable on table or query datasheets, and on forms or subforms as well. Also the [[GoToRecord]] action has been extended to table and query datasheets.<br />Bug fixes and internal redesigns. | ~LibreOffice 4.4 |
| 1.1.0 | 07/2014 |The ~Access2Base library can be run to access a database defined in any form defined in any AOO/~LibO document. Now the [[CurrentDb]] method may be associated with a form object, not only with the root class.<br />The [[OpenDatabase]] method allows any AOO/~LibO document or any Basic macro to get access to tables stored in any database.<br />The [[CopyObject]] (new) action copies query definitions and/or table d0000000efinitions and data.<br />Creation of table and fields without SQL with the [[CreateTableDef]], [[CreateField]] and [[Add]] methods.<br />The new [[GetRows]] method loads a given number of records from a recordset in a Basic array.<br />[[RunSQL]], [[OpenSQL]], database functions have been extended to be run from a database object, not only as a command.<br />New [[GetHiddenAttribute]] and [[SetHiddenAttribute]] actions hide or show any //AOO/~LibO// document or //Base// object. [[SelectObject]] scope has been extended accordingly.<br />The [[Description]] property of a //~TableDef// is writable.<br />Addition of the [[SelStart]], [[SelLength]] and [[SelText]] properties for text controls. | ~LibreOffice 4.3 |
| 1.0.0 | 12/2013 |Inclusion of ~Access2Base code into the ~LibreOffice 4.2 build.<br />Code stabilisation, robustness improvements (naming collisions risks, error handler, ...)<br />Toggle sidebar in [[RunCommand]]<br/>Support of ~LibreOffice 4.2 new internal format for Time fields (compatibility with ~OpenOffice and older versions of ~LibreOffice is ensured). | ~LibreOffice 4.2 |
| 0.9.5 | 08/2013 |Framework for database access:<br />[[TableDefs]], [[QueryDefs]], [[Recordsets]] and [[Fields]] collections.<br />[[TableDef]], [[QueryDef]], [[Recordset]] and [[Field]] objects.<br />Addition of the [[CurrentRecord]] and [[Recordset|Recordset (property)]] properties for //forms// and //subforms//.<br />Introspection improved with the [[Item]] property for //Collections//.<br />[[RunSQL]] and [[OpenSQL]] support //pass-through// mode of operation. ||
| 0.9.1 | 04/2013 |Bug fixing.<br />Performance improvement when processing very large (1000+ items) listboxes.<br />Workaround implemented to survive the ~LibreOffice 4.0 bug described in [[BugZilla|https://www.libreoffice.org/bugzilla/show_bug.cgi?id=60752]].<br />Finalization of the [[Application]] object.<br />Implementation of the [[SysCmd]] method for the management of the status bars.<br />Redocumentation of the [[object model|Object Model]].<br />Addition of the [[Dialog]] object. <br />The [[Format]] property may be set programmatically for date and time controls.<br />Addition of the [[OpenSQL]] action. ||
| 0.9.0 | 01/2013 |Complete internal redesign of code to allow more object-oriented syntaxes for property settings and method invocations.<br />E.g.<br />{{{form.height = 100}}}<br />{{{form.move(100,200)}}}<br />Old syntax still supported.<br />Consolidation of the object model with the [[Parent]], [[Source|Event]] and [[ObjectType]] properties.<br />Addition of a [[Close|Close (method)]] method to the //Form// object.<br />Several bugs corrections. ||
| 0.8.9 | 10/2012 |Localization:<br />- of the 2 dialog forms<br />- of all strings (mainly error messages) used in the API<br />A french translation is provided.<br />For other languages, contributions are welcome. See [[Contact]]. ||
| 0.8.6 | 09/2012 |Maintenance release. ||
| 0.8.5 | 08/2012 |Introduction of new commands:<br />[[OutputTo]] for storing a form document as a PDF, DOC, ... file.<br />[[SendObject]] to send a form after transformation to PDF, DOC, ... by mail.<br />[[RunApp]] to start an external application. ||
| 0.8.2 | 08/2012 |API implementation identical to 0.8.1<br />"Check for Updates ..." functionality of AAO/~LibO now detects ~Access2Base new versions. ||
| 0.8.1 | 08/2012 |Maintenance release (bug in setValue method). ||
| 0.8.0 | 07/2012 |Full support of [[standalone (Writer) forms|Standalone Forms]].<br />[[RadioButtons|RadioButton]] order is now determined by their ~X-Y coordinates on the screen.<br />Bug fixing in [[checkboxes controls|Control]] when linked to a database field.<br /> Support of "Currency" datatype in arguments to the API. Useful for controls of currency type. Converted to Double in internal processing. ||
| 0.7.5 | 05/2012 |Support of [[Listboxes|ListBox]] with a separate column for bound fields.<br />Introduction of the [[Bookmark]] property of [[Form]] pseudo-objects.<br />New actions: [[ShowAllRecords]] and [[GoToControl]].<br />New methods for managing Listboxes content (with the //~ValueList// rowsource type): [[AddItem]] and [[RemoveItem]].<br />The [[RunSQL]] command accepts square brackets to surround field or table names. ||
| 0.7.1 | 04/2012 |Correction of URL of online help. Clickable from Help menu in the Basic IDE. ||
| 0.7.0 | 04/2012 |Bugs fixing in the [[SelectObject]] action (abort when help file open).<br />Extension of the scope of the [[SelectObject]] action.<br />Introduction of the [[RunCommand]] action. Documentation updated. ||
| 0.6.0 | 04/2012 |New actions [[SelectObject]], [[Minimize]], [[Maximize]] and [[MoveSize]]<br />"~Access2Base Help" menu command in IDE opens Online help on [[www.access2base.com|http://www.access2base.com]]. ||
| 0.5.1 | 03/2012 |"Out of array range" error message added for collections (i.o. "Invalid parameter"). ||
| 0.5.0 | 03/2012 |First public release. ||</pre>
</div>
<div title="Remove" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201409271313" modified="201409271320" tags="Methods" changecount="4">
<pre>Erases a [[tempvar|TempVar]] object from the [[TempVars]] collection.
!!!Applies to ...
| !Object | !Description |
|[[TempVars]] |The set of temporary variables. |
!!!Syntax
//application.~TempVars()//{{{.Remove(}}}//tempvarname//{{{)}}}
| !Argument | !Type |!Returned value |
|tempvarname | String |True if success.|
!!!Remarks
*The //tempvarname// argument is NOT case-sensitive.
*By default, a //~TempVar// object remains in memory until ~LibO/AOO is closed. You can use the //Remove// method to remove a //~TempVar// object.
!!!Error Messages
|Temporary variable '...' not found |
|Method 'Collection.Remove' not applicable in this context |
!!!See also
[[Add]]
[[RemoveAll]]
[[TempVar]]
[[TempVars]]
!!!Example
<<tiddler "Tempvar example">></pre>
</div>
<div title="RemoveAll" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201409271322" modified="201409271325" tags="Methods" changecount="5">
<pre>Erases all [[tempvar|TempVar]] objects from the [[TempVars]] collection.
!!!Applies to ...
| !Object | !Description |
|[[TempVars]] |The set of temporary variables. |
!!!Syntax
[Application.]{{{TempVars().RemoveAll()}}}
!!!Remarks
By default, a //~TempVar// object remains in memory until ~LibO/AOO is closed. You can use the //~RemoveAll// method to remove all //~TempVar// objects at once.
!!!Error Messages
|Method 'Collection.~RemoveAll' not applicable in this context |
!!!See also
[[Add]]
[[Remove]]
[[TempVar]]
[[TempVars]]
!!!Example
<<tiddler "Tempvar example">></pre>
</div>
<div title="RemoveItem" modifier="Jean-Pierre Ledure" created="201205251145" modified="201405241130" tags="Methods" changecount="1">
<pre>The //~RemoveItem// method removes an item from the list of values displayed by the specified list box control.
!!!Applies to ...
| !Object | !Type when<br />in a form or a dialog | !Type when<br />in a ~GridControl |!Description |
|[[Control]] | [[ListBox]] | [[ListBox]] |A listbox on an open form, a dialog or in a [[GridControl]]|
!!!Syntax
//control//{{{.RemoveItem(}}}//index//{{{)}}}
| !Argument | !Type | !Description |
| index | Integer<br />Long |The position in the list of the item to remove. |
|~| String |The value of the item to remove. The comparison with the actual values in the list is case-sensitive. |
!!!Remarks
*The [[RowSourceType]] property (invalid in dialogs) of the concerned //~ListBox// must contain the value {{{com.sun.star.form.ListSourceType.VALUELIST}}}.
*Combo boxes do not support this value. That's why //~RemoveItem// is applicable only on listboxes.
*List item numbers start from zero. If the value of the {{{index}}} argument doesn't correspond to an existing item number, an error occurs.
*//~RemoveItem// returns True if success, False otherwise. False is returned if {{{index}}} is a string and the string has not been found in the listbox.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Method not applicable in this context |
!!!See also
[[ListBox]]
[[AddItem]]
[[RowSource]]
[[RowSourceType]]
!!!Example
<<tiddler "Addremoveitem example">></pre>
</div>
<div title="Requery" modifier="Jean-Pierre Ledure" created="201111111525" modified="201407261214" tags="Methods" changecount="2">
<pre>The //Requery// method updates the data underlying a specified control that's on the active form by requerying the source of data for the control.
If the target is a [[Form]] and the source is a //Parameter Query// the parameters are re-asked to the user.
!!!Applies to ...
| !Object | !Description |
|[[Form]] |The representation of an //~OpenOffice/~LibreOffice// database form. |
|[[SubForm]] |A subset of the [[Controls|Control]] present in a Form. |
|[[ComboBox]] |A combobox control. |
|[[ListBox]] |A listbox control. |
!!!Syntax
//form.//{{{Requery}}}
//subform.//{{{Requery}}}
//control.//{{{Requery}}}
!!!Remarks
If the targeted object is a Form or a ~SubForm the //Requery// method resets the current record to the first available in the record set.
!!!Error messages
!!!See also
[[Filter]]
[[FilterOn]]
[[RecordSource]]
[[Refresh]]
[[RowSource]]
!!!Example
<<tiddler "Requery example">></pre>
</div>
<div title="Requery example" modifier="Jean-PierreLedure" created="201111111542" modified="201212141545" tags="[[Snippets of Code]]">
<pre>Reload the content of a combo box after a database change
//{{{
Dim ofForm As Object, ocCombo As Object
Set ofForm = Forms("myForm")
Set ocCombo = ofForm.Controls("myComboBox")
ocCombo.Requery
//}}}</pre>
</div>
<div title="Required" modifier="Jean-PierreLedure" created="201109021358" modified="201306151425" tags="Properties">
<pre>The //Required// property specifies whether a control must contain a value when the record is edited.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |~CheckBox<br />[[ComboBox]]<br />~CurrencyField<br />~DateField<br />~FormattedField<br />~ImageControl<br />[[ListBox]]<br />~NumericField<br />~PatternField<br />[[RadioButton]]<br />~TextField<br />~TimeField | All except<br />--~CheckBox-- | None |A control on an open form or a [[GridControl]] |
!!!Syntax
//control//{{{.Required}}}
//control//{{{.Required}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
The //Required// property is not applicable to //controls// located in a [[Dialog]].
!!!Error messages
|Property 'Required' not applicable in this context |
|Value '...' is invalid for property 'Required' |
!!!Example
<<tiddler "Required example">></pre>
</div>
<div title="Required example" modifier="Jean-PierreLedure" created="201109021414" modified="201212151127" tags="[[Snippets of Code]]">
<pre>Force value in field to avoid error on Null value when saving record (e.g. in When Loading form event)
{{{
Dim ocControl As Object
Set ocControl = Controls("myForm", "myFormattedField")
ocControl.Required = True
}}}</pre>
</div>
<div title="Reset" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201503081707" modified="201503081711" tags="Methods" changecount="2">
<pre>Resetting a built-in ||command bar|CommandBar]] restores the actions originally intended for the command bar and resets each of the command bar control's properties back to their original state.
!!!Applies to ...
| !Object | !Description |
|[[CommandBar]] |The representation of a tool-, menu- or statusbar. |
!!!Syntax
//commandbar//{{{.Reset()}}}
!!!Returned value
{{{True}}} if success.
!!!Remarks
!!!Error Messages
!!!See also
[[CommandBar]]
[[CommandBarControl]]
!!!Example
<<tiddler "CommandBar example">></pre>
</div>
<div title="RowSource" modifier="Jean-Pierre Ledure" created="201108181337" modified="201405291606" tags="Properties" changecount="4">
<pre>You can use the //~RowSource// property (along with the [[RowSourceType]] property) to tell ~OpenOffice/~LibreOffice Base how to provide data to a list box or to a combo box.
!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] | [[ComboBox]]<br />[[ListBox]] | [[ComboBox]]<br />[[ListBox]] | [[ComboBox]]<br />[[ListBox]] |A combo- or listbox on an open form, a dialog or in a [[GridControl]]|
!!!Syntax
//control//{{{.RowSource}}}
//control//{{{.RowSource}}} = //value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
*The //value// argument must contain, depending on the value of the [[RowSourceType]] property, either
| !~RowSourceType |!Argument of ~RowSource |
|com.sun.star.form.~ListSourceType.TABLE |the exact name of a table |
|com.sun.star.form.~ListSourceType.QUERY |the exact name of a query |
|com.sun.star.form.~ListSourceType.SQL |a correct SQL SELECT statement |
|com.sun.star.form.~ListSourceType.SQLPASSTHROUGH |~|
|com.sun.star.form.~ListSourceType.TABLEFIELDS |a list of values separated by a semicolon (";") bundled in one single string |
|com.sun.star.form.~ListSourceType.VALUELIST |~|
*When the //~RowSource// property is changed the content of the combo- or listbox is refreshed.
!!!Error messages
|Property '~RowSource' not applicable in this context |
|Value '...' is invalid for property '~RowSource' |
!!!See also
[[ItemData]]
[[ListCount]]
[[ListIndex]]
[[MultiSelect]]
[[Requery]]
[[RowSourceType]]
[[Selected]]
!!!Example
<<tiddler "RowSource example">></pre>
</div>
<div title="RowSource example" modifier="Jean-PierreLedure" created="201108181514" modified="201212141410" tags="[[Snippets of Code]]">
<pre>Modify the content of a combo and a listbox
Select first item in the combobox
Select all tems in the listbox
//{{{
Dim ocCombo As Object, ocList As Object
Set ocCombo = getObject("Forms!myForm!myComboBox")
ocCombo.RowSourceType = com.sun.star.form.ListSourceType.SQL
ocCombo.RowSource = "SELECT [SHORTNAME] FROM COMPANIES WHERE [SHORTNAME]<>'' ORDER BY [SHORTNAME]"
ocCombo.ListIndex = 0
Set ocList = getObject("Forms!myForm!myListBox")
ocList.RowSourceType = com.sun.star.form.ListSourceType.VALUELIST
ocList.RowSource = "First;Second;Third"
ocList.Selected = Array(True, True, True)
//}}}</pre>
</div>
<div title="RowSourceType" modifier="Jean-Pierre Ledure" created="201108181519" modified="201405291609" tags="Properties" changecount="2">
<pre>You can use the //~RowSourceType// property (along with the [[RowSource]] property) to tell ~OpenOffice/~LibreOffice Base how to provide data to a list box or to a combo box.
!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl |!Description |
|[[Control]] | [[ComboBox]]<br />[[ListBox]] | [[ComboBox]]<br />[[ListBox]] |A combo- or listbox on an open form or in a [[GridControl]]|
!!!Syntax
//control//{{{.RowSourceType}}}
//control//{{{.RowSourceType}}} = //value//
!!!Returned values / Arguments
{{{Integer}}}
!!!Remarks
*The //value// argument must contain, depending on the value of the [[RowSource]] property, one of next symbolic values:
|com.sun.star.form.~ListSourceType.VALUELIST |
|com.sun.star.form.~ListSourceType.TABLE |
|com.sun.star.form.~ListSourceType.QUERY |
|com.sun.star.form.~ListSourceType.SQL |
|com.sun.star.form.~ListSourceType.SQLPASSTHROUGH |
|com.sun.star.form.~ListSourceType.TABLEFIELDS |
See the [[OpenOffice documentation|http://api.openoffice.org/docs/common/ref/com/sun/star/form/component/DatabaseListBox.html#ListSourceType]] for more details.
*A //~ComboBox// control does not support the value {{{com.sun.star.form.ListSourceType.VALUELIST}}} for the //~RowSourceType// property.
*When the //~RowSourceType// property is changed the content of the combo- or listbox is ''NOT'' refreshed.
*The //~RowSourceType// property is not applicable to //list-// or //comboboxes// located in a [[Dialog]].
!!!Error messages
|Property '~RowSourceType' not applicable in this context |
|Value '...' is invalid for property '~RowSourceType' |
!!!See also
[[ItemData]]
[[ListCount]]
[[ListIndex]]
[[MultiSelect]]
[[Requery]]
[[RowSource]]
[[Selected]]
!!!Example
<<tiddler "RowSource example">></pre>
</div>
<div title="RunApp" modifier="Jean-Pierre Ledure" created="201208310849" modified="201409271455" tags="Actions" changecount="1">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~RunApp// action runs an external application given by its command line. The command line may be an executable file or a user file associated via its suffix with an executable application.<br />Use caution when running executable files or code in macros or applications. Executable files or code can be used to carry out actions that might compromise the security of your computer and data.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{Call [DoCmd.]RunApp(}}}//{{{CommandLine}}}//{{{)}}}
| !Argument | !Optional | !Type |!Description | !Returned value |
|{{{CommandLine}}} | No | String |The command line used to start the application<br />(including the path and any other necessary parameters, such as switches that run the application in a particular mode). | No return. {{{RunApp}}} is a Sub. |
!!!Remarks
*The application selected with this action loads and runs in the foreground. The macro containing this action continues to run after starting the application.
*The {{{CommandLine}}} argument may be expressed either in the (recommended) URL format (i.e. "{{{file:// ...}}}") or by using the operating system usual syntax (e.g. "{{{C:\...}}}" in Windows).
*Note that Basic provides an equivalent standard function {{{Shell}}}. It provides even more options. //~RunApp// is proposed here to improve compatibility with Visual Basic.
!!!Error messages
None
!!!See also
[[OutputTo]]
!!!Example
<<tiddler "RunApp example">> </pre>
</div>
<div title="RunApp example" modifier="Jean-PierreLedure" created="201208310915" modified="201212151128" tags="[[Snippets of Code]]">
<pre>To open a PDF file
//{{{
RunApp("C:\Users\MyName\Documents\Doc\Basic\OOBasic FormsAndDialogs.pdf") ' Valid only in Windows
//}}}</pre>
</div>
<div title="RunCommand" modifier="Jean-Pierre Ledure" created="201204151204" modified="201501021114" tags="Actions" changecount="5">
<pre>The absence of Macro Recorder in ~LibO/AOO Base and the lack of documentation makes the use of the numerous commands available in the software very difficult. The current help page tries to compensate partially this handicap.
The //~RunCommand// action executes the command given as argument.
Combined with the [[SelectObject]] action it enhances significantly the automation capabilities of applications using the //~Access2Base// API.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]RunCommand(}}}//{{{Command}}}//{{{)}}}
| !Argument | !Optional | !Type |!Description | !Returned Value |
| Command | No | String<br />Integer, Long |If numeric the Command is selected by using the VBA denomination. If the Type is a String, the ~LibO/AOO command-name is expected | Always returns True |
!!!Commands List
| !~LibO/AOO Command | !VBA Equivalent | !Context(s) |!Short description |
|"About" |acCmdAboutMicrosoftAccess | Any |About ~OpenOffice.org/~LibreOffice |
|~|acCmdAboutOpenOffice | Any |About ~OpenOffice.org/~LibreOffice |
|~|acCmdAboutLibreOffice | Any |About ~OpenOffice.org/~LibreOffice |
|"~ActiveHelp" || Any |Extended Tips |
|"~AddDirect" || Any |New |
|"~AddField" || acForm (Design mode) |Add Field |
|"~AutoControlFocus" || acForm (Design mode) |Automatic Control Focus |
|"~AutoFilter" || acTable |~AutoFilter |
|"~AutoPilotAddressDataSource" || Any |~AutoPilot: Address Data Source |
|"~BasicBreak" || Any |Interrupt Macro |
|"~BasicIDEAppear" |acCmdVisualBasicEditor | Any |Edit Macros |
|"~BasicStop" || acBasicIDE |Stop Macro |
|"~BringToFront" |acCmdBringToFront | Any |Bring to Front |
|"~CheckBox" || acForm (Design mode) |Check Box |
|"~ChooseMacro" || acBasicIDE |Select Macro |
|"~CloseDoc" |acCmdClose | Any |Close |
|"~CloseWin" || Any |Close Window |
|"~ConfigureDialog" |acCmdToolbarsCustomize | Any |Customize |
|"~ControlProperties" || Controls |Control |
|"~ConvertToButton" |acCmdChangeToCommandButton | Controls |Replace with Button |
|"~ConvertToCheckBox" |acCmdChangeToCheckBox | Controls |Replace with Check Box |
|"~ConvertToCombo" |acCmdChangeToComboBox | Controls |Replace with Combo Box |
|"~ConvertToCurrency" || Controls |Replace with Currency Field |
|"~ConvertToDate" || Controls |Replace with Date Field |
|"~ConvertToEdit" |acCmdChangeToTextBox | Controls |Replace with Text Box |
|"~ConvertToFileControl" || Controls |Replace with File Selection |
|"~ConvertToFixed" |acCmdChangeToLabel | Controls |Replace with Label Field |
|"~ConvertToFormatted" || Controls |Replace with Formatted Field |
|"~ConvertToGroup" || Controls |Replace with Group Box |
|"~ConvertToImageBtn" || Controls |Replace with Image Button |
|"~ConvertToImageControl" |acCmdChangeToImage | Controls |Replace with Image Control |
|"~ConvertToList" |acCmdChangeToListBox | Controls |Replace with List Box |
|"~ConvertToNavigationBar" || Controls |Replace with Navigation Bar |
|"~ConvertToNumeric" || Controls |Replace with Numerical Field |
|"~ConvertToPattern" || Controls |Replace with Pattern Field |
|"~ConvertToRadio" |acCmdChangeToOptionButton | Controls |Replace with Radio Button |
|"~ConvertToScrollBar" || Controls |Replace with Scrollbar |
|"~ConvertToSpinButton" || Controls |Replace with Spin Button |
|"~ConvertToTime" || Controls |Replace with Time Field |
|"Copy" |acCmdCopy | Any |Copy |
|"~CurrencyField" || acForm (Design mode) |Currency Field |
|"Cut" |acCmdCut | Any |Cut |
|"~DateField" || acForm (Design mode) |Date Field |
|"~DBAddRelation" |acCmdCreateRelationship | acDiagram |New Relation ... |
|"~DBConvertToView" || acDatabaseWindow (Queries) |Create as View |
|"~DBDelete" |acCmdDelete | acDatabaseWindow |Delete |
|"~DBDirectSQL" || acDatabaseWindow |SQL ... |
|"~DBDSAdvancedSettings" || acDatabaseWindow |Advanced Settings ... |
|"~DBDSConnectionType" || acDatabaseWindow |Connection Type ... |
|"~DBDSProperties" |acCmdDatabaseProperties | acDatabaseWindow |Properties ... |
|"~DBEdit" || acDatabaseWindow |Edit ... |
|"~DBEditSqlView" |acCmdSQLView | acDatabaseWindow (Queries) |Edit in SQL View ... |
|"~DBFormDelete" |acCmdRemove | acDatabaseWindow (Forms) |Delete |
|"~DBFormEdit" |acCmdDesignView | acDatabaseWindow (Forms) |Edit ... |
|"~DBFormOpen" |acCmdFormView | acDatabaseWindow (Forms) |Open Database Object ... |
|"~DBFormRename" || acDatabaseWindow (Forms) |Rename ... |
|"~DBNewForm" |acCmdNewObjectForm | acDatabaseWindow (Forms) |Form ... |
|"~DBNewFormAutoPilot" || acDatabaseWindow (Forms) |Form Wizard ... |
|"~DBNewQuery" || acDatabaseWindow (Queries) |Query (Design View) ... |
|"~DBNewQueryAutoPilot" || acDatabaseWindow (Queries) |Query Wizard ... |
|"~DBNewQuerySql" || acDatabaseWindow (Queries) |Query (SQL View) ... |
|"~DBNewReport" || acDatabaseWindow (Reports) |Report ... |
|"~DBNewReportAutoPilot" || acDatabaseWindow (Reports) |Report Wizard ... |
|"~DBNewTable" |acCmdNewObjectTable | acDatabaseWindow (Tables) |Table Design ... |
|"~DBNewTableAutoPilot" || acDatabaseWindow (Tables) |Table Wizard ... |
|"~DBNewView" |acCmdNewObjectView | acDatabaseWindow (Tables) |View Design ... |
|"~DBNewViewSQL" || acDatabaseWindow (Tables) |View (Simple) ... |
|"~DBOpen" |acCmdOpenDatabase | acDatabaseWindow |Open Database Object ... |
|"~DBQueryDelete" |acCmdRemove | acDatabaseWindow (Queries) |Delete |
|"~DBQueryEdit" |acCmdDesignView | acDatabaseWindow (Queries) |Edit ... |
|"~DBQueryOpen" |acCmdNewObjectQuery | acDatabaseWindow (Queries) |Open Database Object ... |
|"~DBQueryRename" || acDatabaseWindow (Queries) |Rename ... |
|"~DBRefreshTables" || acDatabaseWindow |Refresh Tables |
|"~DBRelationDesign" |acCmdShowAllRelationships | acDatabaseWindow |Relationships ... |
|"~DBRename" || acDatabaseWindow |Rename ... |
|"~DBReportDelete" |acCmdRemove | acDatabaseWindow (Reports) |Delete |
|"~DBReportEdit" |acCmdDesignView | acDatabaseWindow (Reports) |Edit ... |
|"~DBReportOpen" |acCmdNewObjectReport | acDatabaseWindow (Reports) |Open Database Object ... |
|"~DBReportRename" || acDatabaseWindow (Reports) |Rename ... |
|"~DBSelectAll" |acCmdSelectAll | acDatabaseWindow |Select All |
|"~DBShowDocInfoPreview" || acDatabaseWindow |Document Information |
|"~DBShowDocPreview" || acDatabaseWindow |Document |
|"~DBTableDelete" |acCmdRemoveTable | acDatabaseWindow (Tables) |Delete |
|"~DBTableEdit" |acCmdDesignView | acDatabaseWindow (Tables) |Edit ... |
|"~DBTableFilter" || acDatabaseWindow (Tables) |Table Filter ... |
|"~DBTableOpen" |acCmdOpenTable | acDatabaseWindow (Tables) |Open Database Object ... |
|"~DBTableRename" |acCmdRename | acDatabaseWindow (Tables) |Rename ... |
|"~DBUserAdmin" || acDatabaseWindow |User Administration ... |
|"~DBViewForms" || acDatabaseWindow |Forms |
|"~DBViewQueries" || acDatabaseWindow |Queries |
|"~DBViewReports" || acDatabaseWindow |Reports |
|"~DBViewTables" || acDatabaseWindow |Tables |
|"Delete" |acCmdDelete | Any |Delete Contents |
|"~DeleteRecord" |acCmdDeleteRecord | acForm |Delete Record |
|"~DesignerDialog" || acForm (Design mode) |Styles and Formatting |
|"Edit" || acForm (Design mode) |Text Box |
|"~FirstRecord" || acForm |First Record |
|"~FontDialog" || acForm (Design mode) |Character |
|"~FontHeight" || acForm (Design mode) |Font Size |
|"~FormattedField" || acForm (Design mode) |Formatted Field |
|"~FormFilter" || acForm |~Form-Based Filters |
|"~FormFiltered" |acCmdApplyFilterSort | acForm |Apply Filter |
|"~FormFilterExecute" || acForm |Apply ~Form-Based Filter |
|"~FormFilterExit" || acForm |Close |
|"~FormFilterNavigator" || acForm |Filter Navigation |
|"~FormProperties" || acForm (Design mode) |Form |
|"~FullScreen" || acForm |Full Screen |
|"Gallery" || acForm |Gallery |
|"Grid" || acForm (Design mode) |Table Control |
|"~GridUse" |acCmdSnapToGrid | acForm (Design mode) |Snap to Grid |
|"~GridVisible" |acCmdViewGrid | acForm (Design mode) |Display Grid |
|"~GroupBox" || acForm (Design mode) |Group Box |
|"~HelpIndex" || Any |~OpenOffice.org Help |
|"~HelpSupport" || Any |Support |
|"~HyperlinkDialog" |acCmdInsertHyperlink | acForm (Design mode) |Hyperlink |
|"Imagebutton" || acForm (Design mode) |Image Button |
|"~ImageControl" || acForm (Design mode) |Image Control |
|"Label" || acForm (Design mode) |Label Field |
|"~LastRecord" |acCmdMaximumRecords | acForm |Last Record |
|"~ListBox" || acForm (Design mode) |List Box |
|"~MacroDialog" || Any |~OpenOffice.org Basic |
|"~MacroOrganizer" || Any |~OpenOffice.org Basic Macro Organizer |
|"~MoreControls" || acForm (Design mode) |More Controls |
|"~NavigationBar" || acForm (Design mode) |Navigation Bar |
|"Navigator" |acCmdObjectBrowser | acForm (Design mode) |Navigator |
|"~NewDoc" || Any |New Document From Template |
|"~NewRecord" || acForm |New Record |
|"~NextRecord" || acForm |Next Record |
|"~NumericField" || acForm (Design mode) |Numerical Field |
|"Open" || Any |Open |
|"~OptionsTreeDialog" || Any |Options |
|"Organizer" || Any |Organize |
|"~ParagraphDialog" || acForm (Design mode) |Paragraph |
|"Paste" |acCmdPaste | Any |Paste |
|"~PasteSpecial" |acCmdPasteSpecial | acForm (Design mode) |Paste Special ... |
|"~PatternField" || acForm (Design mode) |Pattern Field |
|"~PrevRecord" || acForm |Previous Record |
|"Print" |acCmdPrint | acForm, acReport (normal and design modes) |Print |
|"~PrintDefault" || acForm, acReport (normal and design modes) |Print File Directly |
|"~PrinterSetup" || acForm, acReport (normal and design modes) |Printer Settings |
|"~PrintPreview" |acCmdPrintPreview | acForm, acReport (normal and design modes) |Page Preview |
|"Pushbutton" || acForm (Design mode) |Push Button |
|"Quit" || acDatabaseWindow |Exit |
|"~RadioButton" || acForm (Design mode) |Option Button |
|"~RecSave" |acCmdSaveRecord | acForm |Save Record |
|"~RecSearch" |acCmdFind | acForm |Find Record |
|"~RecUndo" |acCmdUndo | acForm |Undo: Data entry |
|"Refresh" |acCmdRefresh | acForm, acTable, acQuery |Refresh |
|"Reload" || Any |Reload |
|"~RemoveFilterSort" |acCmdRemoveFilterSort | acForm |Remove Filter/Sort |
|"~RunMacro" |acCmdRunMacro | Any |Run Macro |
|"Save" |acCmdSave | Any |Save |
|"~SaveAll" || Any |Save All |
|"~SaveAs" |acCmdSaveAs | Any |Save As |
|"~SaveBasicAs" || acBasicIDE |Save BASIC |
|"~ScriptOrganizer" || Any |Organize Macros |
|"~ScrollBar" || acForm (Design mode) |Scrollbar |
|"~SearchDialog" |acCmdFind | acForm |Find & Replace |
|"~SelectAll" |acCmdSelectAll | Any |Select All |
|~|acCmdSelectAllRecords | Any |Select All |
|"~SendToBack" |acCmdSendToBack | Any |Send to Back |
|"~ShowFmExplorer" || acForm (Design mode) |Form Navigator |
|"Sidebar" || acForm |Toggle sidebar |
|"~SortDown" |acCmdSortDescending | acForm, acTable, acQuery |Sort Descending |
|"Sortup" |acCmdSortAscending | acForm, acTable, acQuery |Sort Ascending |
|"~SpinButton" || acForm (Design mode) |Spin Button |
|"~StatusBarVisible" || Any |Status Bar |
|"~SwitchControlDesignMode" || acForm (Design mode) |Design Mode On/Off |
|"~TabDialog" |acCmdTabOrder | acForm (Design mode) |Activation Order |
|"~UseWizards" || acForm (Design mode) |Wizards On/Off |
|"~VersionDialog" || acForm (Design mode) |Versions |
|"~ViewDataSourceBrowser" || acForm |Data Sources |
|"~ViewFormAsGrid" |acCmdDatasheetView | acForm |Data source as Table |
|"Zoom" |acCmdZoomSelection | |Zoom |
The (VBA) symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acDiagram = 8
Const acForm = 2
Const acQuery = 1
Const acReport = 3
Const acTable = 0
Const acBasicIDE = 101
Const acDatabaseWindow = 102
//}}}
and, or ...
//{{{
Const acCmdAboutMicrosoftAccess = 35
Const acCmdAboutOpenOffice = 35
Const acCmdAboutLibreOffice = 35
Const acCmdVisualBasicEditor = 525
Const acCmdBringToFront = 52
Const acCmdClose = 58
Const acCmdToolbarsCustomize = 165
Const acCmdChangeToCommandButton = 501
Const acCmdChangeToCheckBox = 231
Const acCmdChangeToComboBox = 230
Const acCmdChangeToTextBox = 227
Const acCmdChangeToLabel = 228
Const acCmdChangeToImage = 234
Const acCmdChangeToListBox = 229
Const acCmdChangeToOptionButton = 233
Const acCmdCopy = 190
Const acCmdCut = 189
Const acCmdCreateRelationship = 150
Const acCmdDelete = 337
Const acCmdDatabaseProperties = 256
Const acCmdSQLView = 184
Const acCmdRemove = 366
Const acCmdDesignView = 183
Const acCmdFormView = 281
Const acCmdNewObjectForm = 136
Const acCmdNewObjectTable = 134
Const acCmdNewObjectView = 350
Const acCmdOpenDatabase = 25
Const acCmdRemove = 366
Const acCmdDesignView = 183
Const acCmdNewObjectQuery = 135
Const acCmdShowAllRelationships = 149
Const acCmdRemove = 366
Const acCmdDesignView = 183
Const acCmdNewObjectReport = 137
Const acCmdSelectAll = 333
Const acCmdRemoveTable = 84
Const acCmdDesignView = 183
Const acCmdOpenTable = 221
Const acCmdRename = 143
Const acCmdDelete = 337
Const acCmdDeleteRecord = 223
Const acCmdApplyFilterSort = 93
Const acCmdSnapToGrid = 62
Const acCmdViewGrid = 63
Const acCmdInsertHyperlink = 259
Const acCmdMaximumRecords = 508
Const acCmdObjectBrowser = 200
Const acCmdPaste = 191
Const acCmdPasteSpecial = 64
Const acCmdPrint = 340
Const acCmdPrintPreview = 54
Const acCmdSaveRecord = 97
Const acCmdFind = 30
Const acCmdUndo = 292
Const acCmdRefresh = 18
Const acCmdRemoveFilterSort = 144
Const acCmdRunMacro = 31
Const acCmdSave = 20
Const acCmdSaveAs = 21
Const acCmdFind = 30
Const acCmdSelectAll = 333
Const acCmdSelectAllRecords = 109
Const acCmdSendToBack = 53
Const acCmdSortDescending = 164
Const acCmdSortAscending = 163
Const acCmdTabOrder = 41
Const acCmdDatasheetView = 282
Const acCmdZoomSelection = 371
//}}}
!!!Remarks
*//~RunCommand// always returns {{{True}}}. If the argument does not exist, or if the request is not appropriate to the context, the request is ignored.
*The Command argument, when of type {{{String}}}, is not case-sensitive.
*Above list of commands is not exhaustive. Other commands could succeed as well. However if the command to execute is not in the above list the argument MUST correspond exactly (... be properly cased as should ...) with the argument expected by a {{{executeDispatch()}}} UNO statement.
*If the given Command argument is of type {{{String}}} and starts with "{{{.uno:}}}", the command is executed literally without any other parsing.
*The ~LibO/AOO command and its VBA equivalent are //presumed// to be similar or equivalent. The ~RunCommand action always executes a ~LibO/AOO command. There is no emulation of the VBA command.
*The //Context// column indicates one or more contexts in which the command has been tested and executed successfully. This is not a guarantee that it will succeed in the given context nor that other contexts could not also provide the same functionality. When the context is __//Any//__ this only means that the command is likely to succeed in any context.
*The //~RunCommand// action is very often preceded by a [[SelectObject]] action to activate the correct context.
*Most commands open a dialog box. Today the ~LibO/AOO documentation does not contain any indication about arguments that could bypass the dialog. The only ways to discover them are either to scan the software sources (what I did not do !) or to record the macro. But //~LibO/AOO Base// has no //Macro Recorder// (although Forms have ...!?) implemented.
!!!Error messages
|Arguments are missing or are not initialized |
!!!See also
[[SelectObject]]
!!!Examples
<<tiddler "RunCommand example">></pre>
</div>
<div title="RunCommand example" modifier="Jean-PierreLedure" created="201204211041" modified="201205131745" tags="[[Snippets of Code]]">
<pre>Open a form, and display it with its data source grid ...
//{{{
OpenForm("myForm")
RunCommand(acCmdDatasheetView) ' or RunCommand("ViewFormAsGrid")
//}}}
Next Sub linked to the "When loading" event ALWAYS opens a form with its datagrid ...
//{{{
Sub DisplayGrid(oEvent As Object)
RunCommand(acCmdDatasheetView)
End Sub
//}}}
To open a form in design mode with automatic display of Form properties ...
//{{{
OpenForm("myForm", acDesign)
RunCommand("FormProperties")
//}}}
To enter an SQL statement at any time, execute next code ...
//{{{
SelectObject(acDatabaseWindow)
RunCommand("DBDirectSQL")
//}}}</pre>
</div>
<div title="RunSQL" modifier="Jean-Pierre Ledure" created="201112301423" modified="201607311210" tags="Actions" changecount="6">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~RunSQL// action executes the SQL statement given as argument. The statement must execute an action. Typical statements are: INSERT INTO, DELETE, SELECT...INTO, UPDATE, CREATE TABLE, ALTER TABLE, DROP TABLE, CREATE INDEX, or DROP INDEX.
<<tiddler "ApplyDoCmd">>
or to ...
| !Object | !Description |
|[[Database]] |A database object returned by the [[CurrentDb]] or [[OpenDatabase]] methods. |
!!!Syntax
{{{[DoCmd.]RunSQL(}}}//{{{SQL, option}}}//{{{)}}}
//{{{database}}}//{{{.RunSQL(}}}//{{{SQL, option}}}//{{{)}}}
| !Argument | !Optional | !Type |!Description |
|database || Object |A database object opened with the //~OpenDatabase// method. |
|SQL | No | String |Specifies the statement to execute |
|option | Yes | Integer<br />Long |If the argument is present its only allowed value = //dbSQLPassThrough//.<br />Forces escape substitution before sending the SQL statement to the database. |~|
The action returns False if the execution of the SQL statement failed.
!!!Remarks
*Statements
//{{{
DoCmd.RunSQL( ... )
//}}}
and
//{{{
Application.CurrentDb().RunSQL( ... )
//}}}
are equivalent.
*RDBMS system commands can also be executed with {{{RunSQL}}}. E.g. next command, which is valid for an HSQLDB database, will close the database connection and compact the data contained in the database. See the respective RDBMS manuals for more details.
//{{{
SHUTDOWN COMPACT
//}}}
*To test the SQL string: copy and paste it to or from the text box displayed when activating the {{{Tools}}} + {{{SQL ...}}} menu item.
*The field or table names of the SQL argument may be surrounded by square brackets [], especially when they contain special characters like spaces. The brackets will be replaced by the appropriate quoting chaaracter(s), e.g. the double-quote for the HSQLDB database management system.
*The supplied SQL string must obviously be syntactically correct. Pay particularly attention to single and double quotes. See the "[[How to include values in SQL statements|UseVariablesInSQL]]" topic in this matter.
*To include the constant in your own code, copy and paste next line:
//{{{
Const dbSQLPassThrough = 64
//}}}
!!!Error messages
|Arguments are missing or are not initialized |
|SQL Error, SQL statement = '...' |
!!!See also
[[CurrentDb]]
[[OpenDatabase]]
!!!Example
<<tiddler "Runsql example">></pre>
</div>
<div title="RunWithoutConnection" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201408140939" modified="201612181101" tags="NoTag" changecount="7">
<pre>Before the execution of the //~OpenConnection// verb, of if its execution failed, or after a //~CloseConnection// verb execution, next methods are nevertheless available:
| !Method | !Description |
|[[DebugPrint]] |All error handling routines. |
|[[TraceConsole]] |~|
|[[TraceError]] |~|
|[[TraceLevel]] |~|
|[[TraceLog]] |~|
|[[TempVars]] |The collection of [[TempVar]] objects to share and pass values among documents. |
|[[AllDialogs]] |Access to the collection of dialogs, the [[Dialog]] objects and their [[Controls|Control]]. |
|[[AllModules]] |Access to the collection of Basic modules and the [[Module]] objects. |
|[[CurrentDb]] |Returns {{{Nothing}}} if no database connection available. |
|[[CurrentUser]] |Context information. |
|[[ProductCode]] |~|
|[[Version]] |(When applied to Application).|
|[[OpenDatabase]] |Access to external database. |
|[[CommandBars]] |Manage menu-, status- and toolbars. |
|[[SysCmd]] |Status bar, progress meter handling. |
|[[GetHiddenAttribute]] |Window handling when no forms, queries, tables, reports implied. |
|[[Maximize]] |~|
|[[Minimize]] |~|
|[[MoveSize]] |~|
|[[SelectObject]] |~|
|[[SetHiddenAttribute]] |~|
|[[RunApp]] |External commands calls. |
|[[RunCommand]] |~|
</pre>
</div>
<div title="Runsql example" modifier="Jean-Pierre Ledure" created="201112301431" modified="201405161557" tags="[[Snippets of Code]]" changecount="1">
<pre>Create a new database table
//{{{
If DoCmd.RunSQL( _
"CREATE TABLE customer (" _
& "First_Name char(50)" _
& ", Last_Name char(50)" _
& ", Address char(50)" _
& ", City char(50)" _
& ", Country char(25)" _
& ", Birth_Date date" _
& ")") Then MsgBox "Customer table has been created !"
//}}}</pre>
</div>
<div title="SQL" modifier="Jean-Pierre Ledure" created="201306150720" modified="201405291654" tags="Properties" changecount="2">
<pre>You can use the //SQL// property to specify the statement contained in a [[QueryDef]] object.
!!!Applies to ...
| !Object |!Description |
|[[QueryDef]] |The representation of a database query |
!!!Syntax
//querydef//{{{.SQL}}}
//querydef//{{{.SQL = }}}//value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
*The SQL statement may be either a SELECT query, or an action query (data update, data manipulation, ...).
*The SQL statement may be set programmatically. The SQL string MUST then contain a SELECT statement.
*When the query is updated the change is immediate in the database document file (with ".odb" suffix) without having to save the query. However the change will be made persistent only if the user confirms the update by saving the database document itself. Alternatively the programmer could provide the Save command, e.g. with a statement like {{{RunCommand("Save")}}}
*In the SQL statement table- and fieldnames may be surrounded with square brackets [] to improve readability. They will be substituted with the appropriate surrounding character.
!!!Error messages
|Property '...' not applicable in this context |
|Value '...' is invalid for property 'SQL' |
!!!See also
[[Type]]
!!!Example
<<tiddler "SQL example">></pre>
</div>
<div title="SQL example" modifier="Jean-PierreLedure" created="201306150736" modified="201306150736" tags="[[Snippets of Code]]">
<pre>Modify the SQL statement of a stored query
//{{{
Dim oQuery As Object
Set oQuery = Application.CurrentDb().QueryDefs("myQuery")
oQuery.SQL = "SELECT * FROM [PRODUCTS]"
//}}}</pre>
</div>
<div title="SearchStandalone" modifier="Jean-Pierre Ledure" created="201304051219" modified="201406021128" tags="HowTo" changecount="1">
<pre>(Q) Can I have a search box and trigger the search thru all the records related to a form ?
(R) Use the [[FindRecord]] and [[FindNext]] actions.
The feature is illustrated thru the use of a [[standalone form|Standalone Forms]].
!!!Solution
Design the //standalone// form taking into account:
*The //~FindRecord// action works only on data displayed in a tabular form, i.e. through the use of a [[grid control|GridControl]].
*You will observe that the execution is slow: indeed //~FindRecord// will literally scroll thru the data and refresh the display accordingly. The solution is not adapted for very large tables of data.
Design next 4 fields and buttons:
#The search box: a simple //text box//, name = //~SearchText//. In the //Properties// window set its //Default text// property to "(search)". Link its //When receiving focus// event to the //~CleanSearch// procedure.
#A //checkbox// called //~MatchCase// indicating if the search must or not respect upper and lower cases.
#A search start button : link the //execute action// event with the //~ButtonStart// procedure.
#A //next// button : link the //execute action// event with the //~ButtonNext// procedure.
Now the code:
The //~CleanSearch// procedure empties the search box when its content is the default value:
//{{{
Const cstDefault = "(search)"
Sub CleanSearch(poEvent As Object)
Dim oEvent As Object, oField As Object
Set oEvent = Application.Events(poEvent)
Set oField = oEvent.Source
If oField.Value = cstDefault Then oField.Value = ""
End Sub
//}}}
The //cstDefault// constant is set outside the //Sub...End Sub// to be available also in next procedures:
//{{{
Sub ButtonStart(poEvent As Object)
Dim ofForm As Object, sSearch As String, bMatch As Boolean
Set ofForm = Application.Forms(0) ' standalone form itself
sSearch = ofForm.Controls("SearchText").Value
If sSearch = "" Or sSearch = cstDefault Then
MsgBox "The search box is not initialized. Please do and retry.", 16, "Search"
ofForm.Controls("SearchText").SetFocus()
Else
bMatch = ofForm.Controls("MatchCase").Value
DoCmd.Findrecord sSearch, acAnyWhere, bmatch, acDown, , acAll, True
End If
End Sub
Sub ButtonNext(poEvent As Object)
DoCmd.FindNext
End Sub
//}}}
!!!See also
[[FindRecord]]
[[FindNext]]
[[GridControl]]
[[SetFocus]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|Code |//TT Northwind Standalone.odt// ||~SearchText |When receiving focus |Enter a search text and press //Start//. |
|~|~|~|btnStart<br />btnNext |Execute action |~|</pre>
</div>
<div title="SelLength" modifier="Jean-Pierre Ledure" created="201401241651" modified="201408011521" tags="Properties" changecount="1">
<pre>The //~SelLength// property specifies or determines the number of characters selected in a text box.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |>|>| ~PatternField<br />~TextField |A control on an open form or dialog |
!!!Syntax
//control//{{{.SelLength}}}
//control//{{{.SelLength = }}}//value//
!!!Returned values / Arguments
{{{Long}}}
!!!Remarks
*The //~SelLength// property uses an integer value in the range 0 to the total number of characters in a text box.
*To set or return this property for a control, the control must have the focus. To move the focus to a control, use the [[SetFocus]] method.
!!!Error messages
|Property '~SelLength' not applicable in this context |
|Value '...' is invalid for property '~SelLength' |
!!!See also
[[SelStart]]
[[SelText]]
[[SetFocus]]
!!!Example
<<tiddler "Selection example">></pre>
</div>
<div title="SelStart" modifier="Jean-Pierre Ledure" created="201401241603" modified="201405291637" tags="Properties" changecount="1">
<pre>The //~SelStart// property specifies or determines the starting point of the selected text in a control or the position of the insertion point if no text is selected.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |>|>| ~PatternField<br />~TextField |A control on an open form or dialog |
!!!Syntax
//control//{{{.SelStart}}}
//control//{{{.SelStart = }}}//value//
!!!Returned values / Arguments
{{{Long}}}
!!!Remarks
*The //~SelStart// property uses an integer value in the range 1 to the total number of characters in a text box + 1.
*To set or return this property for a control, the control must have the focus. To move the focus to a control, use the [[SetFocus]] method.
*Changing the SelStart property cancels the selection, places the insertion point in the text at the left of the ~SelStart-th character, and sets the [[SelLength]] property to 0.
!!!Error messages
|Property '~SelStart' not applicable in this context |
|Value '...' is invalid for property '~SelStart' |
!!!See also
[[SelLength]]
[[SelText]]
[[SetFocus]]
!!!Example
<<tiddler "Selection example">></pre>
</div>
<div title="SelText" modifier="Jean-Pierre Ledure" created="201401241655" modified="201408011521" tags="Properties" changecount="1">
<pre>The //~SelText// property returns a string containing the selected text. If no text is selected, the //~SelText// property contains an empty string ("").
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |>|>| ~PatternField<br />~TextField |A control on an open form or dialog |
!!!Syntax
//control//{{{.SelText}}}
//control//{{{.SelText = }}}//value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
*If the control contains the selected text when this property is set, the selected text is replaced by the new //~SelText// setting. Otherwise selection is not cahnged.
*To set or return this property for a control, the control must have the focus. To move the focus to a control, use the [[SetFocus]] method.
!!!Error messages
|Property '~SelStart' not applicable in this context |
|Value '...' is invalid for property '~SelStart' |
!!!See also
[[SelLength]]
[[SelStart]]
[[SetFocus]]
!!!Example
<<tiddler "Selection example">></pre>
</div>
<div title="SelectListboxOnFirstLetters" modifier="Jean-PierreLedure" created="201212311658" modified="201308161333" tags="HowTo">
<pre>(Q) Can I make a search box where the proposed choices are dynamically limited to those starting with the letters typed by the user ?
(R) There are several solutions. One of them is presented below.
The implemented module is triggered each time a character is entered.
Accepted characters are :
*Letters, either lower or upper cased, and the space character
*The BACKSPACE which cancels the last entered letter
*The ESCAPE key which cancels the complete string of characters.
Other keys are ignored.
The goal is to minimize the reload of the data from the database, as it is an operation that could take a long time while the user is keying letters in ...
!!!Solution
It consists in:
*A [[listbox|ListBox]]. It is reinitialized with database data at each //form loading//, and, while the focus is on the box, at each BACKSPACE key and at each ESCAPE key pressing.
*After each letter pressed by the user the box keeps only the subset of the initial data that corresponds with the entered characters, without database access. The control is temporarily converted from an SQL [[RowSourceType]] to a VALUELIST one.
*The succession of letters is kept into the [[Tag]] property of the //listbox//.
Let's assume next table:
<<tiddler "ProductsTable">>
The //listbox// will help to converge as quickly as possible to the searched product name.
1. Associate next code with the //When loading// form event:
//{{{
Sub InitList(Optional poEvent As Object) ' Optional because also called from CaptureChar routine
'Activated when form opened and when ESC key is pressed in listbox
Const cstForm = "Products_FastSearch"
Const cstList = "FastList"
Dim ocList As Object, sSource As String
Set ocList = Forms(cstForm).Controls(cstList)
If Not IsMissing(poEvent) Then ocList.Tag = "" ' Initialized only when form opened
ocList.RowSourceType = com.sun.star.form.ListSourceType.SQL
ocList.RowSource = "SELECT [ProductName] FROM [Products] ORDER BY [ProductName] ASC" 'Requery implicit
sSource = Join(ocList.ItemData, ";")
ocList.RowSourceType = com.sun.star.form.ListSourceType.VALUELIST ' For performance
ocList.RowSource = sSource
End Sub
//}}}
2. Associate next routine with the //Key pressed// event of the concerned //listbox// control :
//{{{
Sub CaptureChar(poEvent As Object)
Dim oEvent As Object, ocList As Object, sTag As String, i As Integer
Dim vList() As Variant, vNewList() As Variant, iNew As Integer
Set oEvent = Events(poEvent)
If oEvent.EventType <> "KEYEVENT" Then Exit Sub
'Accepted keys: A-Z, a-z, BACKSPACE, ESCAPE. All other keys ignored
'Tag property of list box is used to keep sequence of entered characters
With oEvent
Set ocList = oEvent.Source
Select Case True
Case .KeyAlt, .KeyCtrl : Exit Sub
Case .KeyCode = com.sun.star.awt.Key.ESCAPE
ocList.Tag = ""
Call InitList()
Exit Sub
Case .KeyCode = com.sun.star.awt.Key.BACKSPACE
If Len(ocList.Tag) > 0 Then
sTag = ocList.Tag
ocList.Tag = Left(sTag, Len(sTag) - 1) ' Reduce length of Tag
Call InitList()
End If
Case (UCase(.KeyChar) >= "A" And UCase(.KeyChar) <= "Z") Or (.KeyCode = com.sun.star.awt.Key.SPACE)
ocList.Tag = ocList.Tag & .KeyChar
Case Else : Exit Sub
End Select
End With
With ocList ' Process Tag
sTag = .Tag
vList() = Split(.RowSource, ";")
.RowSource = ""
vNewList() = Array() ' Otherwise Redim protests
If UBound(vList) >= 0 Then
ReDim vNewList(0 To UBound(vList)) ' Resized later
iNew = 0 ' Counts valid entries in vList
For i = 0 To UBound(vList)
If Len(vList(i)) >= Len(sTag) Then
If UCase(Left(vList(i), Len(sTag))) = UCase(sTag) Then ' Case not sensitive
vNewList(iNew) = vList(i)
iNew = iNew + 1
End If
End If
Next i
If iNew > 0 Then
ReDim Preserve vNewList(0 To iNew - 1)
.RowSource = Join(vNewlist, ";") 'Apply new list after Tag selection
.ListIndex = 0 'Select first element
End If
End If
End With
End Sub
//}}}
!!!See also
[[Event]]
[[ItemData]]
[[ListIndex]]
[[RowSource]]
[[RowSourceType]]
[[Tag]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|~FastSearch |~Products_FastSearch |When loading |~FastList |Key pressed |Select the listbox, enter characters => the listbox content changes. |</pre>
</div>
<div title="SelectObject" modifier="Jean-Pierre Ledure" created="201204061442" modified="201409271455" tags="Actions" changecount="4">
<pre>The //~SelectObject// action moves the focus to the specified window.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]SelectObject(}}}//{{{ObjectType, ObjectName, InDatabaseWindow}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description | !Returned Value |
|{{{ObjectType}}} | No | acTable<br />acQuery<br />acForm<br />acReport<br />acDiagram (i.e. Relationships)<br />acDocument<br />acBasicIDE<br />acDatabaseWindow |The type of object to set the focus on. | True if sucess |
|{{{ObjectName}}} | Yes | String |The name of the object to set the focus on. This argument is NOT case-sensitive.<br />The argument is mandatory when the //~ObjectType// argument is one of next values: //acTable//, //acQuery//, //acForm//, //acReport// or //acDocument//.<br />When the //~ObjectType// is equal to //acDocument//, the //~ObjectName// argument must contain the __filename__ of the window to be selected. |~|
|{{{InDatabaseWindow}}} | Yes | Boolean |Specifies if the object has to be selected in the Database Window.<br />Must be FALSE. |~|
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acDiagram = 8
Const acForm = 2
Const acQuery = 1
Const acReport = 3
Const acTable = 0
Const acBasicIDE = 101
Const acDatabaseWindow = 102
Const acDocument = 111
//}}}
!!!Remarks
If the selected window is minimized or hidden, the //~SelectObject// action will reset the minimized or hidden status.
!!!Error messages
|Arguments are missing or are not initialized |
|Argument nr. ... [Value = '...'] is invalid |
|Object '...' not found |
!!!See also
[[GetHiddenAttribute]]
[[Maximize]]
[[Minimize]]
[[MoveSize]]
[[RunCommand]]
[[SetFocus]]
[[SetHiddenAttribute]]
!!!Example
<<tiddler "SelectObject example">></pre>
</div>
<div title="SelectObject example" modifier="Jean-Pierre Ledure" created="201204061502" modified="201408011522" tags="[[Snippets of Code]]" changecount="1">
<pre>Select the database window and minimize it, then set focus on an open form.
//{{{
Const acForm = 2
Const acDatabaseWindow = 102
DoCmd.SelectObject(acDatabaseWindow)
DoCmd.Minimize()
DoCmd.SelectObject(acForm, "myForm")
DoCmd.Maximize()
//}}}
Put the focus on a Writer document
//{{{
Const acDocument = 111
DoCmd.SelectObject(acDocument, "myWriterDocument.odt")
//}}}</pre>
</div>
<div title="Selected" modifier="Jean-Pierre Ledure" created="201109021323" modified="201405291612" tags="Properties" changecount="2">
<pre>The //Selected// property determines if the specified row in a list box is currently selected.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] | [[ListBox]] | [[ListBox]] | [[ListBox]] |A listbox on an open form, dialog or in a [[GridControl]]|
!!!Syntax
//control//{{{.Selected}}}
//control//{{{.Selected(}}}//index//{{{)}}}
//control//{{{.Selected}}} = //value//
{{{setSelected(}}}//control, value, index//{{{)}}}
!!!Returned values / Arguments
{{{Array of Booleans}}} (might be empty) if index is absent.
{{{Boolean}}} if index is present
!!!Remarks
*It is better to use the [[Value]] property for non-multiselect listboxes.
*Selecting an item in a [[combobox|ComboBox]] is done with the [[Value]] property.
*The //index// argument must have a (integer or long) value between 0 and (//~ListCount// - 1)
*If //index// is absent //control//{{{.Selected}}} returns an array dimensioned as [0 ... //~ListCount// - 1]. If the listbox is empty the returned array is also empty.
*If //index// is absent the //value// argument must be an array dimensioned as [0 ... //~ListCount// - 1].
*The use of {{{setSelected(}}}//control, value, index//{{{)}}} as syntax is due to the incapacity of Basic to accept //Optional// arguments in //Property Let// routines.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Property 'Selected' not applicable in this context |
|Out of array range or incorrect array size for property 'Selected'|
!!!See also
[[ItemData]]
[[ListCount]]
[[ListIndex]]
[[MultiSelect]]
[[RowSource]]
[[RowSourceType]]
[[Value]]
!!!Example
*List box
<<tiddler "ListBox example">></pre>
</div>
<div title="Selection example" modifier="Jean-Pierre Ledure" created="201401241615" modified="201408011457" tags="[[Snippets of Code]]" changecount="1">
<pre>Search a string in a text column and select it when found
//{{{
Dim ofForm As Object, ocControl As Object
Const cstSearch = "WINNIE"
Set ofForm = Forms("myForm")
Set ocControl =ofForm.Controls("myGridControl").Controls("mytextField")
With ocControl
.SetFocus()
DoCmd.FindRecord(cstSearch, acAnyWhere, True, , , acCurrent, True) ' Find first occurrence
.SelText = cstSearch
MsgBox "String '" & cstSearch & "' found in position " & .SelStart & ". Length = " .SelLength
End With
//}}}</pre>
</div>
<div title="SendObject" modifier="Jean-Pierre Ledure" created="201208171508" modified="201409271456" tags="Actions" changecount="2">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //~SendObject// action outputs the data in the specified object (currently only a form) to several output formats and inserts it into an e-mail. Recipients, subject and other elements can be inserted automatically as well.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]SendObject(}}}//{{{ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description | !Returned value |
|{{{ObjectType}}} | Yes | acSendNoObject<br />acSendForm |The type of object to output.<br />If absent the default value is {{{acSendNoObject}}}. | {{{True}}} if success |
|{{{ObjectName}}} | Yes | String |The valid name of an object of the type selected by the //~ObjectType// argument. If you want to output the active object, specify the object's type for the {{{ObjectType}}} argument and leave this argument blank.<br />If the {{{ObjectType}}} argument is left empty or is equal to the default value, if this argument is not empty, then it will be interpreted as the full path name of the file to attach to the mail. |~|
|{{{OutputFormat}}} | Yes | acFormatPDF<br />acFormatODT<br />acFormatDOC<br />acFormatHTML |The output format, expressed as an acFormatXXX constant. If this argument is omitted, te user will be prompted for the output format. |~|
|{{{To}}} | Yes | String |The recipients of the message whose names you want to put on the To line in the mail message.<br />Separate the recipients' names you specify in this argument (and in the Cc and Bcc arguments) with a semicolon (;).<br />If the mail application can't identify the recipients' names, the message isn't sent and an error occurs. |~|
|{{{Cc}}} | Yes | String |The message recipients whose names you want to put on the Cc ("carbon copy") line in the mail message. |~|
|{{{Bcc}}} | Yes | String |The message recipients whose names you want to put on the Bcc ("blind carbon copy") line in the mail message. |~|
|{{{Subject}}} | Yes | String |The subject of the message. This text appears on the Subject line in the mail message. |~|
|{{{MessageText}}} | Yes | String |Any text you want to include in the message in addition to the database object or the attachment. This text appears in the main body of the mail message. If you leave this argument blank, no additional text is included in the mail message.<br />If you leave the {{{ObjectType}}} and {{{ObjectName}}} arguments blank, you can use this argument to send a mail message without any database object. |~|
|{{{EditMessage}}} | Yes | Boolean |Specifies whether the message can be edited before it's sent. If you select {{{True}}}, the electronic mail application starts automatically, and the message can be edited. If you select {{{False}}}, the message is sent without the user having a chance to edit the message.<br />The default is {{{True}}}. |~|
|{{{TemplateFile}}} | Yes | String |If present, must be a null-length string. |~|
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acSendForm = 2
Const acSendNoObject = -1
Const acFormatPDF = "writer_pdf_Export"
Const acFormatODT = "writer8"
Const acFormatDOC = "MS Word 97"
Const acFormatHTML = "HTML"
//}}}
!!!Remarks
*//~Access2Base// uses for the sending of the mail the most appropriate of next protocols:
| !Protocol | !Used when | !Limitations | !Consequence |
|mailto: |{{{ObjectType}}} left empty or = {{{acSendNoObject}}} and {{{ObjectName}}} left blank. |No attachments<br />Message edition always allowed. |The {{{EditMessage}}} argument is ignored. |
|~XSimpleMailMessage<br />UNO interface |~LibreOffice<br />~OpenOffice 3.X |No Body insertion |The {{{MessageText}}} argument is ignored. |
|~|~|Maximum 1 "To" recipient |All the "To" recipients as from the 2nd in the list are added to the "Cc" recipients list. |
|~XSystemMailProvider<br />UNO interface |~OpenOffice 4.X |Maximum 1 "To" recipient |All the "To" recipients as from the 2nd in the list are added to the "Cc" recipients list. |
*If a form has to be sent, the designated form MUST be open before the //~SendObject// action is called.
*If the {{{ObjectName}}} argument is a file name then it may be expressed either in the (recommended) URL format (i.e. "{{{file:// ...}}}") or by using the operating system usual syntax (e.g. "{{{C:\...}}}" in Windows).
*When the form is transformed into another format, //~Access2Base// will use as temporary directory the directory mentioned in the //AOO/~LibO// {{{Options}}} for the {{{Paths/Temporary files}}} parameter.
!!!Error messages
|Object '...' not found |
|Action not applicable in this context |
|File access error on file '...' |
|Mail service could not be activated |
!!!See also
[[OutputTo]]
[[SelectObject]]
!!!Example
<<tiddler "SendObject example">> </pre>
</div>
<div title="SendObject example" modifier="Jean-PierreLedure" created="201208310934" modified="201308021615" tags="[[Snippets of Code]]">
<pre>To send a message without attachments, with a body. The mail client will open before the message being sent.
//{{{
DoCmd.SendObject( , , , "abc@def.com;ghi@def.com","xyz@abc.eu",,"This is the subject", "This is" & chr(13) & "the body")
//}}}
To send a file as attachment. The body will however be ignored. The mail client will open before the message being sent.
//{{{
Const acFormatPDF = "writer_pdf_Export"
DoCmd.SendObject(, "file:///C:/Users/MyName/Documents/Doc/Access2Base/access2base.html" _
, acFormatPDF, "abc@def.com;me@sdf.eu", "aaa@kk.it;bbb@kk.it", "me@mail.be", "This is the subject", "This is" & chr(13) & "the body" _
)
//}}}
To send a form in PDF as attachment in the mail, the mail client will not propose to edit the message
//{{{
Const acFormatPDF = "writer_pdf_Export"
DoCmd.SendObject(acSendForm, "myForm", acFormatPDF, "toyou@yourmail.eu", , , "Read carefully the attached file", , False)
//}}}</pre>
</div>
<div title="SetFocus" modifier="Jean-Pierre Ledure" created="201110311031" modified="201405241319" tags="Methods" changecount="1">
<pre>The //~SetFocus// method moves the focus to the specified form or to the specified control on the active form.
!!!Applies to ...
| !Object | !Description |
|[[Form]] |The representation of a form |
|[[Control]] |The representation of a control within a [[form|Form]], a [[subform|SubForm]] or a [[gridcontrol|GridControl]] |
!!!Syntax
//form//.{{{SetFocus}}}
//control//.{{{SetFocus}}}
!!!Returned value
//True// if success.
!!!Remarks
!!!Error messages
|Control '...' not found in gridcontrol '...' |
!!!See also
[[Bookmark]]
[[FindRecord]]
[[GoToRecord]]
[[SelectObject]]
!!!Example
<<tiddler "SetFocus example">></pre>
</div>
<div title="SetFocus example" modifier="Jean-Pierre Ledure" created="201110311042" modified="201408011522" tags="[[Snippets of Code]]" changecount="1">
<pre>Set focus on named control
//{{{
Dim sControl As String
getObject("Forms!myForm!myControl").SetFocus
//}}}</pre>
</div>
<div title="SetHiddenAttribute" modifier="Jean-Pierre Ledure" created="201312251126" modified="201409271456" tags="Actions" changecount="4">
<pre>The //~SetHiddenAttribute// action hides or shows the specified window.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]SetHiddenAttribute(}}}//{{{ObjectType, ObjectName, Hidden}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description | !Returned Value |
|{{{ObjectType}}} | No | acTable<br />acQuery<br />acForm<br />acReport<br />acDiagram (i.e. Relationships)<br />acBasicIDE<br />acDatabaseWindow<br />acDocument |The type of object to hide or show. | True if sucess |
|{{{ObjectName}}} | Yes | String |The name of the object to hide or to show. This argument is NOT case-sensitive.<br />The argument is mandatory when the //~ObjectType// argument is one of next values: //acTable//, //acQuery//, //acForm//, //acReport// or //acDocument//.<br />When the //~ObjectType// is equal to //acDocument//, the //~ObjectName// argument must contain the __filename__ of the targeted window. |~|
|{{{Hidden}}} | Yes | Boolean |{{{True}}} (default value) hides the object window.<br />{{{False}}}.makes the object visible again and sets the __focus__ on the window. |~|
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acDiagram = 8
Const acForm = 2
Const acQuery = 1
Const acReport = 3
Const acTable = 0
Const acBasicIDE = 101
Const acDatabaseWindow = 102
Const acDocument = 111
//}}}
!!!Remarks
*In //~MSAccess// the //~SetHiddenAttribute// action is related to the [[Application]] root object, not to the [[DoCmd]] one.
*When the //~ObjectType// is {{{acTable}}}, {{{acQuery}}}, {{{acForm}}} or {{{acReport}}}, the named object MUST be open.
*Before hiding the database window, be sure that a (programmatic) mean exists to make it visible again and be able to close the Base application.
!!!Error messages
|Arguments are missing or are not initialized |
|Argument nr. ... [Value = '...'] is invalid |
|Object '...' not found |
!!!See also
[[GetHiddenAttribute]]
[[Maximize]]
[[Minimize]]
[[MoveSize]]
[[RunCommand]]
[[SetFocus]]
[[SelectObject]]
!!!Example
<<tiddler "SetHiddenAttribute example">></pre>
</div>
<div title="SetHiddenAttribute example" modifier="Jean-Pierre Ledure" created="201312251152" modified="201408011523" tags="[[Snippets of Code]]" changecount="2">
<pre>Hide the database window, select an open and visible form then maximize it.
//{{{
Const acForm = 2
Const acDatabaseWindow = 102
DoCmd.SetHiddenAttribute(acDatabaseWindow)
If Not GetHiddenAttribute(acForm, "myForm") Then
DoCmd.SelectObject(acForm, "myForm")
DoCmd.Maximize()
End If
//}}}</pre>
</div>
<div title="SetOrderBy" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201411011334" modified="201502151539" tags="Actions" changecount="7">
<pre>{{firstletter{
@@color:#930;W @@
}}}hen you run the //~SetOrderBy// action, the sort is applied to the table, form or datasheet (for example, query result) that is active and has the focus.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]SetOrderBy(}}}//{{{[orderby], [controlname]}}}//{{{)}}}
| !Argument | !Optional | !Type |!Description |
|{{{orderby}}} | Yes | String |The name of the field or fields on which you want to sort records. When you use more than one field name, separate the names with a comma (,). |
|{{{controlname}}} |~|~|The name of a subform of the active form. |
!!!Remarks
*The //~SetOrderBy// action must not be called from a [[standalone form|Standalone Forms]].
*The //~SetOrderBy// action is applied on the current window. To make a window current, use the [[SelectObject]] action. If the current window is neither a form, a table datasheet or a query datasheet, the //~SetOrderBy// action returns {{{False}}} and ignores the request.
*The //~SetOrderBy// action, when applied to a table or a query datasheet, __does NOT work in //~OpenOffice//__ (//~LibreOffice// OK).
*To sort a table or a query with //~SetOrderBy//, the table or the query must be open. Eventually use therefore the [[OpenTable]] or [[OpenQuery]] actions.
*If //controlname// is present, the active window is expected to be a form. Otherwise //~SetOrderBy// refurns {{{False}}} and the request is ignored. The //controlname// is NOT case-sensitive. If //controlname// does not exist in the active form or is not the name of one of its [[subforms|SubForm]] then the action generates a run-time error.
*When records are sorted with //~SetOrderBy// the first record (if it exists ...) becomes the current record.
*Once applied, the sorting sequence is preserved for subsequent table or query openings during the same //~LibreOffice/~OpenOffice// session. It will become persistent when the database file ("*.odb") is saved.
*In the orderby argument, record and field names may be surrounded by square brackets. They will be replaced with the correct character surrounding such names in SQL statements targeted to be run on the concerned RDBMS (Relational Database Management System).
*To sort records in descending order, type DESC immediately after the field that needs to be sorted in descending order.
*Giving the null-length string ("") as orderby argument resets any pre-existing sorting sequence.
!!!Error messages
|Argument nr.X [Value = '...'] is invalid|
|Control '...' not found in parent (form, grid or dialog) '...' |
|Subform '...' not found in parent form '...' |
!!!See also
[[ApplyFilter]]
[[Filter]]
[[FilterOn]]
[[GoToRecord]]
[[SelectObject]]
[[SetFocus]]
!!!Example
<<tiddler "SetOrderBy example">></pre>
</div>
<div title="SetOrderBy example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201411011356" tags="[[Snippets of Code]]" changecount="1">
<pre>Sort the records of a subform
//{{{
Dim sSetOrderBy As String
Const cstFormName = "INVOICE"
Const cstSubFormName = "SubForm"
OpenForm(cstFormName)
sSetOrderBy = "[PURCHASE_PRICE] DESC"
SelectObject(acForm, cstFormName)
DoCmd.SetOrderBy(sSetOrderBy, cstSubFormName)
//}}}</pre>
</div>
<div title="ShippersTable" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201405311057" modified="201405311109" tags="HowTo" changecount="2">
<pre>*Shippers table
| !Fields | !Field Type | !Primary |
|~CompanyName |Text ||
|Phone |Text ||
|~ShipperID |~BigInt | Y |</pre>
</div>
<div title="ShortCut Notation" modifier="Jean-Pierre Ledure" created="201108201319" modified="201409271432" tags="Shortcuts" changecount="7">
<pre>The shortcut n{{firstletter{
@@color:#930;T@@
}}}ation allows to reach an [[object|Object Model]] or anyone of its properties by mean of a call to one single function. The first argument of the function is a ''STRING'' designating unambiguously the target [[form|Form]], [[dialog|Dialog]] or [[control|Control]], or one of their properties.
!!!The shortcut notation
The //shortcut notation// binds several //components// by mean of two operators:
*The "!" (exclamation mark)<br />The component on the left of the "!" is a //parent// of the component on its right. A //parent// may be a [[collection|Collection]] or an [[object|Object Model]] containing other //objects//, just like __a form contains controls__.<br />The first component must be a collection.
| ! Allowed collections | ! |
| [[Forms]] |The form must be open. |
| [[Dialogs|AllDialogs]] |The dialog must be active but not necessarily in execution. |
| [[TempVars]] |The invoked temporary variable must exist. |
*The "." (dot)<br />The dot separates an object on its left from one of the properties of the object on its right.
Note that the //shortcut notation// is NOT case-sensitive.
!!!Remarks
In //~MSAccess// the shortcut notation is a construction recognized as such by the Visual Basic interpreter. It can be used directly in expressions.
In //~Access2Base// the notation is given as a {{{String}}} argument to the [[getObject]], [[getValue]] and a few other functions.
!!!Examples
*The //myForm// form:
//{{{
Forms!myForm
//}}}
*The //myDialog// dialog:
//{{{
Dialogs!myDialog
//}}}
*The //myVar// variable
//{{{
TempVars!myVar
//}}}
*The [[AllowEdits]] property of //myForm//:
//{{{
Forms!myForm.AllowEdits
//}}}
*The [[Visible]] property of //myDialog//:
//{{{
Dialogs!myDialog.Visible
//}}}
*A control in //myForm//:
//{{{
Forms!myForm!myControl
//}}}
*The [[BackColor]] property of //myControl//:
//{{{
Forms!myForm!myControl.BackColor
Dialogs!myDialog!myControl.BackColor
//}}}
*A control in a subform:
//{{{
Forms!myForm!mySubForm.Form!mySubcontrol
//}}}
*The [[ControlTipText]] property of a control in a [[gridcontrol|GridControl]] located itself in a subform:
//{{{
Forms!myForm!mySubForm.Form!myGridControl!mySubControl.ControlTipText
//}}}
!!!Associated functions
| !Function | !Description |
|[[getObject]] |Returns an object corresponding with its argument. |
|[[getValue]] |Returns a property of the object corresponding with its argument. |
|[[setValue]] |Sets a property of the object corresponding with its first argument. |
>[[To know more ...|ShortcutNotationMore]]</pre>
</div>
<div title="ShortcutNotationMore" modifier="Jean-Pierre Ledure" created="201212301146" modified="201405300618" tags="HowTo" changecount="1">
<pre>(Q) Can I reach any control on any form with the shortcut notation ?
(R) The [[ShortCut Notation]] is a very rapid mean to reach the control or form you want and ...
*get with the [[getObject]] function its corresponding //~Access2Base// [[form|Form]] or [[control|Control]] [[object|Object Model]]
*get or set - with [[getValue]] or [[setValue]] - any property of the targetted object
The //shortcut notation// binds several //components// by mean of two operators:
*The "!" (exclamation mark)<br />The component on the left of the "!" is a //parent// of the component on its right. A //parent// may be a [[collection|Collection]] or an [[object|Object Model]] containing other //objects//, just like __a form contains controls__.<br />The first component must be a collection, the only allowed collections being [[Forms]] and [[Dialogs|AllDialogs]].
*The "." (dot)<br />The dot separates an object on its left from one of the properties of the object on its right.
Note also that a shortcut is NOT case-sensitive.
Let's assume
#//Mainform// is the name of the top level FORM
#//Subform1// is the name of the subform CONTROL on //Mainform//
#//Subform2// is the name of the subform CONTROL on //Subform1//
#//~Subform2_Grid// is the name of the grid CONTROL contained in //Subform2//
!!!To refer to a form property, like [[RecordSource]]
|On //Mainform// |Forms!Mainform.~RecordSource |
|On //Subform1// |Forms!Mainform!Subform1.Form.~RecordSource |
|On //Subform2// |Forms!Mainform!Subform1.Form!Subform2.Form.~RecordSource |
!!!To refer to a control
|On //Mainform// |Forms!Mainform!~ControlName |
|On //Subform1// |Forms!Mainform!Subform1.Form!~ControlName |
|On //Subform2// |Forms!Mainform!Subform1.Form!Subform2.Form!~ControlName |
|On //~Subform2_Grid// |Forms!Mainform!Subform1.Form!Subform2.Form!~Subform2_Grid!~ControlName |
!!!To refer to a control property, like [[Enabled]]
|On //Mainform// |Forms!Mainform!~ControlName.Enabled |
|On //Subform1// |Forms!Mainform!Subform1.Form!~ControlName.Enabled |
|On //Subform2// |Forms!Mainform!Subform1.Form!Subform2.Form!~ControlName.Enabled |
|On //~Subform2_Grid// |Forms!Mainform!Subform1.Form!Subform2.Form!~Subform2_Grid!~ControlName.Enabled |
!!!To refer to a subform or grid control property, like [[Name]]
|On //Subform1// |Forms!Mainform!Subform1.Name |
|On //Subform2// |Forms!Mainform!Subform1.Form!Subform2.Name |
|On //~Subform2_Grid// |Forms!Mainform!Subform1.Form!Subform2.Form!~Subform2_Grid.Name |</pre>
</div>
<div title="Shortcuts" modifier="Jean-Pierre Ledure" created="201108201320" tags="Menu">
<pre></pre>
</div>
<div title="ShowAllRecords" modifier="Jean-Pierre Ledure" created="201205171433" modified="201409271456" tags="Actions" changecount="3">
<pre>{{firstletter{
@@color:#930;T@@
}}}he //ShowAllRecords// action removes any existing filters and sorts that may exist on the current table, query, or form.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]ShowAllRecords()}}}
!!!Remarks
*The //~ShowAllrecords// action is usually preceded by a [[SelectObject]] action or by the [[SetFocus]] method applied on the targeted //form//.
*//~ShowAllRecords// returns {{{True}}} if the action was successful, {{{False}}} otherwise.
*The //~ShowAllrecords// action must not be triggered from a [[standalone form|Standalone Forms]]. Use the [[FilterOn]] property instead.
!!!Error messages
|Action not applicable in this context |
!!!See also
[[FilterOn]]
[[SelectObject]]
[[SetFocus]]
!!!Example
<<tiddler "ShowAllRecords example">></pre>
</div>
<div title="ShowAllRecords example" modifier="Jean-PierreLedure" created="201205171448" tags="[[Snippets of Code]]">
<pre>Reset existing filter or sort on an open form
//{{{
SelectObject(acForm, "myForm")
ShowAllRecords
//}}}</pre>
</div>
<div title="SimulateTabbed" modifier="Jean-Pierre Ledure" created="201401031328" modified="201405251642" tags="HowTo" changecount="3">
<pre>(Q) Can I easily simulate a tabbed interface (like in Calc ... ?) in a database form ?
(R) A tabbed interface is for building wizards stepping from a page to the next or hiding/unhiding portions of a form when a button is clicked.
This feature is builtin In a [[dialog|Dialog]]. See the [[Page]] property of dialogs and/or dialog [[controls|Control]].
However in a form we will have to be more creative by:
*making use of the concept of //sections// (remember that a database form is finally a Writer document ...). Indeed //sections// can be made programmatically hidden or visible very simply.
*managing them by mixing the //~Access2Base// and //UNO// API's
You have to understand that a //section// in a Writer document is nothing else than a set of __contiguous paragraphs__.
If we anchor a control on the form to a paragraph, and if that paragraph is included a a //section//, when hiding the //section// the control will be made hidden as well.
The concept has been derived from a topic from the (french) [[OpenOffice forum|https://forum.openoffice.org/fr/forum/viewtopic.php?f=29&t=23703]].
In next example we have put the main form - except its 2 top buttons //Orders// and //Details// - , in the first section, and a subform in the second one.This allows us to obtain next result:
[img[tabbed_orders.png]]
and after having pressed the //Details// button:
[img[tabbed_details.png]]
!!!The code behind the top buttons
//{{{
Public Sub SelectTab(Optional poEvent As Object)
Dim oEvent As Object, oForm As Object
Set oEvent = Application.Events(poEvent)
Set oForm = Forms("Orders_Tabbed")
If oEvent.Source.Name = "btnOrders" Then
oForm.Component.TextSections.getByIndex(1).IsVisible = False
oForm.Component.TextSections.getByIndex(0).IsVisible = True
oEvent.Source.Value = True
oForm.Controls("btnDetails").Value = False
Else ' btnDetails
oForm.Component.TextSections.getByIndex(0).IsVisible = False
oForm.Component.TextSections.getByIndex(1).IsVisible = True
oEvent.Source.Value = True
oForm.Controls("btnOrders").Value = False
End If
End Sub
//}}}
The code manages
*the visibility of each section : see the //~TextSections// property of text components;
*the toggle status of the upper buttons : see the [[Value]] property of command buttons.
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|Tabbed |~Orders_Tabbed ||btnOrders<br />btnDetails |Execute action ||</pre>
</div>
<div title="SiteSubtitle" modifier="YourName" created="201106250810" modified="201405040832" tags="excludeLists">
<pre>{{indent{It's about converting ''PEOPLE'', not data</pre>
</div>
<div title="SiteTitle" modifier="Jean-Pierre Ledure" created="201106250811" modified="201108061606" tags="excludeLists">
<pre>//[[Access2Base|Home]]//</pre>
</div>
<div title="SiteUrl" modifier="Jean-PierreLedure" created="201203110829" modified="201301162024" tags="excludeLists">
<pre>http://www.access2base.com/</pre>
</div>
<div title="Size" modifier="Jean-PierreLedure" created="201307211111" modified="201307211120" tags="Properties">
<pre>Returns a value that indicates the maximum size, in bytes, of a [[Field object|Field]].
!!!Applies to ...
| !Object |!Description |
|[[Field]] |The representation of a field of a table, a query or a recordset. |
!!!Syntax
//field//{{{.Size}}}
!!!Returned values
{{{Long}}}
!!!Remarks
*The //Size// property is read-only.
*For fields (other than Memo type fields) that contain character data, the //Size// property indicates the maximum number of characters that the field can hold. For numeric fields, the //Size// property indicates the number of decimal digits that the field can hold.
*For Long Binary and Memo Field objects, //Size// is always set to 0. To determine the size of a [[Field object|Field]] of the Memo or Long Binary types, use the [[FieldSize property|FieldSize]].
!!!Error messages
|Property 'Size' not applicable in this context |
!!!See also
[[DataType]]
[[FieldSize]]
!!!Example</pre>
</div>
<div title="Snippets of Code" modifier="Jean-Pierre Ledure" created="201107311453" tags="Menu">
<pre></pre>
</div>
<div title="SourceField" modifier="Jean-PierreLedure" created="201307211406" modified="201307211408" tags="Properties">
<pre>Returns a value that indicates the name of the field that is the original source of the data for a [[Field object|Field]].
!!!Applies to ...
| !Object |!Description |
|[[Field]] |The representation of a field of a [[TableDef]] or a [[QueryDef]]. |
!!!Syntax
//field//{{{.SourceField}}}
!!!Returned values
{{{String}}}
!!!Remarks
*The value returned by the //~SourceField// property of a field belonging to a //~TableDef// is probably not relevant. It is however applicable.
*The //~SourceField// property is not valid for a [[Recordset]] object.
!!!Error messages
!!!See also
[[SourceTable]]
!!!Example</pre>
</div>
<div title="SourceTable" modifier="Jean-PierreLedure" created="201307211356" modified="201307211405" tags="Properties">
<pre>returns a value that indicates the name of the table that is the original source of the data for a [[Field object|Field]].
!!!Applies to ...
| !Object |!Description |
|[[Field]] |The representation of a field of a [[TableDef]], a [[QueryDef]] or a [[Recordset]]. |
!!!Syntax
//field//{{{.SourceTable}}}
!!!Returned values
{{{String}}}
!!!Remarks
The value returned by the //~SourceTable// property of a field belonging to a //~TableDef// is probably not relevant. It is however applicable.
!!!Error messages
!!!See also
[[SourceField]]
!!!Example</pre>
</div>
<div title="Special controls" modifier="Jean-Pierre Ledure" created="201108170951" tags="Menu">
<pre></pre>
</div>
<div title="SpecificA2BPlugin" modifier="YourName" created="201107191138" modified="201902151516" tags="systemConfig excludeLists" changecount="3">
<pre>/***
|''Name:''|SpecificA2BPlugin|
|''Description:''|Forces readOnly to true or false. Useful to distribute a ReadOnly version of Access2Base help file. Set value to //true// in code below.|
!Code
***/
//{{{
readOnly = (window.location.protocol == "file:") ? true : config.options.chkHttpReadOnly;
//}}}
/***
|''Description:''|Modify tiddler tooltip for anonymisation.<br>Standard value: "%0 - %1, %2".|
!Code
***/
//{{{
merge(config.messages,{
tiddlerLinkTooltip: "%0 - Click to open",
});
//}}}
/***
|''Description''|Modify the header of the List macro.|
!Code
***/
//{{{
config.macros.list.all.prompt = "All topics in alphabetical order";
//}}}
</pre>
</div>
<div title="Standalone Connect example" modifier="Jean-Pierre Ledure" created="201206161953" modified="201405241146" tags="[[Snippets of Code]]" changecount="2">
<pre>Connect all standalone form contained in a non-Base document to their target databases:
//{{{
Sub DBOpen(Optional poEvent As Object)
If GlobalScope.BasicLibraries.hasByName("Access2Base") then
GlobalScope.BasicLibraries.loadLibrary("Access2Base")
End If
Call Application.OpenConnection(ThisComponent)
End Sub
//}}}</pre>
</div>
<div title="Standalone Forms" modifier="Jean-Pierre Ledure" created="201206161918" modified="201410280826" tags="Menu" changecount="23">
<pre>{{firstletter{
@@color:#930;S@@
}}}//tandalone forms// are stored in non-Base AOO/~LibO documents (Writer, Calc, ...), usually (but not necessarily) built from a normal //form// Base object. These forms and controls may be linked with data located in databases by referring to a Base document (".odb" file) in the __data tab__ of the form properties.
>''Each such form may access a separate database document !''
To make such forms, documentation is available on several forums, e.g. [[here|http://user.services.openoffice.org/en/forum/viewtopic.php?t=40493]].
//~Access2Base// may be invoked from macros stored in documents containing one or more //standalone forms//. However NOT ALL the properties, methods, actions etc. are meaningful in such a context.
Find below the status by function. If not mentioned a function is available without restriction.
In addition a //standalone form// does see the //Table// and //Query// objects stored within the database document (".odb" file) where it is connected with.
At the opposite:
|A //standalone form// ''CANNOT INTERACT'' with (either standalone or embedded) forms stored in ''OTHER DOCUMENTS''.<br />If it is necessary to exchange data between individual //~LibO/AOO// applications, use [[TempVar]] objects. Their scope is the whole //~LibO/AOO// session. |
|A //standalone form// can ''READ and MODIFY DATA'' in its related database, can ''READ its DESIGN'' but cannot modify it. |
Several documents containing standalone forms might be opened at the same time, all using the //~Access2Base// API.
!!Use the ~Access2Base library
To be able to invoke the //~Access2Base// API from a non-Base AOO/~LibO document you have to
*Have a minimal knowledge of the Basic IDE and of the Basic programming language.
*Open the targeted document and edit at least next macro:
<<tiddler "Standalone Connect example">>
*Assign with menu items {{{Tools + Customize...}}} ({{{Events}}} tab) the above Sub ("~DBOpen" in the example but use the name of your choice) to the //~OpenDocument// event. Save in the document file itself.
*__Optionally__ associate next code with the //"View is going to be closed"// document event.
//{{{
Sub DBClose(Optional poEvent As Object)
Call CloseConnection()
End Sub
//}}}
*//Close// and re-//open// the file. This will trigger the //~OpenDocument// event.
*Start programming macro's. Associate them with //form// or //control events// if relevant
!!Next functions are available __with limitations__
| !Function | !Limitation |
|[[AllForms]] |The //~AllForms// collection is limited to the //standalone forms// stored in the same document.<br />When a document contains one single form - which is very often the case - the smart syntax for invoking that single form is simply:<br />{{{AllForms(0)}}}<br />which will return a //form object// representing the single //standalone form// itself, giving subsequently access to its individual controls. |
|[[FindRecord]] |If the form contains subforms and if the targeted field to search on is in that subform, then the //~OnlyCurrentField// argument must be a {{{string}}} containing a [[shortcut|ShortCut Notation]] if the targeted grid or grid column is in the subform. |
|[[GoToRecord]] |The //~ObjectType// argument must be equal to {{{acDataForm}}} and the //~ObjectName// argument must be a {{{string}}} containing either the name of the targeted form or a [[shortcut|ShortCut Notation]] to it. |
|[[SelectObject]] |The objects opened from a Base document (".odb") - tables, queries, etc. - can be selected from a //standalone form//.<br />Similarly //Standalone forms// can be selected from a Base document (".odb") via their filenames.<br />However no interaction is possible between them thru the //~Access2Base// API. As an example it is not possible to know from the current //standalone form// the content of a //control// located in another //database form// or a //standalone form// belonging to another document. |
|[[Height]]<br />[[Width]]<br />[[Move]] |These methods, even when applied to a specific form, act on the containing window, i.e. on all its forms. |
|[[OpenArgs]] |The //~OpenArg// (read-only) property always returns a zero-length string. |
!!Next functions are not available
//~Access2Base// will generate an error (or sometimes ignore the request) if one of next functions is invoked from a //standalone form// context.
| !Function | !Comment |
|[[ApplyFilter]] |Use the [[Filter]] and [[FilterOn]] form properties instead. |
|[[Close]] |Forbidden when applied to a form or another database object.<br />Closing a [[Recordset]] is allowed. |
|[[CopyObject]] |A standalone form has limited access to database objects. The offered facilities are mainly [[recordset|Recordset]] manipulations thru tables and queries. |
|[[OpenForm]], [[OpenQuery]], [[OpenReport]], [[OpenTable]] |~|
|[[CreateQueryDef]] |~|
|[[CreateTableDef]], [[CreateField]], [[Add]] |~|
|[[Delete (table-query)]] |~|
|[[GoToControl]] |Use the [[SetFocus]] method instead. |
|[[Quit]] ||
|[[ShowAllRecords]] |Use the [[FilterOn]] and/or [[OrderByOn]] form properties instead. |
!!See also ...
[[CloseConnection]]
[[OpenConnection]]</pre>
</div>
<div title="Start" modifier="Jean-Pierre Ledure" created="201302021432" modified="201405241109" tags="Methods" changecount="1">
<pre>The //Start// method initializes the specified [[dialog|Dialog]].
!!!Applies to ...
| !Object | !Description |
|[[Dialog]] |The representation of a Basic dialog |
!!!Syntax
//dialog//.{{{Start}}}
| !Returned value |
|//True// if success. |
!!!Remarks
The //Start// method makes the controls of the dialog available to the programmer. The display of the dialog will be triggered by the [[Execute|Execute (dialog)]] method.
!!!Error messages
|Dialog unknown |
|Dialog already started |
!!!See also
[[AllDialogs]]
[[EndExecute]]
[[Execute|Execute (dialog)]]
[[Terminate]]
!!!Example
<<tiddler "Dialog example">></pre>
</div>
<div title="StyleSheet" modifier="YourName" created="201106250800" modified="201112271605" tags="excludeLists">
<pre>/***
!~TiddlyWiki Classic Color Scheme
Designed by Jeremy Ruston
http://tiddlystyles.com/#theme:Classic
To use this color scheme copy the ~ClassicTiddlyWiki contents into a tiddler and name it 'StyleSheet' also grab the ~ClassicTemplate and copy its contents into a tiddler named 'PageTemplate'.
!Colors Used
*@@bgcolor(#630):color(#fff): #630@@
*@@bgcolor(#930): #930@@
*@@bgcolor(#996633): #963@@
*@@bgcolor(#c90): #c90@@
*@@bgcolor(#cf6): #cf6@@
*@@bgcolor(#cc9): #cc9@@
*@@bgcolor(#ba9): #ba9@@
*@@bgcolor(#996): #996@@
*@@bgcolor(#300):color(#fff): #300@@
*@@bgcolor(#000000):color(#fff): #000@@
*@@bgcolor(#666): #666@@
*@@bgcolor(#888): #888@@
*@@bgcolor(#aaa): #aaa@@
*@@bgcolor(#ddd): #ddd@@
*@@bgcolor(#eee): #eee@@
*@@bgcolor(#ffffff): #fff@@
*@@bgcolor(#f00): #f00@@
*@@bgcolor(#ff3): #ff3@@
!Generic Rules /%==============================================%/
***/
/*{{{*/
body {
background: #fff;
color: #000;
}
a{
color: #963;
}
a:hover{
background: #963;
color: #fff;
}
a img{
border: 0;
}
h1,h2,h3,h4,h5 {
background: #cc9;
}
/*}}}*/
/***
!Header /%==================================================%/
***/
/*{{{*/
.header{
background: #300;
}
.titleLine {
color: #fff;
padding: 5em 0em 1em .5em;
}
.titleLine a {
color: #cf6;
}
.titleLine a:hover {
background: transparent;
}
/*}}}*/
/***
!Main Menu /%=================================================%/
***/
/*{{{*/
#mainMenu .button {
color: #930;
}
#mainMenu .button:hover {
color: #cf6;
background: #930;
}
#mainMenu li{
list-style: none;
}
/*}}}*/
/***
!Sidebar options /%=================================================%/
~TiddlyLinks and buttons are treated identically in the sidebar and slider panel
***/
/*{{{*/
#sidebar {
background: #c90;
right: 0;
}
#sidebarOptions a{
color: #930;
border: 0;
margin: 0;
padding: .25em .5em;
}
#sidebarOptions a:hover {
color: #cf6;
background: #930;
}
#sidebarOptions a:active {
color: #930;
background: #cf6;
}
#sidebarOptions .sliderPanel {
background: #eea;
margin: 0;
}
#sidebarOptions .sliderPanel a {
color: #930;
}
#sidebarOptions .sliderPanel a:hover {
color: #cf6;
background: #930;
}
#sidebarOptions .sliderPanel a:active {
color: #930;
background: #cf6;
}
/*}}}*/
/***
!Sidebar tabs /%=================================================%/
***/
/*{{{*/
.tabSelected,.tabContents {
background: #eea;
border: 0;
}
.tabUnselected {
background: #c90;
}
#sidebarTabs {
background: #c90;
}
#sidebarTabs .tabSelected{
color: #cf6;
background: #963;
}
#sidebarTabs .tabUnselected {
color: #cf6;
background: #930;
}
#sidebarTabs .tabContents{
background: #963;
}
#sidebarTabs .txtMoreTab .tabSelected,
#sidebarTabs .txtMoreTab .tabSelected:hover{
background: #930;
color: #cf6;
}
#sidebarTabs .txtMoreTab .tabUnselected,
#sidebarTabs .txtMoreTab .tabUnselected:hover{
background: #300;
color: #cf6;
}
#sidebarTabs .txtMoreTab .tabContents {
background: #930;
}
#sidebarTabs .tabContents a {
color: #cf6;
border: 0;
}
#sidebarTabs .button.highlight,
#sidebarTabs .tabContents a:hover {
background: #cf6;
color: #300;
}
/*}}}*/
/***
!Message Area /%=================================================%/
***/
/*{{{*/
#messageArea {
background: #930;
color: #fff;
}
#messageArea a:link, #messageArea a:visited {
color: #c90;
}
#messageArea a:hover {
color: #963;
background: transparent;
}
#messageArea a:active {
color: #fff;
}
/*}}}*/
/***
!Popup /%=================================================%/
***/
/*{{{*/
.popup {
background: #eea;
border: 1px solid #930;
}
.popup hr {
color: #963;
background: #963;
border-bottom: 1px;
}
.popup li.disabled {
color: #ba9;
}
.popup li a, .popup li a:visited {
color: #300;
}
.popup li a:hover {
background: #930;
color: #eea;
}
/*}}}*/
/***
!Tiddler Display /%=================================================%/
***/
/*{{{*/
.tiddler .button {
color: #930;
}
.tiddler .button:hover {
color: #cf6;
background: #930;
}
.tiddler .button:active {
color: #fff;
background: #c90;
}
.shadow .title {
color: #888;
}
.title {
color: #422;
}
.subtitle {
color: #866;
}
.toolbar {
color: #aaa;
}
.toolbar a,
.toolbar a:hover{
border: 0;
}
.tagging, .tagged {
border: 1px solid #fff;
background-color: #ffc;
}
.selected .tagging, .selected .tagged {
border: 1px solid #aa6;
background-color: #ffc;
}
.tagging .listTitle, .tagged .listTitle {
color: #999999;
}
.footer {
color: #ddd;
}
.selected .footer {
color: #888;
}
.sparkline {
background: #eea;
border: 0;
}
.sparktick {
background: #930;
}
.errorButton {
color: #ff0;
background: #f00;
}
.zoomer {
color: #963;
border: 1px solid #963;
}
/*}}}*/
/***
''The viewer is where the tiddler content is displayed'' /%------------------------------------------------%/
***/
/*{{{*/
.viewer .button {
background: #c90;
color: #300;
border-right: 1px solid #300;
border-bottom: 1px solid #300;
}
.viewer .button:hover {
background: #eea;
color: #c90;
}
.viewer .imageLink{
background: transparent;
}
.viewer blockquote {
border-left: 3px solid #666;
}
.viewer table {
border: 2px solid #303030;
}
.viewer th, thead td {
background: #996;
border: 1px solid #606060;
color: #fff;
}
.viewer td, .viewer tr {
border: 1px solid #606060;
}
.viewer pre {
border: 1px solid #963;
background: #eea;
}
.viewer code {
color: #630;
}
.viewer hr {
border: 0;
border-top: dashed 1px #606060;
color: #666;
}
.highlight, .marked {
background: #ff3;
}
/*}}}*/
/***
''The editor replaces the viewer in the tiddler'' /%------------------------------------------------%/
***/
/*{{{*/
.editor input {
border: 1px solid #000;
}
.editor textarea {
border: 1px solid #000;
width: 100%;
}
.editorFooter {
color: #aaa;
}
.editorFooter a {
color: #930;
}
.editorFooter a:hover {
color: #cf6;
background: #930;
}
.editorFooter a:active {
color: #fff;
background: #c90;
}
/*}}}*/
/***
!Specific addition for ~Access2Base /%=================================================%/
***/
/*{{{*/
@media print {#mainMenu {display: none ! important;}}
@media print {#topMenu {display: none ! important;}}
@media print {#sidebar {display: none ! important;}}
@media print {#messageArea {display: none ! important;}}
@media print {#toolbar {display: none ! important;}}
@media print {.header {display: none ! important;}}
@media print {.tiddler .subtitle {display: none ! important;}}
@media print {.tiddler .toolbar {display; none ! important; }}
@media print {.tiddler .tagging {display; none ! important; }}
@media print {.tiddler .tagged {display; none ! important; }}
#mainMenu {
position:absolute;
left:0;
width:13em;
text-align:right;
line-height:1.6em;
padding:1.5em 0.5em 0.5em 0.5em;
font-size:1.1em;
}
#displayArea {
margin:1em 17em 0 16em;
}
.titleLine {
color: #fff;
padding: 3em 0em 1em .5em;
}
.firstletter{ float:left; width:0.75em; font-size:400%; font-family:times,arial; line-height:60%; }
.tiddler .subtitle { display:none; }
/*}}}*/
/*~StyleSheetShortcuts*/</pre>
</div>
<div title="SubForm" modifier="Jean-Pierre Ledure" created="201107191255" modified="201407261333" tags="Objects [[Special controls]]" changecount="8">
<pre>{{firstletter{
@@color:#930;A@@
}}} //~SubForm// [[object|Object Model]] represents a subset of the controls of an open //form//. The open form is called the "parent form" or "master". ~SubForms are used mainly to access more than one table (or query) from a //form//. Each additional table requires its own //subform//.
!!!Properties returning a subform object
| !Parent object | !Property |!Description |
|[[Control]] |[[Form|Form (subform)]] |A //subform// is a //Control// like another. The //Form// property of a control of type //~SubForm// will return a //~SubForm// object. |
!!!Properties
| !Property | !Type | !Read only | !Description or UNO object |
|[[AllowAdditions]] |||Specifies whether a user can add a record when using the subform. |
|[[AllowDeletions]] |||Specifies whether a user can delete a record when using the subform. |
|[[AllowEdits]] |||Specifies whether a user can modify a record when using the subform. |
|[[CurrentRecord]] |||Identifies the current record in the recordset being viewed on the subform. |
|[[Filter]] |||Specifies a subset of records to be displayed. |
|[[FilterOn]] |||Specifies if the Filter has to be applied. |
|[[LinkChildFields]]<br />[[LinkMasterFields]] || Y |Specifies how records in the subform (//child//) are linked to records in its parent (//master//) form. |
|[[Name]] || Y |Specifies the exact name of the subform control. |
|[[ObjectType]] || Y |Returns "SUBFORM" |
|[[OrderBy]] |||Specifies in which order the records should be displayed. |
|[[OrderByOn]] |||Specifies if the ~OrderBy has to be applied. |
|[[Parent]] || Y |Returns the parent object of the subform. |
|[[RecordSource]] |||Specifies the source of the data. |
|~ParentComponent | UNO | Y |com.sun.star.text.~TextDocument |
|~DatabaseForm | UNO | Y |com.sun.star.form.component.~DataForm<br />com.sun.star.sdb.~ResultSet |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the Dialog has the given property. |
|[[Requery]] ||~|True if data reloaded in ~SubForm |
|[[setProperty]] | property<br />value |~|Return True if the given property could be set. |
!!!Remarks
Each //~SubForm// [[object|Object Model]] has a Controls [[collection|Collection]], which contains all controls on the subform. You can refer to a specific control on a subform by referring to the [[Controls]] collection.
!!!Example
<<tiddler "Subform example">></pre>
</div>
<div title="SubType" modifier="Jean-PierreLedure" created="201107311648" modified="201306151426" tags="Properties">
<pre>The types of control can be recognized thru the use either of the //~SubType// or the [[ControlType]] properties. The ~SubType property has no correspondent within ~MSAccess but has the advantage to identify all control types.
See the correspondence table below.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl |!Description |
|[[Control]] | All | All |A control on an open form |
!!!Syntax
//control//{{{.SubType}}}
!!!Returned values
{{{String}}}
Table of values:
<<tiddler "ControlTypesList">>
!!!Remarks
The ~SubType property is read-only.
!!!Error messages
!!!See also
[[ControlType]]
!!!Example
<<tiddler "ControlType example">></pre>
</div>
<div title="Subform example" modifier="Jean-PierreLedure" created="201107191441" modified="201212071845" tags="[[Snippets of Code]]">
<pre>List all the controls of a subform
//{{{
Dim ocSubform As Object, osfSubform As Object, i As Integer, iCount As Integer
Set ocSubform = Controls("FACTURE", "subform")
Set osfSubform = ocSubform.Form
iCount = osfSubform.Controls().Count
For i = 0 To iCount - 1
Print osfSubform.Controls(i).Name,
Next i
Print
//}}}</pre>
</div>
<div title="SuppliersTable" modifier="Jean-PierreLedure" created="201212161701" modified="201212161702" tags="HowTo">
<pre>*Suppliers table
| !Fields | !Field Type | !Primary |
|Address | Text ||
|City | Text ||
|~ComanyName | Text ||
|~ContactName | Text ||
|~ContactTitle | Text ||
|Country | Text ||
|Fax | Text ||
|~HomePage | Text ||
|Phone | Text ||
|~PostalCode | Text ||
|Region | Text ||
|~SupplierID | ~BigInt | Y |</pre>
</div>
<div title="Sync2Combos" modifier="Jean-PierreLedure" created="201212231729" modified="201308161234" tags="HowTo">
<pre>(Q) How can I limit the contents of one combo/list box based on what's selected in another combo/list box ?
(R) An easy way to do this would be to assign a dynamic SQL statement to the [[RowSource]] property of the secondary combo/list box at runtime.
Our goal in the example is to select in a 1st combo box a CITY, in the 2nd combo the LASTNAME of the employees (working in CITY) to filter finally only the //Orders// placed by the concerned //Employee//.
Considering
<<tiddler "EmployeesTable">>
*Initialize the //List content// entry of the 1st combo box with:
//{{{
SELECT DISTINCT "City" FROM "Employees"
//}}}
*Assign next Sub to the //Text modified// event of the 1st combo box:
//{{{
Sub Update2ndCombo(poEvent As Object)
Dim ocCombo1 As Object, ocCombo2 As Object, sSQL As String
Set ocCombo1 = Events(poEvent).Source
Set ocCombo2 = ocCombo1.Parent.Controls("EmployeeName")
sSQL = "SELECT DISTINCT [LastName] FROM [Employees] WHERE [Employees].[City]='" & ocCombo1.Value & "'"
ocCombo2.RowSourceType = com.sun.star.form.ListSourceType.SQL
ocCombo2.RowSource = sSQL
End Sub
//}}}
*Initilialize the //List content// entry of the 2nd combo box with:
//{{{
SELECT DISTINCT "LastName" FROM "Employees"
//}}}
*Assign next Sub to the //Text modified// event of the 2nd combo box:
//{{{
Sub UpdateMainForm(poEvent As Object)
Dim ofForm As Object, ocCombo As Object, sSQL As String, lEmpID As Integer
Set ocCombo = Events(poEvent).Source
Set ofForm = ocCombo.Parent
lEmpID = DLookup("[EmployeeID]", "[Employees]", "[LastName]='" & ocCombo.Value & "'")
ofForm.Filter = "[EmployeeID]=" & lEmpID
ofForm.FilterOn = True
End Sub
//}}}
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|~ComboBox |~Orders_2Combos ||~EmployeeCity |Text modified ||
|~|~|~|~EmployeeName |~|~|</pre>
</div>
<div title="SysCmd" modifier="Jean-Pierre Ledure" created="201301191424" modified="201408031038" tags="Actions" changecount="5">
<pre>The //~SysCmd// method displays a progress meter or optional specified text in the status bar. By calling the //~SysCmd// method with the various progress meter actions, you can display a progress meter in the status bar for an operation that has a known duration or number of steps, and update it to indicate the progress of the operation.
<<tiddler "ApplyDoCmd">>
!!!Syntax
{{{[DoCmd.]SysCmd(}}}//{{{Action, Text, Value}}}//{{{)}}}
| !Argument | !Optional | !Type<br />or<br />Symbol |!Description |
|{{{Action}}} | No | acSysCmdAccessVer |Returns "~LibreOffice x.y.z" or "~OpenOffice x.y.z" where x.y.z is the version number.<br />Use [[Application.Version|Application]] instead. |
|~|~| acSysCmdSetStatus |Sets the status bar text to the //text// argument. |
|~|~| acSysCmdClearStatus |Resets the status bar to its usual content. |
|~|~| acSysCmdInitMeter |Initializes the progress meter. You must specify the //Text// and //Value// arguments when you use this action. |
|~|~| acSysCmdUpdateMeter |Updates the progress meter with the specified value. You must specify the text argument when you use this action. |
|~|~| acSysCmdRemoveMeter |Removes the progress meter. |
|~|~| acSysCmdRuntime |Returns //True// (–1) if a run-time version of //~LibO/AOO// is running.<br />Always returns //False//. |
|~|~| acSysCmdAccessDir<br /> acSysCmdClearHelpTopic<br />acSysCmdGetObjectState<br />acSysCmdGetWorkgroupFile<br />acSysCmdIniFile<br />acSysCmdProfile |Returns //True// without doing anything. |
|{{{Text}}} | Yes | String |A string expression identifying the text to be displayed left-aligned in the status bar. This argument is required when the //action// argument is ''acSysCmdInitMeter'', ''acSysCmdUpdateMeter'', or ''acSysCmdSetStatus''.<br />This argument isn't valid for other action argument values. |
|{{{Value}}} | Yes | Integer<br />Long |A numeric expression that controls the display of the progress meter. This argument is required when the //action// argument is ''acSysCmdInitMeter''.<br />This argument isn't valid for other action argument values. |
The symbolic constants can be included in your code by copying and pasting next lines:
//{{{
Const acSysCmdAccessVer = 7
Const acSysCmdClearStatus = 5
Const acSysCmdInitMeter = 1
Const acSysCmdRemoveMeter = 3
Const acSysCmdSetStatus = 4
Const acSysCmdUpdateMeter = 2
Const acSysCmdRuntime = 6
Const acSysCmdAccessDir = 9
Const acSysCmdClearHelpTopic = 11
Const acSysCmdGetObjectState = 10
Const acSysCmdGetWorkgroupFile = 13
Const acSysCmdIniFile = 8
Const acSysCmdProfile = 12
//}}}
!!!Remarks
*In //~MSAccess// the //~SysCmd// method is linked to the [[Application]] object.
*The //~SysCmd// method will be often preceeded with a [[SelectObject]] action.
*Only status bars of //forms// and //reports// can be managed with the //~SysCmd// method. When another window is active the method is ignored.
*To display a progress meter in the status bar, you must first call the //~SysCmd// method with the ''acSysCmdInitMeter'' action argument, and the text and value arguments. When the action argument is ''acSysCmdInitMeter'', the value argument is the maximum value of the meter, or 100 percent.<br />To update the meter to show the progress of the operation, call the //~SysCmd// method with the ''acSysCmdUpdateMeter'' action argument and the text and value arguments. When the action argument is ''acSysCmdUpdateMeter'', the //~SysCmd// method uses the value argument to calculate the percentage displayed by the meter. For example, if you set the maximum value to 200 and then update the meter with a value of 100, the progress meter will be half-filled.
*When a progress meter has been initiated with a ''acSysCmdInitMeter'' action argument, all subsequent calls to //~SysCmd// to feed the meter will be applied on the status bar of the same window even if other windows become active in the mean time.
*You can also change the text that's displayed in the status bar of the currently active window by calling the //~SysCmd// method with the ''acSysCmdSetStatus'' action argument and the text argument.<br />If the progress meter is already displayed when you set the text by calling the //~SysCmd// method with the ''acSysCmdSetStatus'' action argument, the //~SysCmd// method automatically removes the meter, __even if the progress meter is on another - non active - window__.
!!!Error messages
|Arguments are missing or are not initialized |
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[SelectObject]]
!!!Example
<<tiddler "SysCmd example">></pre>
</div>
<div title="SysCmd example" modifier="Jean-PierreLedure" created="201301201457" modified="201301201503" tags="[[Snippets of Code]]">
<pre>To have a help text displayed in the status bar when a field receives the focus, link next code with the //When receiving focus// event of the concerned field:
//{{{
Sub DisplayHelp(poEvent As Object)
' Display help text in status bar when focus set on control
Dim oEvent As Object, ocControl As Object, sHelp As String
On Error Resume Next ' Never display an error message in a "When receiving focus" event or you might have to kill AOO/LibO !!
Set oEvent = Application.Events(poEvent)
Set ocControl = oEvent.Source
sHelp = ocControl.ControlTipText
If Len(sHelp) > 0 Then Application.SysCmd(acSysCmdSetStatus, sHelp)
End Sub
//}}}</pre>
</div>
<div title="TabIndex" modifier="Jean-Pierre Ledure" created="201109251023" modified="201405291656" tags="Properties" changecount="1">
<pre>The //~TabIndex// property specifies a control's place in the tab order on a form or dialog.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~FixedText<br />~GroupBox<br />~HiddenControl<br />[[SubForm]]-- | None | All |A control on an open form or dialog |
!!!Syntax
//control//{{{.TabIndex}}}
//control//{{{.TabIndex}}} = //value//
!!!Returned values / Arguments
{{{Integer}}} or {{{Long}}}
!!!Remarks
The default {{{-1}}} is used to indicate that the tab-order of this control should be determined automatically.
!!!Error messages
|Property '~TabIndex' not applicable in this context |
|Value '...' is invalid for property '~TabIndex' |
!!!See also
[[TabStop]]
!!!Example
<<tiddler "TabIndex example">></pre>
</div>
<div title="TabIndex example" modifier="Jean-PierreLedure" created="201109251020" modified="201212151259" tags="[[Snippets of Code]]">
<pre>List all controls in ~TabIndex ascending sequence. Only initialized ~TabIndexes are included.
//{{{
Dim ofForm As Object, ocControl As Object, i As Integer, iCount As Integer
Dim sNames() As String
Set ofForm = Forms("myForm")
iCount = ofForm.Controls().Count
ReDim sNames(0 To iCount - 1)
For i = 0 To iCount - 1
Set ocControl = ofForm.Controls(i)
If ocControl.hasProperty("TABINDEX") Then
If ocControl.TabIndex > 0 And ocControl.TabIndex < iCount Then sNames(ocControl.TabIndex) = ocControl.Name
End If
Next i
For i = 0 To iCount - 1
If sNames(i) <> "" Then Print sNames(i),
Next i
Print
//}}}
Reset Tab sequence to automatic
//{{{
For i = 0 To iCount - 1
If sNames(i) <> "" Then
Set ocControl = ofForm.Controls(sNames(i))
ocControl.TabIndex = -1
End If
Next i
//}}}</pre>
</div>
<div title="TabStop" modifier="Jean-PierreLedure" created="201109241502" modified="201306151426" tags="Properties">
<pre>The //~TabStop// property specifies if the focus can be set on a control by using .the TAB key.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~FixedText<br />~GroupBox<br />~HiddenControl<br />[[SubForm]]-- | None | All except --~FixedLine<br />~GroupBox<br />~ProgressBar-- |A control on an open form or dialog |
!!!Syntax
//control//{{{.TabStop}}}
//control//{{{.TabStop}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
!!!Error messages
|Property '~TabStop' not applicable in this context |
|Value '...' is invalid for property '~TabStop' |
!!!See also
[[TabIndex]]
!!!Example
<<tiddler "TabStop example">></pre>
</div>
<div title="TabStop example" modifier="Jean-PierreLedure" created="201109241508" modified="201212151307" tags="[[Snippets of Code]]">
<pre>List all controls having ~TabStop = True
//{{{
Dim ofForm As Object, ocControl As Object, i As Integer
Set ofForm = Forms("myForm")
For i = 0 To ofForm.Controls().Count - 1
Set ocControl = ofForm.Controls(i)
If ocControl.hasProperty("TABSTOP") Then
If ocControl.TabStop Then Print ocControl.Name,
End If
Next i
Print
//}}}
Forbid access to myControl via Tab key
//{{{
Set ocControl = ofForm.Controls("myControl")
ocControl.TabStop = False
//}}}</pre>
</div>
<div title="TableDef" modifier="Jean-Pierre Ledure" created="201306141553" modified="201602271435" tags="Objects" changecount="6">
<pre>{{firstletter{
@@color:#930;A@@
}}}//~TableDef// [[object|Object Model]] describes one of the Tables located in the database document (".odb" file).
!!!Function returning a //~TableDef// object
| !Parent object | !Function | !Type | !Argument |!Description |
|[[Database]] |[[TableDefs]] | [[Collection]] | Integer or String |{{{Application.CurrentDb().TableDefs("myTable")}}} returns an object corresponding with the {{{myTable}}} table |
!!!Properties
| !Property | !Type | !Read only | !Description or UNO object |
|[[Name]] || Y |Specifies the exact name of the table |
|[[ObjectType]] || Y |Returns "TABLEDEF" |
|Table | UNO | Y |com.sun.star.sdb.dbaccess.~ODBTable |
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[Fields]] | None<br />Index<br />Name | [[Collection]] |Return the collection of the fields belonging to the table. |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the //~TableDef// has the given property. |
|[[OpenRecordset]] | options | [[Recordset]] |Return a recordset object allowing access to the table data. |
!!!Remarks
A table //name// might consist in up to 3 components separated by a dot (".") character :
*A //catalog// name
*A //schema// name
*A //table// name
The first two components are optional:
//{{{
[[catalogname.]schemaname.]tablename
//}}}
The presence of one or two optional components is determined by the Relational ~DataBase Management System (RDBMS) in usage.
HSQLDB will not require more than the //tablename//. ~MySQL will require at least the //schemaname//.
Scrolling thru the [[TableDefs]] collection - see the example below - can help identifying the required naming scheme.
!!!See also
[[QueryDef]]
!!!Examples
<<tiddler "Datadef example">></pre>
</div>
<div title="TableDefs" modifier="Jean-Pierre Ledure" created="201306081241" modified="201405241131" tags="Collections" changecount="1">
<pre>The //~TableDefs// collection describes instances of all __tables__ present in the related database.
!!!Syntax
{{{database.TableDefs()}}}
{{{database.TableDefs(index)}}}
{{{database.TableDefs(tablename)}}}
| !Object | !Type | !Argument | !Type |!Returned value |
|database |[[Database object|Database]] | absent ||A [[Collection]] object |
|~|~| index | integer<br>long |A [[TableDef]] object corresponding to the index-th item in the ~TableDefs() collection. The 1st table is ~TableDefs(0), the 2nd is ~TableDefs(1) and so on ... The last one is ~TableDefs.Count - 1.|
|~|~| tablename | string |A [[TableDef]] object having the argument as name. The argument is NOT case-sensitive.|
!!!Methods
| !Method | !Description |
|[[Add]] |Finalize the creation of a new //~TableDef// initiated with [[CreateTableDef]]. |
|[[Delete|Delete (table-query)]]|Delete an existing //~TableDef//. |
!!!Remarks
The //tablename// argument is not case sensitive.
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range or incorrect array size for collection ~TableDefs() |
|Table '...' not found |
!!!See also ...
[[CreateTableDef]]
[[QueryDefs]]
[[Recordsets]]
!!!Example
<<tiddler "Datadef example">>
</pre>
</div>
<div title="Tag" modifier="Jean-PierreLedure" created="201112251434" modified="201306151426" tags="Properties">
<pre>The //Tag// property stores extra information about a [[Control]].
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |All except<br />--~SubForm<br />-- | All | All |A control on an open form or dialog |
!!!Syntax
//control//{{{.Tag}}}
//control//{{{.Tag}}} = //value//
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
You can use this property to assign an identification string to a control without affecting any of its other property settings or causing other side effects. The //Tag// property is useful when you need to check the identity of a control that is passed as a variable to a procedure.
!!!Error messages
|Value '...' is invalid for property 'Tag' |
!!!See also
[[OpenArgs]]
!!!Example
<<tiddler "Tag example">></pre>
</div>
<div title="Tag example" modifier="Jean-PierreLedure" created="201112251456" modified="201212151311" tags="[[Snippets of Code]]">
<pre>Associate a tag value to a control
//{{{
Dim ofForm As Object, ocControl As Object, sTag As String
sTag = "This is an informative message"
Set ofForm = Forms("myForm")
Set ocControl = ofForm.Controls("myControl")
ocControl.Tag = sTag
//}}}
Usage: f.i. displaying the tag content in a info textbox when the control receives the focus
</pre>
</div>
<div title="TagsTreePlugin" modifier="Jean-Pierre Ledure" created="201106250920" modified="201108061630" tags="systemConfig excludeLists">
<pre>/***
|''Name:''|TagsTreePlugin|
|''Description:''|Displays tags hierachy as a tree of tagged tiddlers.<br>Can be used to create dynamic outline navigation.|
|''Version:''|1.0.1|
|''Date:''|Jan 04,2008|
|''Source:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Author:''|Pascal Collin|
|''License:''|[[BSD open source license|License]]|
|''~CoreVersion:''|2.1.0|
|''Browser:''|Firefox 2.0; InternetExplorer 6.0|
!Demo
On the plugin [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] :
*Try to tag some <<newTiddler>> with a tag displayed in the menu and edit MainMenu.
*Look at some tags like [[Plugins]] or [[menu]].
!Installation
#import the plugin,
#save and reload,
#optionally, edit TagsTreeStyleSheet.
! Usage
{{{<<tagsTree>>}}} macro accepts the following //optional// parameters.
|!#|!parameter|!description|!by default|
|1|{{{root}}}|Uses {{{root}}} tag as tree root|- In a //tiddler// content or template : uses the tiddler as root tag.<br>- In the //page// content or template (by ex MainMenu) : displays all untagged tags.|
|2|{{{excludeTag}}}|Excludes all such tagged tiddlers from the tree|Uses default excludeLists tag|
|3|{{{level}}}|Expands nodes until level {{{level}}}.<br>Value {{{0}}} hides expand/collapse buttons.|Nodes are collapsed on first level|
|4|{{{depth}}}|Hierachy depth|6 levels depth (H1 to H6 header styles)|
|5|{{{sortField}}}|Alternate sort field. By example : "index".|Sorts tags and tiddlers alphabetically (on their title)|
|6|{{{labelField}}}|Alertnate label field. By example : "label".|Displays tiddler's title|
!Useful addons
*[[FieldsEditorPlugin]] : //create//, //edit//, //view// and //delete// commands in toolbar <<toolbar fields>>.
*[[TaggerPlugin]] : Provides a drop down listing current tiddler tags, and allowing toggling of tags.
!Advanced Users
You can change the global defaults for TagsTreePlugin, like default {{{level}}} value or level styles, by editing or overriding the first config.macros.tagsTree attributes below.
!Code
***/
//{{{
config.macros.tagsTree = {
expand : "+",
collapse : "–",
depth : 6,
level : 1,
sortField : "",
labelField : "",
styles : ["h1","h2","h3","h4","h5","h6"],
trees : {}
}
config.macros.tagsTree.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var root = params[0] ? params[0] : (tiddler ? tiddler.title : null);
var excludeTag = params[1] ? params[1] : "excludeTagsTree";
var level = params[2] ? params[2] : config.macros.tagsTree.level;
var depth = params[3] ? params[3] : config.macros.tagsTree.depth;
var sortField = params[4] ? params[4] : config.macros.tagsTree.sortField;
var labelField = params[5] ? params[5] : config.macros.tagsTree.labelField;
var showButtons = (level>0);
var id = config.macros.tagsTree.getId(place);
if (config.macros.tagsTree.trees[id]==undefined) config.macros.tagsTree.trees[id]={};
config.macros.tagsTree.createSubTree(place,id,root,excludeTag,[],level>0 ? level : 1,depth, sortField, labelField,showButtons);
}
config.macros.tagsTree.createSubTree = function(place, id, root, excludeTag, ancestors, level, depth, sortField, labelField,showButtons){
var childNodes = root ? this.getChildNodes(root, ancestors) : this.getRootTags(excludeTag);
var isOpen = (level>0) || (!showButtons);
if (root && this.trees[id][root]!=undefined) isOpen = this.trees[id][root];
if (root && ancestors.length) {
var t = store.getTiddler(root);
if (childNodes.length && depth>0) {
var wrapper = createTiddlyElement(place , this.styles[Math.min(Math.max(ancestors.length,1),6)-1],null,"branch");
if (showButtons) {
b = createTiddlyButton(wrapper, isOpen ? config.macros.tagsTree.collapse : config.macros.tagsTree.expand, null, config.macros.tagsTree.onClick);
b.setAttribute("treeId",id);
b.setAttribute("tiddler",root);
}
createTiddlyText(createTiddlyLink(wrapper, root),t&&labelField ? t.fields[labelField] ? t.fields[labelField] : root : root);
}
else
createTiddlyText(createTiddlyLink(place, root,false,"leaf"),t&&labelField ? t.fields[labelField] ? t.fields[labelField] : root : root);
}
if (childNodes.length && depth) {
var d = createTiddlyElement(place,"div",null,"subtree");
d.style.display= isOpen ? "block" : "none";
if (sortField)
childNodes.sort(function(a, b){
var fa=a.fields[sortField];
var fb=b.fields[sortField];
return (fa==undefined && fb==undefined) ? a.title < b.title ? -1 : a.title > b.title ? 1 : 0 : (fa==undefined && fb!=undefined) ? 1 :(fa!=undefined && fb==undefined) ? -1 : fa < fb ? -1 : fa > fb ? 1 : 0;
})
for (var cpt=0; cpt<childNodes.length; cpt++)
this.createSubTree(d, id, childNodes[cpt].title, excludeTag, ancestors.concat(root), level-1, depth-1, sortField, labelField, showButtons);
}
}
config.macros.tagsTree.onClick = function(e){
var id = this.getAttribute("treeId");
var tiddler = this.getAttribute("tiddler");
var n = this.parentNode.nextSibling;
var isOpen = n.style.display != "none";
if(config.options.chkAnimate && anim && typeof Slider == "function")
anim.startAnimating(new Slider(n,!isOpen,null,"none"));
else
n.style.display = isOpen ? "none" : "block";
this.firstChild.nodeValue = isOpen ? config.macros.tagsTree.expand : config.macros.tagsTree.collapse;
config.macros.tagsTree.trees[id][tiddler]=!isOpen;
return false;
}
config.macros.tagsTree.getChildNodes = function(root ,ancestors){
var childs = store.getTaggedTiddlers(root);
var result = new Array();
for (var cpt=0; cpt<childs.length; cpt++)
if (childs[cpt].title!=root && ancestors.indexOf(childs[cpt].title)==-1) result.push(childs[cpt]);
return result;
}
config.macros.tagsTree.getRootTags = function(excludeTag){
var tags = store.getTags(excludeTag);
tags.sort(function(a,b) {return a[0].toLowerCase() < b[0].toLowerCase() ? -1 : (a[0].toLowerCase() == b[0].toLowerCase() ? 0 : +1);});
var result = new Array();
for (var cpt=0; cpt<tags.length; cpt++) {
var t = store.getTiddler(tags[cpt][0]);
if (!t || t.tags.length==0) result.push(t ? t : {title:tags[cpt][0],fields:{}});
}
return result;
}
config.macros.tagsTree.getId = function(element){
while (!element.id && element.parentNode) element=element.parentNode;
return element.id ? element.id : "<html>";
}
config.shadowTiddlers.TagsTreeStyleSheet = "/*{{{*/\n";
config.shadowTiddlers.TagsTreeStyleSheet +=".leaf, .subtree {display:block; margin-left : 0.5em}\n";
config.shadowTiddlers.TagsTreeStyleSheet +=".subtree {margin-bottom:0.5em}\n";
config.shadowTiddlers.TagsTreeStyleSheet +="#mainMenu {text-align:left}\n";
config.shadowTiddlers.TagsTreeStyleSheet +=".branch .button {border:1px solid #DDD; color:#AAA;font-size:9px;padding:0 2px;margin-right:0.3em;vertical-align:middle;text-align:center;}\n";
config.shadowTiddlers.TagsTreeStyleSheet +="/*}}}*/";
store.addNotification("TagsTreeStyleSheet", refreshStyles);
config.shadowTiddlers.MainMenu="<<tagsTree>>"
config.shadowTiddlers.PageTemplate = config.shadowTiddlers.PageTemplate.replace(/id='mainMenu' refresh='content' /,"id='mainMenu' refresh='content' force='true' ")
//}}}</pre>
</div>
<div title="TagsTreeStyleSheet" modifier="Jean-Pierre Ledure" created="201106251129" modified="201108061609" tags="excludeLists">
<pre>/*{{{*/
.leaf, .subtree {
display:block;
margin-left : 0.5em
}
.subtree {
margin-bottom:0.5em
}
#mainMenu {
text-align:left
}
.branch {
border:1px solid #DDD;
color:#AAA;
font-size:12px;
padding:0 2px;
margin-right:0.3em;
vertical-align:middle;
text-align:left;
}
.button {
border:1px solid #DDD;
font-size:12px;
padding:0 2px;
margin-right:0.7em;
vertical-align:
middle;
text-align:center;
}
/*}}}*/</pre>
</div>
<div title="TempVar" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201409271230" modified="201412201609" tags="Objects" changecount="8">
<pre>The //~TempVar// [[object|Object Model]] represents a persistent variable that can be used from any Basic macro as soon as the //~Access2Base// library has been loaded.
Each //~TempVar// is created the first time with the [[Add]] method applied on the [[TempVars]] collection. It can be removed at any time with the [[Remove]] or [[RemoveAll]] methods. Their scope is the whole //~LibO/AOO// session. They are very similar to Basic {{{Global}}} variables, except that they can be enumerated thru the TempVars collection and that their names can be managed as usual strings instead of being hardcoded.
!!!Functions returning a //~TempVar// object
| !Parent object | !Function | !Type | !Argument |!Description |
|[[Application]] |[[TempVars]] | [[Collection]] | Integer or String |{{{Application.TempVars("myVar")}}} returns an object corresponding with the {{{myVar}}} temporary variable. |
||[[getObject]] || String |{{{getObject("TempVars!myVar")}}} returns an object corresponding with the {{{myVar}}} variable. |
!!!Properties of the returned object
| !Property | !Type | !Description |
|[[Name]] | String |Returns the real name of the variable, i.e. the name used at its creation. |
|[[ObjectType]] | String |Returns "TEMPVAR" |
|[[Value]] | Variant |The value of the considered variable (might be any value that can be stored in a {{{Variant}}} including arrays or objects). |
!!!Syntax
//tempvar//{{{.Name}}}
//tempvar//{{{.Value}}}
//tempvar//{{{.Value = }}}//expression//
!!!Methods
| !Method | !Argument(s) | !Return | !Description |
|[[getProperty]] | property | Variant |Return the value of the given property. |
|[[hasProperty]] | property | Boolean |Return True if the ~TempVar object has the given property. |
!!!Remarks
!!!See also
[[TempVars]]
[[hasProperty]]
[[getProperty]]
[[setProperty]]
!!!Example
<<tiddler "Tempvar example">></pre>
</div>
<div title="TempVars" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201409271205" modified="201410061645" tags="Collections" changecount="12">
<pre>The //~TempVars// collection represents the collection of [[TempVar]] objects..
<<tiddler "ApplyApplication">>
!!!Syntax
{{{[Application.]TempVars()}}}
{{{[Application.]TempVars(index)}}}
{{{[Application.]TempVars(tempvarname)}}}
| !Argument #1 | !Type |!Returned value |
|| absent |A [[Collection]] object |
| index | integer<br>long |A [[TempVar]] object corresponding to the index-th item in the ~TempVars() collection. The 1st temporary var is ~TempVars(0), the 2nd is ~TempVars(1) and so on ... The last one is ~TempVars.Count - 1.|
| tempvarname | string |A [[TempVar]] object having the argument as name. The argument is NOT case-sensitive.|
!!!Methods
| !Method | !Description |
|[[Add]] |Use the //Add// method to create a //~TempVar// object. |
|[[Remove]] |Use the //Remove// method to delete a //~TempVar// object from the //~TempVars// collection. |
|[[RemoveAll]] |Use the //~RemoveAll// method to delete all //~TempVar// objects from the //~TempVars// collection. |
!!!Remarks
*The //tempvarname// argument is not case sensitive.
*A //~TempVar// object can be reached either from the //~TempVars// collection of by using the [[shortcut notation|ShortCut Notation]]
//{{{
getValue("TempVars!tempvarname")
//}}}
!!!Error messages
|Argument nr. 1 [Value = '...'] is invalid |
|Out of array range |
|Temporary variable '...' not found |
!!!See also ...
[[Add]]
[[getObject]]
[[getValue]]
[[Remove]]
[[RemoveAll]]
[[setValue]]
[[TempVar]]
!!!Examples
<<tiddler "Tempvar example">>
</pre>
</div>
<div title="Tempvar example" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201409271512" modified="201602131614" tags="[[Snippets of Code]]" changecount="4">
<pre>Set, get and remove temporary variables, enumerate their values
//{{{
Dim oVars As Object, i As Integer
Set oVars = TempVars()
oVars.RemoveAll() ' Empty the collection
oVars.Add("First",12345)
oVars.Add("Second","anything")
oVars.Add("Third","else")
oVars.Remove("SECOND")
oVars.Item("ThiRD").Value = "other value"
oVars.Add("Fourth","somethinG")
Print oVars.Count,
Print getValue("Tempvars!fourth"),
For i = 0 to oVars.Count - 1
Print oVars.Item(i).Value,
Next i
//}}}</pre>
</div>
<div title="Terminate" modifier="Jean-Pierre Ledure" created="201302021534" modified="201405241109" tags="Methods" changecount="1">
<pre>The //Terminate// method finalizes the specified [[dialog|Dialog]].
!!!Applies to ...
| !Object | !Description |
|[[Dialog]] |The representation of a Basic dialog |
!!!Syntax
//dialog//.{{{Terminate}}}
| !Returned value |
|//True// if success. |
!!!Remarks
The //Terminate// method makes the controls of the dialog unavailable to the programmer. The dialog must have been started with the [[Start]] method applied on the same dialog object.
!!!Error messages
|Dialog unknown |
|Dialog '...' not active |
!!!See also
[[AllDialogs]]
[[EndExecute]]
[[Execute|Execute (dialog)]]
[[Start]]
!!!Example
<<tiddler "Dialog example">></pre>
</div>
<div title="Text" modifier="YourName" created="201112251145" modified="201805251007" tags="Properties" changecount="2">
<pre>The //Text// property specifies the text displayed in a Control. This property is __read-only__.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |[[ComboBox]]<br />~DateField<br />~FileControl<br />~FormattedField<br />~PatternField<br />~TextField<br />~TimeField |[[ComboBox]]<br />~DateField<br />~FormattedField<br />~PatternField<br />~TextField<br />~TimeField |[[ComboBox]]<br />~DateField<br />~FileControl<br />~FormattedField<br />~PatternField<br />~TextField<br />~TimeField |A control on an open form or dialog |
!!!Syntax
//control//{{{.Text}}}
!!!Returned values
{{{String}}}
!!!Remarks
To set the text contained in a Control, use the [[Value]] or [[Caption]] properties.
!!!Error messages
|Property 'Text' not applicable in this context |
!!!See also
[[Caption]]
[[Value]]
!!!Example
<<tiddler "Text example">></pre>
</div>
<div title="Text example" modifier="Jean-PierreLedure" created="201112251356" modified="201212151314" tags="[[Snippets of Code]]">
<pre>Display the text as displayed in a DATEFIELD control (depends on the regional settings)
//{{{
Dim ofForm As Object, ocDate As Object, vValue As Variant, sText As String
Set ofForm = OpenForm("myForm")
ocDate = ofForm.Controls("myDateField")
sText = ocDate.Text
vValue = ocDate.Value
MsgBox sText & " - " & Day(vValue) & "/" & Month(vValue) & "/" & Year(vValue)
//}}}</pre>
</div>
<div title="TextAlign" modifier="Jean-PierreLedure" created="201108051643" modified="201306151427" tags="Properties">
<pre>The //~TextAlign// property specifies the text alignment in a Control.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] |~CheckBox<br />[[ComboBox]]<br />~CommandButton<br />~CurrencyField<br />~DateField<br />~FixedText<br />~FormattedField<br />[[ListBox]]<br />~NumericField<br />~PatternField<br />[[RadioButton]]<br />~TextField<br />~TimeField | All |~CheckBox<br />[[ComboBox]]<br />~CommandButton<br />~CurrencyField<br />~DateField<br />~FileControl<br />~FixedText<br />~FormattedField<br />[[ListBox]]<br />~NumericField<br />~PatternField<br />[[RadioButton]]<br />~TextField<br />~TimeField |A control on an open form or dialog |
!!!Syntax
//control//{{{.TextAlign}}}
//control//{{{.TextAlign = }}}//value//
!!!Returned values / Arguments
{{{Integer}}} or {{{Long}}}
!!!Remarks
The allowed values for ~TextAlign are:
>0: Left
>1: Center
>2: Right
!!!Error messages
|Property '~TextAlign' not applicable in this context |
|Value '...' is invalid for property '~TextAlign' |
!!!See also
[[FontBold]]
[[FontItalic]]
[[FontName]]
[[FontSize]]
[[FontUnderline]]
[[FontWeight]]
[[ForeColor]]
!!!Example
<<tiddler "Font example">></pre>
</div>
<div title="Thanks" modifier="YourName" created="201202181600" modified="201808101327" tags="NoTag" changecount="6">
<pre>Next people have directly or indirectly contributed to the birth and the success of the ~Access2Base API:
*''Bernard Marcelly'' because I would have abandoned the project without the existence of ~XRayTool, the inspector of API objects, See [[here|http://bernard.marcelly.perso.sfr.fr/index2.html]].
*''Jeremy Ruston'' who developed the remarkable personal wiki which served as template for the documentation of ~Access2Base. See [[TiddlyWiki, a reusable non-linear personal web notebook|http://www.tiddlywiki.com/]].
*''Andrew Pitonyak'' I found a number of promising examples in [[Base Macro programming|http://www.pitonyak.org/database/AndrewBase.pdf]].
*''Roberto Benitez'', his [[BaseTools|http://extensions.services.openoffice.org/en/project/BaseTools]] extension was a first step in the direction of the implementation of an ~MSAccess-like API. A few snippets in my code are inspired by his work.
*''DACM'', after a few database corruptions I was very happy to implement his recommendations found on the ~OpenOffice forum (see a.o. [[Avoid data loss by avoiding "Embedded databases"|http://user.services.openoffice.org/en/forum/viewtopic.php?p=162653#p162653]]) !!
*''Lionel Mamane'', who is my mentor and my sponsor inside the //~LibreOffice// developers community.
*''Iñigo Zuluaga'', who provides the spanish translation of what in the source code requires such a translation.
*''Gisbert Friege'', who provides the german translation since version 1.9.0.
Many thanks to all of them.</pre>
</div>
<div title="TiddlersBarPlugin" modifier="Jean-Pierre Ledure" created="201106250917" modified="201108071328" tags="systemConfig excludeLists">
<pre>/***
|''Name:''|TiddlersBarPlugin|
|''Description:''|A bar to switch between tiddlers through tabs (like browser tabs bar).|
|''Version:''|1.2.5|
|''Date:''|Jan 18,2008|
|''Source:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Author:''|Pascal Collin|
|''License:''|[[BSD open source license|License]]|
|''~CoreVersion:''|2.1.0|
|''Browser:''|Firefox 2.0; InternetExplorer 6.0, others|
!Demos
On [[homepage|http://visualtw.ouvaton.org/VisualTW.html]], open several tiddlers to use the tabs bar.
!Installation
#import this tiddler from [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] (tagged as systemConfig)
#save and reload
#''if you're using a custom [[PageTemplate]]'', add {{{<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>}}} before {{{<div id='tiddlerDisplay'></div>}}}
#optionally, adjust StyleSheetTiddlersBar
!Tips
*Doubleclick on the tiddlers bar (where there is no tab) create a new tiddler.
*Tabs include a button to close {{{x}}} or save {{{!}}} their tiddler.
*By default, click on the current tab close all others tiddlers.
!Configuration options
<<option chkDisableTabsBar>> Disable the tabs bar (to print, by example).
<<option chkHideTabsBarWhenSingleTab >> Automatically hide the tabs bar when only one tiddler is displayed.
<<option txtSelectedTiddlerTabButton>> ''selected'' tab command button.
<<option txtPreviousTabKey>> previous tab access key.
<<option txtNextTabKey>> next tab access key.
!Code
***/
//{{{
config.options.chkDisableTabsBar = config.options.chkDisableTabsBar ? config.options.chkDisableTabsBar : false;
config.options.chkHideTabsBarWhenSingleTab = config.options.chkHideTabsBarWhenSingleTab ? config.options.chkHideTabsBarWhenSingleTab : false;
config.options.txtSelectedTiddlerTabButton = config.options.txtSelectedTiddlerTabButton ? config.options.txtSelectedTiddlerTabButton : "closeOthers";
config.options.txtPreviousTabKey = config.options.txtPreviousTabKey ? config.options.txtPreviousTabKey : "";
config.options.txtNextTabKey = config.options.txtNextTabKey ? config.options.txtNextTabKey : "";
config.macros.tiddlersBar = {
tooltip : "see ",
tooltipClose : "click here to close this tab",
tooltipSave : "click here to save this tab",
promptRename : "Enter tiddler new name",
currentTiddler : "",
previousState : false,
previousKey : config.options.txtPreviousTabKey,
nextKey : config.options.txtNextTabKey,
tabsAnimationSource : null, //use document.getElementById("tiddlerDisplay") if you need animation on tab switching.
handler: function(place,macroName,params) {
var previous = null;
if (config.macros.tiddlersBar.isShown())
story.forEachTiddler(function(title,e){
if (title==config.macros.tiddlersBar.currentTiddler){
var d = createTiddlyElement(null,"span",null,"tab tabSelected");
config.macros.tiddlersBar.createActiveTabButton(d,title);
if (previous && config.macros.tiddlersBar.previousKey) previous.setAttribute("accessKey",config.macros.tiddlersBar.nextKey);
previous = "active";
}
else {
var d = createTiddlyElement(place,"span",null,"tab tabUnselected");
var btn = createTiddlyButton(d,title,config.macros.tiddlersBar.tooltip + title,config.macros.tiddlersBar.onSelectTab);
btn.setAttribute("tiddler", title);
if (previous=="active" && config.macros.tiddlersBar.nextKey) btn.setAttribute("accessKey",config.macros.tiddlersBar.previousKey);
previous=btn;
}
var isDirty =story.isDirty(title);
var c = createTiddlyButton(d,isDirty ?"!":"x",isDirty?config.macros.tiddlersBar.tooltipSave:config.macros.tiddlersBar.tooltipClose, isDirty ? config.macros.tiddlersBar.onTabSave : config.macros.tiddlersBar.onTabClose,"tabButton");
c.setAttribute("tiddler", title);
if (place.childNodes) {
place.insertBefore(document.createTextNode(" "),place.firstChild); // to allow break line here when many tiddlers are open
place.insertBefore(d,place.firstChild);
}
else place.appendChild(d);
})
},
refresh: function(place,params){
removeChildren(place);
config.macros.tiddlersBar.handler(place,"tiddlersBar",params);
if (config.macros.tiddlersBar.previousState!=config.macros.tiddlersBar.isShown()) {
story.refreshAllTiddlers();
if (config.macros.tiddlersBar.previousState) story.forEachTiddler(function(t,e){e.style.display="";});
config.macros.tiddlersBar.previousState = !config.macros.tiddlersBar.previousState;
}
},
isShown : function(){
if (config.options.chkDisableTabsBar) return false;
if (!config.options.chkHideTabsBarWhenSingleTab) return true;
var cpt=0;
story.forEachTiddler(function(){cpt++});
return (cpt>1);
},
selectNextTab : function(){ //used when the current tab is closed (to select another tab)
var previous="";
story.forEachTiddler(function(title){
if (!config.macros.tiddlersBar.currentTiddler) {
story.displayTiddler(null,title);
return;
}
if (title==config.macros.tiddlersBar.currentTiddler) {
if (previous) {
story.displayTiddler(null,previous);
return;
}
else config.macros.tiddlersBar.currentTiddler=""; // so next tab will be selected
}
else previous=title;
});
},
onSelectTab : function(e){
var t = this.getAttribute("tiddler");
if (t) story.displayTiddler(null,t);
return false;
},
onTabClose : function(e){
var t = this.getAttribute("tiddler");
if (t) {
if(story.hasChanges(t) && !readOnly) {
if(!confirm(config.commands.cancelTiddler.warning.format([t])))
return false;
}
story.closeTiddler(t);
}
return false;
},
onTabSave : function(e) {
var t = this.getAttribute("tiddler");
if (!e) e=window.event;
if (t) config.commands.saveTiddler.handler(e,null,t);
return false;
},
onSelectedTabButtonClick : function(event,src,title) {
var t = this.getAttribute("tiddler");
if (!event) event=window.event;
if (t && config.options.txtSelectedTiddlerTabButton && config.commands[config.options.txtSelectedTiddlerTabButton])
config.commands[config.options.txtSelectedTiddlerTabButton].handler(event, src, t);
return false;
},
onTiddlersBarAction: function(event) {
var source = event.target ? event.target.id : event.srcElement.id; // FF uses target and IE uses srcElement;
if (source=="tiddlersBar") story.displayTiddler(null,'New Tiddler',DEFAULT_EDIT_TEMPLATE,false,null,null);
},
createActiveTabButton : function(place,title) {
if (config.options.txtSelectedTiddlerTabButton && config.commands[config.options.txtSelectedTiddlerTabButton]) {
var btn = createTiddlyButton(place, title, config.commands[config.options.txtSelectedTiddlerTabButton].tooltip ,config.macros.tiddlersBar.onSelectedTabButtonClick);
btn.setAttribute("tiddler", title);
}
else
createTiddlyText(place,title);
}
}
story.coreCloseTiddler = story.coreCloseTiddler? story.coreCloseTiddler : story.closeTiddler;
story.coreDisplayTiddler = story.coreDisplayTiddler ? story.coreDisplayTiddler : story.displayTiddler;
story.closeTiddler = function(title,animate,unused) {
if (title==config.macros.tiddlersBar.currentTiddler)
config.macros.tiddlersBar.selectNextTab();
story.coreCloseTiddler(title,false,unused); //disable animation to get it closed before calling tiddlersBar.refresh
var e=document.getElementById("tiddlersBar");
if (e) config.macros.tiddlersBar.refresh(e,null);
}
story.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle){
story.coreDisplayTiddler(config.macros.tiddlersBar.tabsAnimationSource,tiddler,template,animate,unused,customFields,toggle);
var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler;
if (config.macros.tiddlersBar.isShown()) {
story.forEachTiddler(function(t,e){
if (t!=title) e.style.display="none";
else e.style.display="";
})
config.macros.tiddlersBar.currentTiddler=title;
}
var e=document.getElementById("tiddlersBar");
if (e) config.macros.tiddlersBar.refresh(e,null);
}
var coreRefreshPageTemplate = coreRefreshPageTemplate ? coreRefreshPageTemplate : refreshPageTemplate;
refreshPageTemplate = function(title) {
coreRefreshPageTemplate(title);
if (config.macros.tiddlersBar) config.macros.tiddlersBar.refresh(document.getElementById("tiddlersBar"));
}
ensureVisible=function (e) {return 0} //disable bottom scrolling (not useful now)
config.shadowTiddlers.StyleSheetTiddlersBar = "/*{{{*/\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar .button {border:0}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar .tab {white-space:nowrap}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar {padding : 1em 0.5em 2px 0.5em}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += ".tabUnselected .tabButton, .tabSelected .tabButton {padding : 0 2px 0 2px; margin: 0 0 0 4px;}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += ".tiddler, .tabContents {border:1px [[ColorPalette::TertiaryPale]] solid;}\n";
config.shadowTiddlers.StyleSheetTiddlersBar +="/*}}}*/";
store.addNotification("StyleSheetTiddlersBar", refreshStyles);
config.refreshers.none = function(){return true;}
config.shadowTiddlers.PageTemplate=config.shadowTiddlers.PageTemplate.replace(/<div id='tiddlerDisplay'><\/div>/m,"<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>\n<div id='tiddlerDisplay'></div>");
//}}}</pre>
</div>
<div title="TipTextForLongValues" modifier="Jean-PierreLedure" created="201212231438" modified="201308161214" tags="HowTo">
<pre>(Q) Some of the records in my database have values that are longer than the width of the bound control on the form. Is there a way I can display the complete text without requiring the user to click in the field and using arrow keys to read the value ?
(R) Form controls have a property called [[ControlTipText]] (what you see in the yellow tooltip popup if you place the mouse over a control for some time). This property can be easily used to display the complete value of the actual control itself.
!!!Solution
Fire next code from the //After record change// event of a form:
//{{{
Sub setTipText(poEvent As Object)
Dim ofForm As Object, ocControl As Object, i As Integer, sValue As String
Const cstMin = 10
Const cstMax = 200
Set ofForm = Events(poEvent).Source
For i = 0 To ofForm.Controls.Count - 1
Set ocControl = ofForm.Controls(i)
sValue = CStr(ocControl.Value)
If Len(sValue) > cstMin Then
If Len(sValue) > cstMax Then
ocControl.ControlTiptext = Left(sValue, cstMax)
Else
ocControl.ControlTiptext = sValue
End If
End If
Next i
End Sub
//}}}
You will have noted that the tip text is modified only if long enough and truncated if the value is too long.
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|~TipText |~Orders_Browse |After record change ||||</pre>
</div>
<div title="ToggleSideBarMacro" modifier="Jean-Pierre Ledure" created="201106251031" modified="201108061609" tags="systemConfig excludeLists">
<pre>/***
|Name|ToggleSideBarMacro|
|Created by|SaqImtiaz|
|Location|http://tw.lewcid.org/#ToggleSideBarMacro|
|Version|1.0|
|Requires|~TW2.x|
!Description:
Provides a button for toggling visibility of the SideBar. You can choose whether the SideBar should initially be hidden or displayed.
!Demo
<<toggleSideBar "Toggle Sidebar">>
!Usage:
{{{<<toggleSideBar>>}}} <<toggleSideBar>>
additional options:
{{{<<toggleSideBar label tooltip show/hide>>}}} where:
label = custom label for the button,
tooltip = custom tooltip for the button,
show/hide = use one or the other, determines whether the sidebar is shown at first or not.
(default is to show the sidebar)
You can add it to your tiddler toolbar, your MainMenu, or where you like really.
If you are using a horizontal MainMenu and want the button to be right aligned, put the following in your StyleSheet:
{{{ .HideSideBarButton {float:right;} }}}
!History
*23-07-06: version 1.0: completely rewritten, now works with custom stylesheets too, and easier to customize start behaviour.
*20-07-06: version 0.11
*27-04-06: version 0.1: working.
!Code
***/
//{{{
config.macros.toggleSideBar={};
config.macros.toggleSideBar.settings={
styleHide : "#sidebar { display: none;}\n"+"#contentWrapper #displayArea { margin-right: 1em;}\n"+"",
styleShow : " ",
arrow1: "«",
arrow2: "»"
};
config.macros.toggleSideBar.handler=function (place,macroName,params,wikifier,paramString,tiddler)
{
var tooltip= params[1]||'toggle sidebar';
var mode = (params[2] && params[2]=="hide")? "hide":"show";
var arrow = (mode == "hide")? this.settings.arrow1:this.settings.arrow2;
var label= (params[0]&&params[0]!='.')?params[0]+" "+arrow:arrow;
var theBtn = createTiddlyButton(place,label,tooltip,this.onToggleSideBar,"button HideSideBarButton");
if (mode == "hide")
{
(document.getElementById("sidebar")).setAttribute("toggle","hide");
setStylesheet(this.settings.styleHide,"ToggleSideBarStyles");
}
};
config.macros.toggleSideBar.onToggleSideBar = function(){
var sidebar = document.getElementById("sidebar");
var settings = config.macros.toggleSideBar.settings;
if (sidebar.getAttribute("toggle")=='hide')
{
setStylesheet(settings.styleShow,"ToggleSideBarStyles");
sidebar.setAttribute("toggle","show");
this.firstChild.data= (this.firstChild.data).replace(settings.arrow1,settings.arrow2);
}
else
{
setStylesheet(settings.styleHide,"ToggleSideBarStyles");
sidebar.setAttribute("toggle","hide");
this.firstChild.data= (this.firstChild.data).replace(settings.arrow2,settings.arrow1);
}
return false;
}
setStylesheet(".HideSideBarButton .button {font-weight:bold; padding: 0 5px;}\n","ToggleSideBarButtonStyles");
//}}}</pre>
</div>
<div title="ToolbarCommands" modifier="Jean-Pierre Ledure" created="201107210816" modified="201108061610" tags="excludeLists">
<pre>|~ViewToolbar|closeTiddler closeOthers +editTiddler > permalink references|
|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|</pre>
</div>
<div title="TooltipText" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201507251404" changecount="1">
<pre>The //~TooltipText// property specifies the text that appears in a ~ScreenTip when you hold the mouse pointer over a toolbar control.
!!!Applies to ...
| !Object |!Description |
|[[CommandBarControl]] |A control belonging to a CommandBar. |
!!!Syntax
//commandbarcontrol//{{{.TooltipText}}}
//commanbarcontrol//{{{.TooltipText}}} = //value//{{{)}}}
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
!!!Error messages
|Property '~TooltipText' not applicable in this context |
|Value '...' is invalid for property '~TooltipText' |
!!!See also
[[CommandBar]]
[[CommandBarControl]]
!!!Example
<<tiddler "CommandBarControl example">></pre>
</div>
<div title="TraceConsole" modifier="Jean-Pierre Ledure" created="201108071418" modified="201405221357" tags="[[Error handling]]" changecount="4">
<pre>!!!Role
Display a dialog box for error handling settings and registered errors viewing. This routine is typically called from a button or a menu item.
[img[tracelog dialog.png]]
!!!Syntax
~TraceConsole has no arguments.
{{{TraceConsole()}}}
!!!User interface
| !Control | !Description |
|Clear the list |All the entries are erased from the list. |
|Set minimal trace level |All the calls for logging an event (TraceLog) having a level below the indicated level are ignored. |
|Set max number of entries |Determines the size of the circular buffer containing the logged events. When changed the existing list is always erased. |
|Dump to file |Open a File Save As ... window to save all the current entries in APPEND mode to a text file. |
!!!Remarks
When //~Access2Base// has been installed as an extension the //~TraceConsole// function can be activated by executing, when in the Basic IDE, next menu command:
>{{{Tools + Add-Ons + Access2Base Console ...}}}.
!!!See also
[[DebugPrint]]
[[Error Handler]]
[[TraceError]]
[[TraceLevel]]
[[TraceLog]]</pre>
</div>
<div title="TraceError" modifier="Jean-Pierre Ledure" created="201108071458" modified="201405221547" tags="[[Error handling]]" changecount="1">
<pre>!!!Role
Manages errors:
- registers the error in the error logging circular buffer
- informs the end-user
- stops the program or continues
!!!Syntax
{{{TraceError(TraceLevel, ErrorCode, ErrorProcedure, ErrorLine)}}}
!!!Arguments
| !Argument | !Type | !Description |
|~TraceLevel | String |The level of the occurred event. See [[error handling generalities|Error Handler]] for more details.<br />The call to ~TraceError is __ignored__ if the given level is lower than the current minimal trace level. |
|~ErrorCode | Integer |The numeric code of the error. Normally the output of the AOO/~LibO Basic {{{Err}}} function. |
|~ErrorProcedure | String |The name of the procedure where the error occurred. |
|~ErrorLine | Integer |The line number where the error occurred. Normally the output of the AOO/~LibO Basic {{{Erl}}} function. |
!!!See also
[[DebugPrint]]
[[Error Handler]]
[[TraceConsole]]
[[TraceLevel]]
[[TraceLog]]
!!!Example
<<tiddler "TraceError example">></pre>
</div>
<div title="TraceError example" modifier="Jean-Pierre Ledure" created="201108071523" modified="201408011524" tags="[[Snippets of Code]]" changecount="1">
<pre>Trap an error:
//{{{
Function ShowError()
On Local Error Goto Error_Function
Dim i As Integer, j As Integer
i = 10
j = i / 0
REM ...
Exit_Function:
Exit Function
Error_Function:
TraceError("ERROR", Err, "ShowError", Erl)
Goto Exit_Function
End Function ' ShowError
//}}}
The execution of
>{{{ShowError()}}}
will result in the display of next message to the user:
[img[traceerror msgbox.png]]</pre>
</div>
<div title="TraceLevel" modifier="Jean-Pierre Ledure" created="201301251653" modified="201408031009" tags="[[Error handling]]" changecount="2">
<pre>!!!Role
Set the minimal level as from which an error should be logged in the circular buffer managed by the [[Access2Base error handler|Error Handler]].
!!!Syntax
{{{Call TraceLevel(newTraceLevel)}}}
!!!Argument
| !newTraceLevel | !Type |!Description |
|"DEBUG" | String |To report values of variables during the program execution. The report is NOT user visible. |
|"INFO" |~|To report any event |
|"WARNING" |~|To report some abnormal event. |
|"ERROR" |~|To report an error trapped by a user program. |
|"FATAL" |~|To report an error detected by ~Access2Base (f.i. "Form does not exist ..." etc.). |
|"ABORT" |~|To report an error inside the ~Access2Base API itself. Do not use for programmer or user errors. |
!!!Remark
When the argument is absent, or equal to space, the minimal error level is reset to its default, i.e. {{{"ERROR"}}}. If the provided argument is different from the above list, the program execution continues without interruption.
!!!See also
[[DebugPrint]]
[[Error Handler]]
[[TraceConsole]]
[[TraceError]]
[[TraceLog]]</pre>
</div>
<div title="TraceLog" modifier="Jean-Pierre Ledure" created="201108071427" modified="201405221547" tags="[[Error handling]]" changecount="1">
<pre>!!!Role
Registers in the Traces circular buffer a new entry.
!!!Syntax
{{{TraceLog(TraceLevel, Text, [MessageBox])}}}
!!!Arguments
| !Argument | !Type | !Default | !Description |
|~TraceLevel | String ||The level of the occurred event. See [[error handling generalities|Error Handler]] for more details.<br />The call to //~TraceLog// is __ignored__ if the given level is lower than the current minimal trace level. |
|Text | String ||Text to be recorded. |
|~MessageBox | Boolean | True |Indicates if the Text must also be displayed to the user in a message box. |
!!!See also
[[DebugPrint]]
[[Error Handler]]
[[TraceConsole]]
[[TraceError]]
[[TraceLevel]]
!!!Example
<<tiddler "TraceLog example">></pre>
</div>
<div title="TraceLog example" modifier="Jean-Pierre Ledure" created="201108071451" modified="201408011524" tags="[[Snippets of Code]]" changecount="1">
<pre>~TraceLog some information
//{{{
TraceLog("WARNING", "You should be more careful !!")
//}}}
Next message will be displayed to the user if the current minimal trace level is at least "WARNING".
[img[tracelog msgbox.png]]</pre>
</div>
<div title="TripleState" modifier="Jean-Pierre Ledure" created="201112271539" modified="201405291700" tags="Properties" changecount="1">
<pre>The //~TripleState// property specifies how a check box will display {{{Null}}} values.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Control]] | ~CheckBox | ~CheckBox | ~CheckBox |A control on an open form, dialog or ~GridControl. |
!!!Syntax
//control//{{{.TripleState}}}
//control//{{{.TripleState}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
The ~TripleState property uses the following settings:
|True |The control will cycle through states for Yes, No, and Null values. The control appears dimmed (grayed) when its Value property is set to Null. |
|False (Default) |The control will cycle through states for Yes and No values. Null values display as if they were No values. |
!!!Error messages
|Property '~TripleState' not applicable in this context |
|Value '...' is invalid for property '~TripleState' |
!!!Example
<<tiddler "Triplestate example">></pre>
</div>
<div title="Triplestate example" modifier="Jean-PierreLedure" created="201112271552" modified="201212151322" tags="[[Snippets of Code]]">
<pre>Identify if a checkbox accept Null values
//{{{
Dim ofForm As Object,ocControl As Object
Set ofForm = Forms("myform")
Set ocControl = ofForm.Controls("myChkBox")
MsgBox ocControl.TripleState
//}}}</pre>
</div>
<div title="Tutorial" modifier="YourName" created="201205010526" modified="201802071424" tags="HowTo" changecount="19">
<pre>Consider the list below as a set of examples you should browse thru depending on your needs, more than a tutorial to read from top to bottom.
!!Optionally, download and install the examples
(Almost) all examples below require a prior installation of the __last version__ of //~Access2Base// to run satisfactorily.
Most examples have been implemented in a database that can be ''downloaded [[HERE|http://www.access2base.com/_howtos/TT NorthWind.zip]].''
Note that the database has been designed to illustrate the individual examples not to be a fully functional application. The data has been converted from the well-known //~NorthWind// database for Microsoft Access.
Additionally, everyone will understand that ...
>The attached code is distributed in the hope that it will be useful,
>but WITHOUT ANY WARRANTY; without even the implied warranty of
>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#Download the file.
#Unzip all the files in one single directory of your choice.
#//Open// one of next 3 files, allow the execution of macros and explore the proposed forms and code. All forms, queries, Basic code in those files refer to one or more of next examples.
##''"TT ~NorthWind.odb"'' Base file
##''"TT ~NorthWind ~StandAlone.odt"'' Writer file
##''"TT ~NorthWind Calc.ods"'' Calc file
!!Easy How to's
#[[Find out if a form is open|FindOutFormOpen]]
#[[Enumerate all controls on a form|EnumerateControls]]
#[[Find out if a table exists|FindOutTableExists]]
#[[Use Variables and Controls in SQL|UseVariablesInSQL]]
#[[Create a recordset from a table, a query or a form|CreateRecordsetFrom]]
#[[Add a record to a recordset|AddRecordToRecordset]]
#[[Count the number of records in a recordset|CountRecordsRecordset]]
#[[Detect the limits of recordset|LimitsRecordset]]
!!Generalities
#[[Mix Access2Base and UNO objects in the same code|MixAccess2baseAndUNO]]
#[[Manipulate the database window|DatabaseWindow]]
#[[More about the shortcut notation|ShortcutNotationMore]]
#[[DLookup usage samples|DLookupSamples]]
!!About Forms
#[[Simulate calculated fields|CalculatedField]]
#[[Use a (Multi-select) listbox to select the data displayed in a form|MultiSelectListboxSelectForm]]
#[[Fill Fields automatically on form based on a control's value|FillAutoControlValue]]
#[[Carry current value of a control to new records|CarryToNewRecord]]
#[[Browse recursively thru all controls of a form/subform|BrowseThruControls]]
#[[Use ControlTipText to display textbox value|TipTextForLongValues]]
#[[Ask before saving record|AskBeforeSaving]]
#[[Limit content of combo/list boxes|Sync2Combos]]
#[[Zoom on image|ZoomOnImage]]
#[[Adding "All" to a list- or combobox|AddAllToBox]]
#[[Keep several linked forms synchronized|KeepFormsSynchro]]
#[[Simulate a Google search box|SelectListboxOnFirstLetters]]
#[[Moving items between 2 listboxes with >, >>, < and << buttons|MoveItemsBetweenListboxes]]
#[[Simulate a tabbed interface in a form|SimulateTabbed]]
!!About standalone forms
#[[Search a character string thru all the records|SearchStandalone]]
!!About dialogs
#[[Insert a calculator in the user interface|CalculatorDialog]]
!!About tables, queries and recordsets
#[[Explore tables and fields|ExploreTables]]
#[[Extract data from a database table|ExtractDataTable]]
#[[Find the position of the current record of a recordset|FindPositionRecordset]]
#[[Design a generic DMedian function|DMedian function]]
#[[Compute the value corresponding with a given percentile|DPercentile]]
#[[Import images in the database|ImportImages]]
#[[Export images from the database to the file system|ExportImages]]
#[[CrossTab queries|CrossTabQuery]]
#[[Access data dynamically from a Calc spreadsheet|DbaccessFromCalc]]
#[[Output table or query to html - styling examples|OutputToStyling]]</pre>
</div>
<div title="Type" modifier="Jean-Pierre Ledure" created="201306221245" modified="201612181050" tags="Properties" changecount="5">
<pre>The //Type// property specifies the type of a [[query|QueryDef]], a [[commandbarcontrol|CommandBarControl]] or a [[Basic module|Module].
!!!Applies to ...
| !Object |!Description |
|[[QueryDef]] |A stored query definition. |
|[[CommandBarControl]] |An element of a [[CommandBar]]. |
|[[Module]] |A Basic script. |
!!!Syntax and returned values
| !Syntax |!Returned value |>|
|//querydef//{{{.pType}}} |dbQAction |A query that copies or changes data. Action queries include append, delete, make-table, and update queries. Delete and update queries change existing data; append and make-table queries copy existing data. In contrast, select queries return data records. An SQL pass-through query may also be an action query. |
|~|dbQAppend |An action query that adds new records to the end of an existing table or query. Append queries don't return records (rows). |
|~|dbQDDL |An SQL query that can create, alter, or delete a table, or create or delete an index in a database. |
|~|dbQDelete |An action query that deletes a set of rows that match the criteria you specify. A delete query doesn’t return rows. |
|~|dbQMakeTable |An action query that creates a new table from the Recordset object of an existing query. |
|~|dbQSelect |A query that asks a question about the data stored in your tables and returns a Recordset object without changing the data. |
|~|dbQSetOperation |An select query that creates a Recordset object containing data from all specified records in two or more tables with any duplicate records removed. To include the duplicates, add the keyword ALL. <br />For instance, a union query of the Customers table and the Suppliers table results in a Recordset that contains all suppliers that are also customers. |
|~|dbQSQLPassThrough |An SQL query you use to send commands directly to the database (server). Pass-through queries are used to execute SQL queries and system-specific commands written by using SQL dialects known only to the server.<br />A pass-through query may or may not return records. |
|~|dbQUpdate |An action query that changes a set of records according to criteria you specify. An update query doesn’t return any records. |
|//commandbarcontrol//{{{.pType}}} |msoControlButton |The only supported value describing a command button. |
|//module//{{{.pType}}} |acClassModule |The specified module is a class module. |
|~|acStandardModule |The specified module is a susal, standard module. |
!!!Remarks
*The //Type// property is read-only.
*The values returned by the //Type// property applied to a query may be combined. In fact they are summed. For instance an update query is also an action query. The property will return in such case the value dbQAction + dbQUpdate.<br />To test a single value, use next construction:
//{{{
If (querydef.pType And dbQAction) <> 0 Then ... ' is an action query
//}}}
*You can incorporate next constant definitions in your own code if useful:
//{{{
Const dbQAction = 240
Const dbQAppend = 64
Const dbQDDL = 4
Const dbQDelete = 32
Const dbQMakeTable = 128
Const dbQSelect = 0
Const dbQSetOperation = 8
Const dbQSQLPassThrough = 1
Const dbQUpdate = 16
Const msoControlButton = 1
Const acClassModule = 1
Const acStandardModule = 0
//}}}
!!!Example
<<tiddler "Type example">></pre>
</div>
<div title="Type example" modifier="Jean-PierreLedure" created="201306221246" modified="201306221323" tags="[[Snippets of Code]]">
<pre>List all queries with type and sql statement
//{{{
Dim i As Integer, odbDatabase As Object, oQuery As Object
Set odbDatabase = Application.CurrentDb()
With odbDatabase
For i = 0 To .QueryDefs().Count - 1
Set oQuery = .QueryDefs(i)
DebugPrint oQuery.Name, oQuery.pType, oQuery.SQL
Next i
End With
//}}}</pre>
</div>
<div title="Update" modifier="Jean-PierreLedure" created="201307191402" modified="201307211502" tags="Methods">
<pre>Saves the contents of the edit buffer to an updatable [[Recordset object|Recordset]].
!!!Applies to ...
| !Object | !Description |
|[[Recordset]] |A set of records derived from a table, a query or an SQL statement. |
!!!Syntax
//recordset//{{{.Update()}}}
!!!Returned value
{{{True}}} if success.
!!!Remarks
*To edit a record, use the [[Edit method|Edit]] to copy the contents of the current record to the edit buffer. If you don't use //Edit// first, an error occurs when you use //Update// or attempt to change a field's value.
*To create a new record use the [[AddNew method|AddNew]].
*''Caution'' Changes to the current record are lost if:
**You use the //Edit// or //~AddNew// method, and then move to another record without first using //Update//.
**You use //Edit// or //~AddNew//, and then use //Edit// or //AddNew// again without first using Update.
**You set the [[Bookmark property|Bookmark]] to another record.
**You close the //Recordset// without first using //Update//.
**You cancel the //Edit// or //~AddNew// operation by using [[CancelUpdate]].
!!!Error Messages
|Recordset or field is not updatable |
|Current row has been deleted |
|Recordset update sequence error |
!!!See also
[[AddNew]]
[[CancelUpdate]]
[[Close|Close (method)]]
[[CloseAllRecordsets]]
[[DefaultValue]]
[[Edit]]
[[Update]]
[[Value|Value (field)]]
!!!Example
<<tiddler "AddNew example">>
<<tiddler "Edit example">></pre>
</div>
<div title="UseVariablesInSQL" modifier="Jean-Pierre Ledure" created="201212231335" modified="201602200940" tags="HowTo" changecount="9">
<pre>(Q) In code behind my form, I'm trying to reference the value contained in a control on my form in a SQL statement. But I'm not successful in doing this. I'm using the following syntax:
--{{{sSQL = "SELECT * FROM Employees WHERE [LastName] = myControl.Value"}}}--
What am I doing wrong??
(R) In order to reference values contained in form controls, you have to use the & operator and concatenate the results. The positioning of quotes is also important.
!!!Solution
*In an SQL statement query-, table- and fieldnames are surrounded with a special character which is __depending on the used Relational Database Management System__. When used in character strings whose SQL nature is recognizable (in [[form filtering|Filter]], in a [[RunSQL]] action, a [[RecordSource]] or [[ControlSource]] property, ...), //~Access2Base// will substitute the square brackets ([ ... ]) with the correct character.<br />In next examples the resulting SQL statement is assumed to be used for such a purpose, reason why it still contains square brackets.
*When the WHERE clause refers to a numeric field, it is sufficient to concatenate the SQL sentence and the value, like in:
//{{{
sSQL = "SELECT * FROM Employees WHERE [Age] >= " & myNumericControl.Value
//}}}
*A bit more complicated is the reference to a date field. Simplest is to use the ISO representation of a date '''~YYYY-MM-DD''' (between single quotes):
//{{{
Dim sDate As String
Const cstQuote = "'" ' Single quote
sDate = Format(myDateControl.Value), "YYYY-MM-DD")
sSQL = "SELECT * FROM Employees WHERE [BirthDate] = " & cstQuote & sDate & cstQuote
//}}}
*Similarly if the database field is of Date/Time type, the time should be added in the SQL statement. However the "time" control in the form is separated from the "date" one.
//{{{
Dim sDateTime As String
Const cstQuote = "'" ' Single quote
sDateTime = Format(myDateControl.Value + myTimeControl.Value, "YYYY-MM-DD HH:MM:SS")
sSQL = "SELECT * FROM Employees WHERE [BirthDateTime] = " & cstQuote & sDateTime & cstQuote
//}}}
*Finally for simple strings, it seems easy. Just surround them with single quotes. However, if the string itself is able to contain a single quote, it is safer to anticipate its doubling:
//{{{
Dim sName As String
Const cstQuote = "'" ' Single quote
sName = Join(Split(myCharControl.Value, cstQuote), cstQuote & cstQuote) ' Replace ' by ''
sSQL = "SELECT * FROM Employees WHERE [LastName] = " & cstQuote & sName & cstQuote
//}}}</pre>
</div>
<div title="User's Guide" modifier="Jean-Pierre Ledure" created="201106251151" modified="201611301003" tags="Menu" changecount="26">
<pre>{{firstletter{
@@color:#930;T@@
}}}he reader is assumed to have already a reasonable knowledge of //~LibO/AOO Basic// and of the //~LibO/AOO Basic// IDE. The knowledge of the //~LibreOffice/~OpenOffice UNO API// is not required. A basic knowledge of the //~MSAccess// object model is an advantage.
!DEFINITIONS
!!!What are objects ?
AOO/~LibO Basic is a rudimentary object-oriented language.
To stay close to the syntax of the //~MSAccess// object model the implementation of ~Access2Base has nevertheless been based on BASIC object classes. Their main characteristics are :
**Use of classes of types ''Form'', ''Subform'' or ''Control'', etc.
**In BASIC code using these classes, variables should be declared as being of type {{{Object}}}.
**''Property'' and ''method'' names are identical in //~MSAccess// and in //~Access2Base//. Note however that //~Access2Base// implements only a limited subset of the object model of //~MSAccess//. Note also that their semantics might differ from the original //~MSAccess// one. Read the current documentation carefully.
**Support of indirection and introspection for properties.
**2 ROOT objects: [[Application]] and [[DoCmd]].
**The [[CurrentDb]] method returns a [[Database]] object. It might be (and most often is ...) the database related to the only opened Base document (".odb") or any of the databases related to one of the [[standalone forms|Standalone Forms]] stored in a non-Base (Writer, Calc, ...) document.
!!!What are [[collections ?|Collection]]
**Their [[Count]] and [[Item]] properties
**Their [[Add]], [[Delete|Delete (table-query)]], [[Remove]] and [[RemoveAll]] methods
>''Here is the complete [[Object Model]]''
!FORMS, DIALOGS and CONTROLS
!!Introduction
*The [[AllForms]] collection - all forms
*The [[Forms]] collection - all active forms
*The [[AllDialogs]] collection - all available dialogs
*The [[Form]] object - one single active form
*The [[Dialog]] object - one single active dialog
*The [[Controls]] collection - all controls of an active form or dialog
*The [[Control]] object - one single control on an active form or dialog
!!Properties
*Form properties
**[[Name]]
**[[AllowAdditions]], [[AllowDeletions]], [[AllowEdits]] - is a form updatable ?
**[[RecordSource]], [[Filter]], [[FilterOn]], [[OrderBy]], [[OrderByOn]] - which data are queried and in which sequence ?
**[[Recordset|Recordset (property)]] - to query the same data programmatically
**[[IsLoaded]] - is the form active ?
**[[Caption]], [[Height]], [[Width]], [[Visible]] - how is the form formatted ?
**[[Bookmark]], [[CurrentRecord]] - how to identify the current record and go back to it afterwards, how to identify the current record number ?
**[[OpenArgs]]
**[[On ... form events|On (form event)]] - which routine is triggered when an event occurs ?
*Dialog properties
**[[Name]]
**[[IsLoaded]] - is the dialog active ?
**[[Caption]], [[Height]], [[Width]], [[Visible]] - how is the dialog formatted ?
*Control properties
**[[Name]]
**[[ControlType]], [[SubType]] - control typology ?
**[[BackColor]], [[BorderColor]], [[BorderStyle]], [[ControlTipText]]<br />[[FontBold]], [[FontItalic]], [[FontName]], [[FontSize]], [[FontUnderline]], [[FontWeight]], [[ForeColor]]<br />[[Format]], [[TextAlign]], [[Visible]], [[TripleState]]<br />[[Cancel]], [[Caption]], [[Default]]<br /> - how is the control's look & feel ?
**[[Page]] - define the set of controls of a dialog displayed page by page
**[[Enabled]], [[Locked]], [[Required]] - is the control read-only ... ?
**[[SelStart]], [[SelLength]] and [[SelText]] - what are the characters selected by the user, where is the insertion point in a textbox control ?
**[[DefaultValue]], [[Tag]], [[Text]], [[Value]], [[Picture]] - what is the content of the control ?
**[[TabIndex]], [[TabStop]] - what is the tab sequence of the control ?
**[[ControlSource]] - which data is linked to the control ?
**[[Parent]] - which object contains the control ?
**[[On ... control events|On (control event)]] - which routine is triggered when an event occurs ?
!!Methods
*[[Move]] - move and resize a form or dialog
*[[Refresh]], [[Requery]] - requery the underlying data of a form or a control
*[[SetFocus]] - set the cursor somewhere
*Manage dialogs with the [[Start]], [[Execute|Execute (dialog)]], [[EndExecute]] and [[Terminate]] methods
!!Special controls
!!!Subforms
*What is a [[subform|SubForm]] ?
*The [[form|Form (subform)]] property of a control
*Subform properties
**[[Name]]
**[[AllowAdditions]], [[AllowDeletions]], [[AllowEdits]] - is a subform updatable ?
**[[RecordSource]], [[Filter]], [[FilterOn]], [[OrderBy]], [[OrderByOn]] - which data are queried and in which sequence ?
**[[Recordset|Recordset (property)]] - to query the same data programmatically
**[[LinkChildFields]], [[LinkMasterFields]] - how is the subform related to its parent form ?
**[[Parent]] - which (other sub)form contains the subform ?
!!!Gridcontrols
*Tabular display of data via a [[gridcontrol|GridControl]]
*Use of the [[Controls]] collection to find the columns of a gridcontrol
!!!List- and Comboboxes
*What is a [[ListBox]] ? What is a [[ComboBox]] ?
*List- and combobox properties
**[[ItemData]], [[RowSource]], [[RowSourceType]] - which data in the box and where does it come from ?
**[[ListCount]], [[ListIndex]] - how long is the list and which item is currently selected ?
**[[MultiSelect]], [[Selected]] - how to manage multi-select listboxes ?
*Listbox methods
**[[AddItem]], [[RemoveItem]] - manage its content
!!!~OptionGroup and ~RadioButton controls
*How are [[OptionGroups|OptionGroup]] and [[RadioButtons|RadioButton]] related ?
*How many radio buttons in an options group ([[Count]])?
*The [[OptionGroup|OptionGroup (Method)]] method of a (sub)form
*The [[OptionValue]] property of a ~RadioButton
!!DATABASE ACCESS
!!!Info about the database
*The [[Name]] provides the file name of the Base document ("{{{xxx.odb}}}").
*The [[Connect]] property returns the connection string between the Base document and the effective database.
*The [[Version]] property describes the database system supporting the actual database and its version.
!!!Database tables
*Use of the [[TableDefs]] collection to access individual tables
*Each [[TableDef]] object represents a table
*When applied to the //~TableDefs// collection the [[CreateTableDef]] and [[Add]] methods create a new table in the database
*The [[Fields]] collection applied to a ~TableDef object gives access to each individual field of the concerned table
*The [[OpenRecordset]] method gives access to the individual records of the table
!!!Database queries
*Use of the [[QueryDefs]] collection to access individual queries
*Each [[QueryDef]] object represents a query
*The [[Fields]] collection applied to the ~QueryDef object gives access to each individual field of the concerned query
*The [[OpenRecordset]] method gives access to the individual records of the query
*The [[SQL]] property of the querydef allows getting and setting the SQL statement related to the query
!!!Access to the records in a table, a query or an arbitrary SQL statement
*Such a set of records is represented by a [[Recordset]] object
*A recordset object is created via the [[OpenRecordset]] method. A recordset can be explored forward or backward starting from its //current position//
*The individual fields of a recordset are accessed from its [[Fields]] collection
*Properties of a recordset
**[[RecordCount]] - know the total number of records in the recordset
**[[BOF and EOF|BOF, EOF]] - identify if the current position is //before the first// or //after the last// record
**[[AbsolutePosition]] - know or set the position of the current record
**[[Bookmarkable]] and [[Bookmark]] to remember the current record to prepare a later return to it
**[[Filter]] helps preparing to build a new recordset which will be a subset of the current one
*Methods of a recordset
**[[Move|Move (recordset)]], [[MoveFirst|Move (recordset)]], [[MoveLast|Move (recordset)]], [[MoveNext|Move (recordset)]], [[MovePrevious|Move (recordset)]] - navigate thru the recordset and set its new current record
**[[OpenRecordset]] - open a new recordset based on a preset [[Filter]]
**[[AddNew]], [[Edit]], [[Update]] and [[CancelUpdate]] - add new records or update the current record. With the [[EditMode]] property, know the current editing status
**[[GetRows]] - Read a set of records at once into an array.
**[[Close|Close (method)]] - closing a recordset after use is ''mandatory'' !
!!!Access to the individual fields of a table, a query or any recordset
*Such a set of fields is represented by a [[Fields]] collection of indivudual [[Field]] objects
*New fields can be added to a table thru the [[CreateField]] method.
*Properties of a field
**[[Name]] - the name of the field as given by the source SQL statement
**[[Description]] - to know the help text associated with a field when the table is listed in design view
**[[DataType]], [[DbType|DataType]], [[TypeName|DataType]] and [[Size]] - know the type of the field in the database and its size
**[[SourceTable]] and [[SourceField]] - identify the names of the underlying table and field
**[[DataUpdatable]] - know if that specific field may be updated
**[[DefaultValue]] - get or set the value that will be preset in new records
**[[Value|Value (field)]] - get the current value of the field or modify it
*Methods of a field (only for text and binary fields)
**[[WriteAllText]] and [[WriteAllBytes]] - export the content of a (text or binary) database field into a file identified by its name
**[[ReadAllText]] and [[ReadAllBytes]] - import the content of a (text or binary) file identified by its name directly into a database field
**[[GetChunk]] and [[AppendChunk]] - move the content of a binary field by chunks and store it by chunk into another binary field
!TEMPORARY VARIABLES
[[Temporary variables|TempVar]] are variables that can be created or removed at any time by any macro. They help passing values through macros or ~LibO/AOO applications sharing the same ~Access2Base API.
They are gathered in the [[TempVars]] collection.
Their value can be get or set with the [[Value]] property.
!INTROSPECTION
All objects have an [[ObjectType]] property
Specific methods are available to manage property //indirection// and property //introspection//.
*[[hasProperty]] determines if an object has a given property
*[[getProperty]] and [[setProperty]] help managing the values of properties
See also the [[Property]] object and the [[Properties|Properties (collection)]] collection.
!SHORTCUTS
A [[shortcut|ShortCut Notation]] is a character string designating unambiguously forms and controls. Next functions help managing them:
*[[getObject]] returns the corresponding object
*[[getValue]] and [[setValue]] get and set their properties
!ACTIONS
*[[OpenForm]], [[OpenTable]], [[OpenQuery]], [[OpenReport]], [[Close]] - open or close //~OpenOffice/~LibreOffice Base// objects
*[[CopyObject]] - copy tables and/or queries
*[[RunSQL]] - run action SQL statements
*[[OpenSQL]] - display the data related to a SELECT SQL statement
*[[FindRecord]], [[FindNext]] - search strings or values in gridcontrols
*[[GoToRecord]] - move back-and forward in form records
*[[ApplyFilter]], [[SetOrderBy]], [[ShowAllRecords]] - set or remove filters and sorting sequences
*[[GoToControl]] - move the focus to a control simply by its name
*[[SelectObject]], [[SetHiddenAttribute]], [[GetHiddenAttribute]] - browse thru open windows, hide them dynamically
*[[Maximize]], [[Minimize]], [[MoveSize]] - move and resize windows
*[[RunCommand]] - run //AOO/~LibO// menu commands
*[[RunApp]] - run an external application
*[[OutputTo]] - export data to a Calc spreadsheet, a text/csv (comma-separated-value) file or to a formatted html page
*[[SendObject]] - output a form in another format (PDF, ...) and send it as attachment of a mail
*[[Quit]] - quit the application
!DATABASE FUNCTIONS
*Search a single value with [[DLookup]]
*Make totals or similar computations with [[DSum]], [[DAvg]], [[DCount]], [[DMin and DMax|DMin, DMax]]
*Make use of statistical functions with the [[DStDev, DStDevP]], [[DVar and DVarP|DVar, DVarP]] functions
!ERROR HANDLING
*The [[Introduction about error handling|Error Handler]] - to read first
*[[TraceLevel]] sets the minimal level for error messages to be traced
*The [[TraceError]] function may be used by one's own Basic code
*[[TraceLog]] is for user messages or internal debugging information
*Use [[DebugPrint]] for debugging
*The logged information can be displayed by mean of [[TraceConsole]].
!EVENTS HANDLING
*The [[Introduction about event handling|Events Handler]] - to read first
*The [[Events]] collection of ...
*... the [[Event]] objects with their specific properties
</pre>
</div>
<div title="Value" modifier="Jean-Pierre Ledure" created="201110080936" modified="201409271423" tags="Properties" changecount="9">
<pre>The //Value// property specifies what is the current value of a [[Control]], an [[OptionGroup]], a [[TempVar]] or a [[Property]]
!!!Applies to ...
| !Object | !Type of control | !Type |!Remarks (not all control types are valid in //~GridControls// !) |
|[[Control]] |~CheckBox | Boolean<br />Integer<br />Long |Meaning:<br />0 = Not selected<br />1 = Selected<br />2 = Don't know<br />A checkbox also accepts boolean values {{{True/False}}}. |
|~|~CommandButton | Boolean |Always {{{False}}} except if button has a //Toggle// attribute and it is pressed in, then {{{True}}}. |
|~|[[ComboBox]]<br />[[ListBox]] | String<br />Numeric<br />Date |The {{{Value}}} property is {{{Null}}} for a multiselect ~ListBox control.<br />Type must be {{{String}}} for a Combo.<br />Otherwise the {{{Value}}} property always refers to the content of the __bound column__ (if it exists). |
|~|~CurrencyField<br />~NumericField<br />~ProgressBar<br />~ScrollBar<br />~SpinButton | Numeric |Determines the numeric value associated with the control.<br />The value associated with a ~ProgressBar, a ~ScrollBar or a ~SpinButton must be numeric and set between the minimum and maximum values preset when the control was designed. |
|~|~FormattedField | Numeric<br />String<br />Date<br />Boolean |A ~FormattedField most of the time contains a numeric value. However it also accepts, {{{Date}}}, {{{Boolean}}} or {{{String}}} values if they are compatible with the set format. |
|~|~DateField<br />~TimeField | Date<br />Long |The expected {{{Value}}} is of type {{{Date}}} for ~DateFields.<br />For ~TimeFields it is a numeric value of the form {{{HHMMSSCC}}} (the highest possible value is 23595999). |
|~|~FileControl<br />~HiddenControl<br />~PatternField<br />~TextField | String |The {{{string}}} contained in the control. |
|[[OptionGroup]]|| Integer |Specifies the currently selected [[RadioButton]]. The buttons are counted as 0, 1, ... from left to right and from top to bottom. |
|[[Property]]|~| Variant |Returns the property value. |
|[[TempVar]]|~| Variant |The //Value// of a //~TempVar// is normally a string or a numeric value. However this is not controlled by the API. Any {{{Variant}}} content will be accepted, including arrays or objects, without restriction. Use of objects should be handled by the programmer with care. |
!!!Syntax
//control//{{{.Value}}}
//control//{{{.Value}}} = //value//
//optiongroup//{{{.Value}}}
//optiongroup//{{{.Value}}} = //value//
//property//{{{.Value}}}
//tempvar//{{{.Value}}}
//tempvar//{{{.Value}}} = //value//
!!!Returned values / Arguments
{{{Variant}}} (see the remarks in the table above)
!!!Remarks
*The //Value// property returns always a single value. For multiselect [[ListBox]] controls the //Value// property returns a {{{Null}}}.
*The //Value// for a [[ListBox]] is the value of the ''bound field'', i.e. the value of the field in the underlying record in the database.
*If the control or the optiongroup is bound to a database field, changing the value in the control programmatically __''modifies''__ also __''the value in the database''__ accordingly.
*The //Value// of a //Property// is read-only.
!!!Error messages
|Property 'Value' not applicable in this context |
|Value '...' is invalid for property 'value' |
!!!See also
[[getValue]]
[[setValue]]
[[OptionGroup]]
!!!Example
<<tiddler "Value example">></pre>
</div>
<div title="Value (field)" modifier="Jean-Pierre Ledure" created="201307050940" modified="201603121407" tags="Properties" changecount="6">
<pre>The //Value// property specifies what is the current value of a [[Field]].
The setting or return value is a {{{Variant}}} data type that evaluates to a value appropriate for the data type, as specified by the [[type properties|DataType]] of the field.
!!!Applies to ...
| !Object | !Type of field | !Type of the //Value// property | !Comment |
|[[Field]] |com.sun.star.sdbc.~DataType.BIT<br />com.sun.star.sdbc.~DataType.BOOLEAN | vbBoolean ||
|~|com.sun.star.sdbc.~DataType.TINYINT | vbInteger |Ranging from −32768 to 32767, inclusive |
|~|com.sun.star.sdbc.~DataType.SMALLINT<br />com.sun.star.sdbc.~DataType.INTEGER | vbLong |Ranging from −2147483648 to 2147483647, inclusive |
|~|com.sun.star.sdbc.~DataType.BIGINT | vbBigInt |Ranging from −9223372036854775808 to 9223372036854775807, inclusive|
|~|com.sun.star.sdbc.~DataType.FLOAT | vbSingle |Absolute value ranging from 3.402823 x 10E38 to 1.401298 x 10E-45 |
|~|com.sun.star.sdbc.~DataType.REAL<br />com.sun.star.sdbc.~DataType.DOUBLE | vbDouble |Absolute value ranging from 1.79769313486232 x 10E308 to 4.94065645841247 x10E-324 |
|~|com.sun.star.sdbc.~DataType.NUMERIC<br />com.sun.star.sdbc.~DataType.DECIMAL | vbDouble<br />vbLong |//vbDouble// if non-integer value, //vbLong// otherwise. |
|~|com.sun.star.sdbc.~DataType.CHAR<br />com.sun.star.sdbc.~DataType.VARCHAR | vbString ||
|~|com.sun.star.sdbc.~DataType.LONGVARCHAR | vbString |Error if length > 64K.<br />To get a memo field exceeding the maximum length, use the [[WriteAllText]] method. |
|~|com.sun.star.sdbc.~DataType.DATE<br />com.sun.star.sdbc.~DataType.TIME<br />com.sun.star.sdbc.~DataType.TIMESTAMP | vbDate |Use the Basic built-in date functions to<br />- build the argument (f.i. //~DateSerial// and //~TimeSerial//)<br />- process the returned value (f.i. //~DatePart//) |
|~|com.sun.star.sdbc.~DataType.BINARY<br />com.sun.star.sdbc.~DataType.VARBINARY<br />com.sun.star.sdbc.~DataType.LONGVARBINARY | vbLong |The binary content of the field is returned under the form of an array of integer values, one by binary character.<br />The dimension of the array must not exceed 64,000. To get/set a binary field exceeding the maximum size, use the [[GetChunk]]/[[AppendChunk]] methods, or alternatively the [[WriteAllBytes]]/[[ReadAllBytes]] methods. |
|~|com.sun.star.sdbc.~DataType.CLOB | NA ||
|~|com.sun.star.sdbc.~DataType.BLOB | NA ||
!!!Syntax
//field//{{{.Value}}}
//field//{{{.Value}}} = //value//
!!!Returned values / Arguments
{{{Variant}}} (see the table above)
!!!Remarks
*If the database field contains {{{Null}}} the //Value// property will contain {{{Null}}} as well. To be tested with the {{{IsNull()}}} BASIC builtin function.
*To set the database field to {{{Null}}} set simply the //Value// property to {{{Null}}} as well.
*Setting the //Value// property will be rejected if either the [[AddNew]] or the [[Edit]] method has not been applied on the concerned [[Recordset]] first. The modifications will be applied when the [[Update]] Method is applied on the same //recordset// object. If the //Update// method is never applied, or if the [[CancelUpdate]] method is invoked instead, the database will not be impacted.
*If the field to update is numeric (TINYINT, SMALLINT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL) the //Value// property may be of any numeric type.
*Trying to __set the //Value// property__ in an inappropriate context (for example, the //Value// property of a //Field// object in the [[Fields collection|Fields]] of a [[TableDef object|TableDef]]) will cause an error.
*When the application is __getting the //Value// property__ in an erroneous context, the returned value will always be //empty// (to be tested in your code with the Basic {{{IsEmpty}}} builtin function).
*Next Basic type constants may be included in your own code, if relevant:
//{{{
REM VarType constants
Const vbEmpty = 0
Const vbNull = 1
Const vbInteger = 2
Const vbLong = 3
Const vbSingle = 4
Const vbDouble = 5
Const vbCurrency = 6
Const vbDate = 7
Const vbString = 8
Const vbObject = 9
Const vbBoolean = 11
Const vbVariant = 12
Const vbByte = 17
Const vbUShort = 18
Const vbULong = 19
Const vbBigint = 35
Const vbDecimal = 37
//}}}
!!!Error messages
|Property 'Value' not applicable in this context |
|Value '...' is invalid for property 'value' |
|Field length (...) exceeds maximum length. Use WriteAllText instead |
!!!See also
[[Value (controls)|Value]]
[[AppendChunk]]
[[GetChunk]]
[[ReadAllBytes]]
[[ReadAllText]]
[[WriteAllBytes]]
[[WriteAllText]]
!!!Example
<<tiddler "AddNew example">>
<<tiddler "Edit example">></pre>
</div>
<div title="Value example" modifier="Jean-PierreLedure" created="201110081231" modified="201212151334" tags="[[Snippets of Code]]">
<pre>Set new value in text field depending on value in combo box
//{{{
Dim ofForm As Object, ocCombo As Object, ocText As Object
Dim vDesc As Variant
Set ofForm = Forms("myForm")
Set ocCombo = ofForm.Controls("myComboBox")
vDesc = DLookup("DENOMINATION", "CATEGORIES", "[CODE CATEGORY]='" & ocCombo.Value & "'")
If Not IsNull(vDesc) Then
Set ocText = ofForm.Controls("myTextBox")
ocText.Value = vDesc
End If
//}}}
</pre>
</div>
<div title="Version" modifier="Jean-Pierre Ledure" created="201312261115" modified="201611111358" tags="Properties" changecount="9">
<pre>The //Version// property returns
* either ''~LibreOffice w.x.y.z'' or ''~OpenOffice w.x.y.z'' where w.x.y.z is the version number.
*or the name and version of the database engine, f.i. ''HSQL Database Engine 1.8.0''.
<<tiddler "ApplyApplication">>
or to ...
| !Object | !Description |
|[[Database]] |A database object returned by the [[CurrentDb]] or [[OpenDatabase]] methods. |
!!!Syntax
{{{[Application.]Version}}}
{{{database.Version}}}
!!!Returned values / Arguments
{{{String}}}
!!!Remarks
The //Version// property is read-only.
!!!Error messages
!!!See also
[[Connect]]
[[CurrentUser]]
[[ProductCode]]
!!!Example
<<tiddler "Identification example">></pre>
</div>
<div title="ViewTemplate" modifier="Jean-PierreLedure" created="201212311159" modified="201212311226" tags="excludeLists">
<pre><!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<div style='float:center;' macro='tiddler BookMarkTiddler'></div>
<!--}}}--></pre>
</div>
<div title="Visible" modifier="Jean-Pierre Ledure" created="201107191226" modified="201507121421" tags="Properties" changecount="2">
<pre>The //Visible// property specifies or determines if a //form//, //dialog// or a //control// in a form, subform or dialog, or if a //commandbar// or a //commandbarcontrol// in a commandbar, is hidden or visible.
!!!Applies to ...
| !Object | !Type when<br />in a form | !Type when<br />in a ~GridControl | !Type when<br />in a dialog |!Description |
|[[Form]] ||||An open form. |
|[[Dialog]] |~|~|~|An active dialog. |
|[[Control]] |All except<br />--~HiddenControl<br />[[SubForm]]-- | None | All |A control on an open form or dialog. |
|[[CommandBar]] ||||A toolbar. |
|[[CommandBarControl]] |~|~|~|An element of a toolbar. |
!!!Syntax
//form//{{{.Visible}}}
//form//{{{.Visible}}} = //value//
//dialog//{{{.Visible}}}
//dialog//{{{.Visible}}} = //value//
//control//{{{.Visible}}}
//control//{{{.Visible}}} = //value//
//commandbar//{{{.Visible}}}
//commandbar//{{{.Visible}}} = //value//
//commandbarcontrol//{{{.Visible}}}
//commandbarcontrol//{{{.Visible}}} = //value//
!!!Returned values / Arguments
{{{Boolean}}}
!!!Remarks
A [[subform|SubForm]] cannot be made hidden programmatically. Neither exists a tabbed interface for forms.
To simulate anyhow such a tabbed interface, one can store in the form several groups of controls by mean of subforms. To make visible one subform while hiding the other ones, have a look at the second example below.
A tabbed interface in [[dialogs|Dialog]] is easy to simulate thru the [[Page]] property.
!!!Error messages
|Form '...' is currently not open |
|Dialog '...' not active |
|Property 'Visible' not applicable in this context |
|Value '...' is invalid for property 'Visible' |
!!!Examples
<<tiddler "Visible example">></pre>
</div>
<div title="Visible example" modifier="YourName" created="201107191225" modified="201805151519" tags="[[Snippets of Code]]" changecount="2">
<pre>Hide a control on a form
//{{{
Dim ocControl As Object
Set ocControl = Controls("myForm", "myControl")
ocControl.Visible = False
//}}}
A subform cannot be made hidden; simulate it by hiding each of its controls
//{{{
Dim ofSubform As Object, ocControl As Object, i As Integer
Set ofSubform = getValue("Forms!myForm!mySubForm.Form")
For i = 0 To ofSubForm.Controls().Count - 1
Set ocControl = ofSubForm.Controls(i)
If ocControl.hasProperty("Visible") Then ocControl.Visible = False
Next i
//}}}</pre>
</div>
<div title="Why Access2Base ?" modifier="Jean-Pierre Ledure" created="201106251429" modified="201407111110" tags="Menu" changecount="3">
<pre>!!Observation:
{{firstletter{
@@color:#930;O@@
}}}penOffice/~LibreOffice Calc, Writer, Impress softwares have proved to be valid alternatives to their //~MSOffice// equivalents. __Base has obviously not reached the same success__
>''//~Access2Base// has simply the ambition to close a small part of the gap, i.e. provide a quite simple programming interface.''
If you compare
*The number of objects, constants, services, interfaces, methods, properties, enumerations in the whole ~OpenOffice/~LibreOffice API - including indeed also Calc, Writer, etc. - is about 20,000.
* The number of collections, objects, methods, properties, constants in the whole //~MSAccess// API - indeed only //~MSAccess// oriented - is about 1,600 including 800 constants.
you will admit that both softwares are functionally extremely rich but also that //~OpenOffice/~LibreOffice requires from an application developer undoubtedly a huge initial effort !//
AND ... can anyone tell me: __why should an application developer know and use the same API as the developer of the software itself ?__
Additionally
*Calc and Writer applications, in most cases, do not require any script programming
*Base, at the opposite, does require such __automation__ capacity __for most business or personal applications__. As a minimum to validate the entered data and avoid database corruption.
!!Conclusion => the 80/20 rule
>''Why not implement the few % of the //~MSAccess// API in //~OpenOffice/~LibreOffice// that cover 80% of the needs ?''
An inventory of the coverage by //~Access2Base// of the //~MSAccess// API has been done in the [[MSAccess coverage|MSAccessCoverage]] page.</pre>
</div>
<div title="Width" modifier="Jean-PierreLedure" created="201107171232" modified="201306151428" tags="Properties">
<pre>The //Width// property specifies the width of a form or a dialog.
!!!Applies to ...
| !Object |!Description |
|[[Form]] |An open form |
|[[Dialog]] |An active dialog |
!!!Syntax
//form//{{{.Width}}}
//form//{{{.Width = }}}//value//
//dialog//{{{.Width}}}
//dialog//{{{.Width = }}}//value//
!!!Returned values / Arguments
{{{Integer}}} or {{{Long}}}
!!!Remarks
!!!Error messages
|Form '...' is currently not open |
|Dialog '...' not active |
|Value '...' is invalid for property 'Width' |
!!!See also
[[Height]]
[[Maximize]]
[[Minimize]]
[[Move]]
!!!Example
<<tiddler "Height & Width example">></pre>
</div>
<div title="WriteAllBytes" modifier="Jean-PierreLedure" created="201307211418" modified="201307211500" tags="Methods">
<pre>The //~WriteAllBytes// method writes the content of a binary [[Field]] belonging to a [[Recordset]] to a file specified by its full name.
!!!Applies to ...
| !Object | !Type of field |
|[[Field]] |com.sun.star.sdbc.~DataType.BINARY<br />com.sun.star.sdbc.~DataType.VARBINARY<br />com.sun.star.sdbc.~DataType.LONGVARBINARY |
!!!Syntax
//field//{{{.WriteAllBytes(}}}//file//{{{)}}}
!!!Arguments
| !Argument | !Type | !Description |
| file | String |The full name, including the path, of the file you want to output the data to. |
!!!Remarks
The {{{file}}} argument may be expressed either in the (recommended) URL format (i.e. "{{{file:// ...}}}") or by using the operating system usual syntax (e.g. "{{{C:\...}}}" in Windows).
!!!Error messages
|Method '~WriteAllBytes' not applicable in this context |
|File access error on file '...' |
|Field is null or empty. Action rejected |
!!!See also
[[ReadAllBytes]]
[[ReadAllText]]
[[Value|Value (field)]]
[[WriteAllText]]
!!!Example
<<tiddler "WriteAllBytes example">></pre>
</div>
<div title="WriteAllBytes example" modifier="Jean-PierreLedure" created="201307211454" modified="201307211455" tags="[[Snippets of Code]]">
<pre>Save the image stored in the 1st record database to a file
//{{{
Dim oRecordset As Object, oImage As Object, vValue As Variant, sFile As String
sFile = "C:\TestImage.jpg"
Set oRecordset = Application.CurrentDb().OpenRecordset("Products") ' Current record = 1st
With oRecordset
Set oImage = .Fields("IMAGE")
vValue = oImage.Value
If Not IsNull(vValue) Then 'A null field in the database returns a null value property
If vValue > 0 Then 'The value property of a binary field returns its LENGTH
oImage.WriteAllBytes(sFile)
End If
End If
End With
oRecordset.mClose()
//}}}</pre>
</div>
<div title="WriteAllText" modifier="Jean-PierreLedure" created="201307281459" modified="201307281500" tags="Methods">
<pre>The //~WriteAllText// method writes the content of a memo [[Field]] belonging to a [[Recordset]] to a file specified by its full name.
!!!Applies to ...
| !Object | !Type of field |
|[[Field]] |com.sun.star.sdbc.~DataType.LONGVARCHAR |
!!!Syntax
//field//{{{.WriteAllText(}}}//file//{{{)}}}
!!!Arguments
| !Argument | !Type | !Description |
| file | String |The full name, including the path, of the file you want to output the data to. |
!!!Remarks
The {{{file}}} argument may be expressed either in the (recommended) URL format (i.e. "{{{file:// ...}}}") or by using the operating system usual syntax (e.g. "{{{C:\...}}}" in Windows).
!!!Error messages
|Method '~WriteAllText' not applicable in this context |
|File access error on file '...' |
|Field is null or empty. Action rejected |
!!!See also
[[ReadAllBytes]]
[[ReadAllText]]
[[Value|Value (field)]]
[[WriteAllBytes]]
!!!Example
<<tiddler "WriteAllText example">></pre>
</div>
<div title="WriteAllText example" modifier="Jean-PierreLedure" created="201307281505" modified="201307281506" tags="[[Snippets of Code]]">
<pre>Save the text stored in a memo field in the 1st record to a file
//{{{
Dim oRecordset As Object, oMemo As Object, vValue As Variant, lSize As Long, sFile As String
sFile = "C:\SomeFile.txt"
Set oRecordset = Application.CurrentDb().OpenRecordset("Products") ' Current record = 1st
With oRecordset
Set oMemo = .Fields("DetailedDescription")
lSize = oMemo.FieldSize
If lSize < 64000 Then vValue = oMemo.Value ' If you want to manipulate the resulting string ...
If Not IsNull(vValue) Then 'A null field in the database returns a null value property
If Len(vValue) > 0 Then
oMemo.WriteAllText(sFile)
End If
End If
End With
oRecordset.mClose()
//}}}
</pre>
</div>
<div title="ZoomOnImage" modifier="Jean-PierreLedure" created="201212241133" modified="201308161244" tags="HowTo">
<pre>(Q) How can I enlarge a picture by moving the mouse above it ?
(R) Bind 2 different image controls with different sizes to the same database field.
Considering next table:
<<tiddler "ProductsTable">>
and a form having a small (for thumbnail display) and a large image control, both bound to the same //Picture// database field ...
!!!Solution based on mouse movements
... use the (small) control's //Mouse inside// and //Mouse outside// events to let appear and disappear the large image.
Link to them next code:
//{{{
Sub ZoomInOut(poEvent As Object)
Dim ofForm As Object, ocZoom As Object
Set ofForm = Events(poEvent).Source.Parent
Set ocZoom = ofForm.Controls("imgZoom")
ocZoom.Visible = Not ocZoom.Visible
End Sub
//}}}
To ensure the right behaviour, we reset the //Visible// property //After// each //record change//:
//{{{
Sub ZoomInit(poEvent As Object)
Dim ofForm As Object, ocZoom As Object
Set ofForm = Events(poEvent).Source
Set ocZoom = ofForm.Controls("imgZoom")
ocZoom.Visible = False
End Sub
//}}}
!!!See also
[[Visible]]
[[Events Handler]]
!!!Refer to ...
| !Basic module | !Form | !Form event | !Control | !Control event |!Comments |
|Zoom |~Products_ZoomImage |After record change |imgPicture |Mouse inside<br />Mouse outside ||</pre>
</div>
<div title="calculator.png" modifier="Jean-Pierre Ledure" created="201304121752" modified="201408011525" tags="attachment excludeMissing excludeLists Image" changecount="1">
<pre>!usage
{{{[img[calculator.png]]}}}
[img[calculator.png]]
!notes
//none//
!type
image/png
!file
./_wikiimages/calculator.png
!url
!data
</pre>
</div>
<div title="dbaccess_from_calc.png" modifier="Jean-Pierre Ledure" created="201404051345" modified="201408011525" tags="attachment excludeMissing excludeLists Image" changecount="1">
<pre>!usage
{{{[img[dbaccess_from_calc.png]]}}}
[img[dbaccess_from_calc.png]]
!notes
//none//
!type
image/png
!file
./_wikiimages/dbaccess_from_calc.png
!url
!data
</pre>
</div>
<div title="getObject" modifier="Jean-Pierre Ledure" created="201108201410" modified="201405300620" tags="Shortcuts" changecount="1">
<pre>The //getObject// function returns an [[object|Object Model]] designated by its [[shortcut notation|ShortCut Notation]].
!!!Syntax
{{{getObject(}}}//shortcut//{{{)}}}
| !Shortcut |!Returned value |
| String |An object of types [[Form]], [[Dialog]] or [[Control]]. Other types are currently not supported. |
!!!See also
[[ShortCut Notation]]
[[getValue]]
[[setValue]]
!!!Example
//{{{
getObject("Forms!myForm!mySubForm.Form!myGridControl!mySubControl")
//}}}
is equivalent to
//{{{
Forms("myForm").Controls("mySubForm").Form.Controls("myGridControl").Controls("mySubControl")
//}}}</pre>
</div>
<div title="getProperty" modifier="Jean-Pierre Ledure" created="201110010656" modified="201409271259" tags="Methods" changecount="7">
<pre>The //getProperty// method returns the current value of any property of any [[object|Object Model]].
!!!Applies to ...
| !Object | !Description |
|[[Collection]] |An array of objects accessible via their index or their names |
|[[Control]] |The representation of a control within a form, a subform, a gridcontrol or a dialog.<br />The control may be any control type including a [[gridcontrol|GridControl]]. |
|[[Database]] |The representation of a database |
|[[Event|Events]] |A description of an occurred form or control event |
|[[Field]] |Identifies a field within a //~TableDef//, a //~QueryDef// or a //Recordset// |
|[[Form]] |The representation of a database form |
|[[OptionGroup]] |Identifies a group of radio buttons within a form or a subform. |
|[[Property]] |A name-value pair allowing objects introspection |
|[[QueryDef]] |Corresponds with a query definition |
|[[Recordset]] |Identifies a set of records related to a table, a query or a SQL statement |
|[[SubForm]] |Identifies a specific control which is a subform of a database form or another subform |
|[[TableDef]] |Corresponds with a table definition |
|[[TempVar]] |Represents a temporary variable |
!!!Syntax
//collection//.{{{getProperty}}}(//property-name//{{{)}}}
//control//.{{{getProperty(}}}//property-name//{{{)}}}
//control//.{{{getProperty(}}}//property-name//{{{, }}}//index//{{{)}}}
//database//.{{{getProperty(}}}//property-name//{{{)}}}
//event//.{{{getProperty(}}}//property-name//{{{)}}}
//field//.{{{getProperty(}}}//property-name//{{{)}}}
//form//.{{{getProperty(}}}//property-name//{{{)}}}
//optiongroup//.{{{getProperty(}}}//property-name//{{{)}}}
//property//.{{{getProperty(}}}//property-name//{{{)}}}
//querydef//.{{{getProperty(}}}//property-name//{{{)}}}
//recordset//.{{{getProperty(}}}//property-name//{{{)}}}
|//subform//.{{{getProperty(}}}//property-name//{{{)}}}
//subform//.{{{getProperty(}}}//property-name//{{{, }}}//index//{{{)}}}
//tabledef//.{{{getProperty(}}}//property-name//{{{)}}}
//tempvar//.{{{getProperty(}}}//property-name//{{{)}}}
| !Applied to | !Type | !Argument #1 | !Type | !Argument #2 | !Type |!Returned value |
|collection | [[Collection object|Collection]] | property-name | String |||Variant or Variant array. |
|control | [[Control object|Control]] |~|~| index | absent |~|
|~|~|~|~|~| Integer<br />Long |Variant (or index-th array entry). |
|database | [[Database object|Database]] |~|~|||Variant. |
|event | [[Event object|Event]] |~|~|~|~|~|
|field | [[Field object|Field]] |~|~|~|~|Variant. |
|form | [[Form object|Form]] |~|~|~|~|Variant. |
|optiongroup | [[Optiongroup object|OptionGroup]] |~|~|~|~|Variant. |
|property | [[Property object|Property]] |~|~|~|~|Variant or Variant array. |
|querydef | [[QueryDef object|QueryDef]] |~|~|~|~|Variant. |
|recordset | [[Recordset object|Recordset]] |~|~|~|~|Variant. |
|tabledef | [[TableDef object|TableDef]] |~|~|~|~|Variant. |
|subform | [[Subform object|SubForm]] |~|~| index | absent |Variant or Variant array. |
|~|~|~|~|~| Integer<br />Long |Variant (or index-th array entry). |
|tempvar | [[TempVar object|TempVar]] |~|~|||Variant. |
!!!Remarks
The //index// argument must have a (integer or long) value between 0 and the size of the array associated with the considered //property// - 1
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Property '...' not applicable in this context |
|Out of array range or incorrect array size for property '...' |
!!!See also
[[Property]]
[[Properties|Properties (collection)]]
[[hasProperty]]
[[setProperty]]
!!!Example
</pre>
</div>
<div title="getValue" modifier="Jean-PierreLedure" created="201108201414" modified="201212081501" tags="Shortcuts">
<pre>The //getValue// function returns a property of an [[object|Object Model]] designated by its [[shortcut notation|ShortCut Notation]].
!!!Syntax
{{{getValue(}}}//shortcut//{{{)}}}
| !Shortcut | !Returned value |
| String | Variant |
!!!Remark
If the last component of the //shortcut// is not a property (i.e. the last operator is not a ".") then the property [[Value]] is assumed.
!!!See also
[[ShortCut Notation]]
[[getObject]]
[[setValue]]
The [[Value]] property
!!!Example
//{{{
getValue("Forms!myForm!mySubForm.Form!myGridControl!mySubControl.ControlTipText")
//}}}
is equivalent to
//{{{
Forms("myForm").Controls("mySubForm").Form.Controls("myGridControl").Controls("mySubControl").ControlTipText
//}}}</pre>
</div>
<div title="hasProperty" modifier="Jean-Pierre Ledure" created="201110011330" modified="201405241125" tags="Methods" changecount="2">
<pre>The //hasProperty// method returns //True// if an [[object|Object Model]] has a specific //property//.
!!!Applies to ...
| !Object | !Description |
|[[Collection]] |An array of objects accessible via their index or their names |
|[[Database]] |The representation of a database object |
|[[Form]] |The representation of a database form |
|[[Control]] |The representation of a control within a form, a subform, a gridcontrol or a dialog.<br />The control may be any control type including a [[gridcontrol|GridControl]]. |
|[[SubForm]] |Identifies a specific control which is a subform of a database form or another subform |
|[[OptionGroup]] |Identifies a group of radio buttons within a form or a subform. |
|[[TableDef]] |Corresponds with a table definition |
|[[QueryDef]] |Corresponds with a query definition |
|[[Recordset]] |Identifies a set of records related to a table, a query or a SQL statement |
|[[Field]] |Identifies a field within a //~TableDef//, a //~QueryDef// or a //Recordset// |
|[[Property]] |A name-value pair allowing objects introspection |
|[[Event|Events]] |A description of an occurred form or control event |
!!!Syntax
//object//.{{{hasProperty(}}}//property-name//{{{)}}}
| !Argument | !Type |!Returned value |
| property-name | String | Boolean |
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
!!!See also
[[Property]]
[[Properties|Properties (collection)]]
[[getProperty]]
[[setProperty]]
!!!Example
<<tiddler "setProperty example">></pre>
</div>
<div title="objectmodel.png" creator="Jean-Pierre Ledure" modifier="Jean-Pierre Ledure" created="201405171020" modified="201405171020" tags="attachment excludeLists excludeMissing Image" changecount="2">
<pre>!usage
{{{[img[objectmodel.png]]}}}
[img[objectmodel.png]]
!notes
//none//
!type
image/png
!file
./_wikiimages/objectmodel.png
!url
!data
</pre>
</div>
<div title="setProperty" modifier="Jean-Pierre Ledure" created="201110011035" modified="201409271309" tags="Methods" changecount="6">
<pre>The //setProperty// method modifies the current value of any modifiable property of [[objects|Object Model]].
!!!Applies to ...
| !Object | !Description |
|[[Control]] |The representation of a control within a form, a subform, a gridcontrol or a dialog.<br />The control may be any control type including a [[gridcontrol|GridControl]]. |
|[[Field]] |Identifies a field within a //~TableDef//, a //~QueryDef// or a //Recordset// |
|[[Form]] |The representation of a database form |
|[[OptionGroup]] |Identifies a group of radio buttons within a form or a subform. |
|[[QueryDef]] |Corresponds with a query definition |
|[[Recordset]] |Identifies a set of records related to a table, a query or a SQL statement |
|[[SubForm]] |Identifies a specific control which is a subform of a database form or another subform |
|[[TempVar]] |Represents a temporary variable |
!!!Syntax
//control//.{{{setProperty(}}}//property-name, value//{{{)}}}
//control//.{{{setProperty(}}}//property-name, value, index//{{{)}}}
//field//.{{{setProperty(}}}//property-name, value//{{{)}}}
//form//.{{{setProperty(}}}//property-name, value//{{{)}}}
//optiongroup//.{{{setProperty(}}}//property-name, value//{{{)}}}
//querydef//.{{{setProperty(}}}//property-name, value//{{{)}}}
//recordset//.{{{setProperty(}}}//property-name, value//{{{)}}}
//subform//.{{{setProperty(}}}//property-name, value//{{{)}}}
//tempvar//.{{{setProperty(}}}//property-name, value//{{{)}}}
| !Applied to | !Type | !Argument #1 | !Type | !Argument #2 | !Type | !Argument #3 | !Type | !Returned value |
| control | [[Control object|Control]] | property-name | String | value | Variant | index | absent |{{{True}}} if success. |
|~|~|~|~|~|~|~| Integer<br />Long |~|
| field | [[Field object|Field]] |~|~|~|~|||~|
| form | [[Form object|Form]] |~|~|~|~|~|~|~|
| optiongroup | [[Optiongroup object|OptionGroup]] |~|~|~|~|~|~|~|
| querydef | [[QueryDef object|QueryDef]] |~|~|~|~|~|~|~|
| recordset | [[Recordset object|Recordset]] |~|~|~|~|~|~|~|
| subform | [[Subform object|SubForm]] |~|~|~|~|~|~|~|
| tempvar | [[Subform object|SubForm]] |~|~|~|~|~|~|~|
!!!Remarks
The //index// argument must have a (integer or long) value between 0 and the size of the array associated with the considered //property// - 1.
!!!Error messages
|Argument nr. ... [Value = '...'] is invalid |
|Property '...' not applicable in this context |
|Value '...' is invalid for property '...' |
|Out of array range or incorrect array size for property '...' |
!!!See also
[[Property]]
[[Properties|Properties (collection)]]
[[hasProperty]]
[[getProperty]]
!!!Example
<<tiddler "setProperty example">>
</pre>
</div>
<div title="setProperty example" modifier="Jean-PierreLedure" created="201110011114" modified="201212081453" tags="[[Snippets of Code]]">
<pre>Set all enabled controls on a form in italic
//{{{
Dim ofForm As Object, i As Integer, iCount As Integer, ocControl As Object
Set ofForm = Forms("myForm")
iCount = ofForm.Controls().Count
For i = 0 To iCount - 1
Set ocControl = ofForm.Controls(i)
If ocControl.hasProperty("FONTITALIC") Then
If ocControl.hasProperty("ENABLED") Then
If ocControl.Enabled Then ocControl.setProperty("FONTITALIC", True)
End If
End If
Next i
//}}}</pre>
</div>
<div title="setValue" modifier="Jean-PierreLedure" created="201108201419" modified="201212151153" tags="Shortcuts">
<pre>The //setValue// function sets a property of an [[object|Object Model]] designated by its [[shortcut notation|ShortCut Notation]].
!!!Syntax
{{{setValue(}}}//shortcut, value//{{{)}}}
| !Shortcut | !Value |!Returned value |
| String | Variant |Boolean. True if success. |
!!!Remark
If the last component of the //shortcut// is not a property (i.e. the last operator is not a ".") then the property [[Value]] is assumed.
The //setValue// does not allow to set a single element of an array if the property value is an array. However setting all the elements at once is allowed.
!!!See also
[[ShortCut Notation]]
[[getObject]]
[[getValue]]
The [[Value]] property
!!!Example
//{{{
setValue("Forms!myForm!mySubForm.Form!myGridControl!mySubControl.ControlTipText", "New tip")
//}}}
is equivalent to
//{{{
Forms("myForm").Controls("mySubForm").Form.Controls("myGridControl").Controls("mySubControl").ControlTipText = "New tip"
//}}}</pre>
</div>
<div title="systemConfig" modifier="Jean-Pierre Ledure" created="201106250958" modified="201108061610" tags="excludeLists">
<pre>Type the text for 'systemConfig'</pre>
</div>
<div title="tabbed_details.png" modifier="Jean-Pierre Ledure" created="201401031511" modified="201408011526" tags="attachment excludeMissing excludeLists Image" changecount="1">
<pre>!usage
{{{[img[tabbed_details.png]]}}}
[img[tabbed_details.png]]
!notes
//none//
!type
image/png
!file
./_wikiimages/tabbed_details.png
!url
!data
</pre>
</div>
<div title="tabbed_orders.png" modifier="Jean-Pierre Ledure" created="201401031506" modified="201408011526" tags="attachment excludeMissing excludeLists Image" changecount="1">
<pre>!usage
{{{[img[tabbed_orders.png]]}}}
[img[tabbed_orders.png]]
!notes
//none//
!type
image/png
!file
./_wikiimages/tabbed_orders.png
!url
!data
</pre>
</div>
<div title="traceerror msgbox.png" modifier="Jean-Pierre Ledure" created="201108071525" modified="201408011526" tags="attachment excludeMissing excludeLists Image" changecount="1">
<pre>!usage
{{{[img[traceerror msgbox.png]]}}}
[img[traceerror msgbox.png]]
!notes
//none//
!type
image/png
!file
./_wikiimages/traceerror msgbox.png
!url
!data
</pre>
</div>
<div title="tracelog dialog.png" modifier="Jean-Pierre Ledure" created="201108061443" modified="201408011527" tags="Image excludeLists attachment excludeMissing" changecount="1">
<pre>!usage
{{{[img[tracelog dialog.png]]}}}
[img[tracelog dialog.png]]
!notes
//none//
!type
image/png
!file
./_wikiimages/tracelog dialog.png
!url
!data
</pre>
</div>
<div title="tracelog msgbox.png" modifier="Jean-Pierre Ledure" created="201108071453" modified="201408011527" tags="attachment excludeMissing excludeLists Image" changecount="1">
<pre>!usage
{{{[img[tracelog msgbox.png]]}}}
[img[tracelog msgbox.png]]
!notes
//none//
!type
image/png
!file
./_wikiimages/tracelog msgbox.png
!url
!data
</pre>
</div>
</div>
<!--POST-STOREAREA-->
<!--POST-BODY-START-->
<!--POST-BODY-END-->
<script id="jsArea" type="text/javascript">
//<![CDATA[
//
// Please note:
//
// * This code is designed to be readable but for compactness it only includes brief comments. You can see fuller comments
// in the project repository at https://github.com/TiddlyWiki/tiddlywiki
//
// * You should never need to modify this source code directly. TiddlyWiki is carefully designed to allow deep customisation
// without changing the core code. Please consult the development group at http://groups.google.com/group/TiddlyWikiDev
//
// JSLint directives
/*global jQuery:false, version:false */
/*jslint bitwise:true, browser:true, confusion:true, eqeq:true, evil:true, forin:true, maxerr:100, plusplus:true, regexp:true, sloppy:true, sub:true, undef:true, unparam:true, vars:true, white:true */
//--
//-- Configuration repository
//--
// Miscellaneous options
var config = {
numRssItems: 20, // Number of items in the RSS feed
animDuration: 400, // Duration of UI animations in milliseconds
cascadeFast: 20, // Speed for cascade animations (higher == slower)
cascadeSlow: 60, // Speed for EasterEgg cascade animations
cascadeDepth: 5, // Depth of cascade animation
locale: "en" // W3C language tag
};
// Hashmap of alternative parsers for the wikifier
config.parsers = {};
// Adaptors
config.adaptors = {};
config.defaultAdaptor = null;
// Backstage tasks
config.tasks = {};
// Annotations
config.annotations = {};
// Custom fields to be automatically added to new tiddlers
config.defaultCustomFields = {};
// Messages
config.messages = {
messageClose: {},
dates: {},
tiddlerPopup: {}
};
// Options that can be set in the options panel and/or cookies
config.options = {
chkRegExpSearch: false,
chkCaseSensitiveSearch: false,
chkIncrementalSearch: true,
chkAnimate: true,
chkSaveBackups: true,
chkAutoSave: false,
chkGenerateAnRssFeed: false,
chkSaveEmptyTemplate: false,
chkOpenInNewWindow: true,
chkToggleLinks: false,
chkHttpReadOnly: true,
chkForceMinorUpdate: false,
chkConfirmDelete: true,
chkInsertTabs: false,
chkUsePreForStorage: true, // Whether to use <pre> format for storage
chkDisplayInstrumentation: false,
txtBackupFolder: "",
txtEditorFocus: "text",
txtMainTab: "tabTimeline",
txtMoreTab: "moreTabAll",
txtMaxEditRows: "30",
txtFileSystemCharSet: "UTF-8",
txtTheme: ""
};
config.optionsDesc = {};
config.optionsSource = {};
// Default tiddler templates
var DEFAULT_VIEW_TEMPLATE = 1;
var DEFAULT_EDIT_TEMPLATE = 2;
config.tiddlerTemplates = {
1: "ViewTemplate",
2: "EditTemplate"
};
// More messages (rather a legacy layout that should not really be like this)
config.views = {
wikified: {
tag: {}
},
editor: {
tagChooser: {}
}
};
// Backstage tasks
config.backstageTasks = ["save","importTask","tweak","upgrade","plugins"];
// Extensions
config.extensions = {};
// Macros; each has a 'handler' member that is inserted later
config.macros = {
today: {},
version: {},
search: {sizeTextbox: 15},
tiddler: {},
tag: {},
tags: {},
tagging: {},
timeline: {},
allTags: {},
list: {
all: {},
missing: {},
orphans: {},
shadowed: {},
touched: {},
filter: {}
},
closeAll: {},
permaview: {},
saveChanges: {},
slider: {},
option: {},
options: {},
newTiddler: {},
newJournal: {},
tabs: {},
gradient: {},
message: {},
view: {defaultView: "text"},
edit: {},
tagChooser: {},
toolbar: {},
plugins: {},
refreshDisplay: {},
importTiddlers: {},
upgrade: {
source: "http://tiddlywiki-releases.tiddlyspace.com/upgrade",
backupExtension: "pre.core.upgrade"
},
sync: {},
annotations: {}
};
// Commands supported by the toolbar macro
config.commands = {
closeTiddler: {},
closeOthers: {},
editTiddler: {},
saveTiddler: {hideReadOnly: true},
cancelTiddler: {},
deleteTiddler: {hideReadOnly: true},
permalink: {},
references: {type: "popup"},
jump: {type: "popup"},
syncing: {type: "popup"},
fields: {type: "popup"}
};
// Control of macro parameter evaluation
config.evaluateMacroParameters = "all";
// Basic regular expressions
config.textPrimitives = {
upperLetter: "[A-Z\u00c0-\u00de\u0150\u0170]",
lowerLetter: "[a-z0-9_\\-\u00df-\u00ff\u0151\u0171]",
anyLetter: "[A-Za-z0-9_\\-\u00c0-\u00de\u00df-\u00ff\u0150\u0170\u0151\u0171]",
anyLetterStrict: "[A-Za-z0-9\u00c0-\u00de\u00df-\u00ff\u0150\u0170\u0151\u0171]"
};
if(!((new RegExp("[\u0150\u0170]","g")).test("\u0150"))) {
config.textPrimitives = {
upperLetter: "[A-Z\u00c0-\u00de]",
lowerLetter: "[a-z0-9_\\-\u00df-\u00ff]",
anyLetter: "[A-Za-z0-9_\\-\u00c0-\u00de\u00df-\u00ff]",
anyLetterStrict: "[A-Za-z0-9\u00c0-\u00de\u00df-\u00ff]"
};
}
config.textPrimitives.sliceSeparator = "::";
config.textPrimitives.sectionSeparator = "##";
config.textPrimitives.urlPattern = "(?:file|http|https|mailto|ftp|irc|news|data):[^\\s'\"]+(?:/|\\b)";
config.textPrimitives.unWikiLink = "~";
config.textPrimitives.wikiLink = "(?:(?:" + config.textPrimitives.upperLetter + "+" +
config.textPrimitives.lowerLetter + "+" +
config.textPrimitives.upperLetter +
config.textPrimitives.anyLetter + "*)|(?:" +
config.textPrimitives.upperLetter + "{2,}" +
config.textPrimitives.lowerLetter + "+))";
config.textPrimitives.cssLookahead = "(?:(" + config.textPrimitives.anyLetter + "+)\\(([^\\)\\|\\n]+)(?:\\):))|(?:(" + config.textPrimitives.anyLetter + "+):([^;\\|\\n]+);)";
config.textPrimitives.cssLookaheadRegExp = new RegExp(config.textPrimitives.cssLookahead,"mg");
config.textPrimitives.brackettedLink = "\\[\\[([^\\]]+)\\]\\]";
config.textPrimitives.titledBrackettedLink = "\\[\\[([^\\[\\]\\|]+)\\|([^\\[\\]\\|]+)\\]\\]";
config.textPrimitives.tiddlerForcedLinkRegExp = new RegExp("(?:" + config.textPrimitives.titledBrackettedLink + ")|(?:" +
config.textPrimitives.brackettedLink + ")|(?:" +
config.textPrimitives.urlPattern + ")","mg");
config.textPrimitives.tiddlerAnyLinkRegExp = new RegExp("("+ config.textPrimitives.wikiLink + ")|(?:" +
config.textPrimitives.titledBrackettedLink + ")|(?:" +
config.textPrimitives.brackettedLink + ")|(?:" +
config.textPrimitives.urlPattern + ")","mg");
config.glyphs = {
currBrowser: null,
browsers: [],
codes: {}
};
//--
//-- Shadow tiddlers
//--
config.shadowTiddlers = {
StyleSheet: "",
MarkupPreHead: "",
MarkupPostHead: "",
MarkupPreBody: "",
MarkupPostBody: "",
TabTimeline: '<<timeline>>',
TabAll: '<<list all>>',
TabTags: '<<allTags excludeLists>>',
TabMoreMissing: '<<list missing>>',
TabMoreOrphans: '<<list orphans>>',
TabMoreShadowed: '<<list shadowed>>',
AdvancedOptions: '<<options>>',
PluginManager: '<<plugins>>',
SystemSettings: '',
ToolbarCommands: '|~ViewToolbar|closeTiddler closeOthers +editTiddler > fields syncing permalink references jump|\n|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|',
WindowTitle: '<<tiddler SiteTitle>> - <<tiddler SiteSubtitle>>'
};
// Browser detection... In a very few places, there's nothing else for it but to know what browser we're using.
config.userAgent = navigator.userAgent.toLowerCase();
config.browser = {
isIE: config.userAgent.indexOf("msie") != -1 && config.userAgent.indexOf("opera") == -1,
isGecko: navigator.product == "Gecko" && config.userAgent.indexOf("WebKit") == -1,
ieVersion: /MSIE (\d{1,2}.\d)/i.exec(config.userAgent), // config.browser.ieVersion[1], if it exists, will be the IE version string, eg "6.0"
isSafari: config.userAgent.indexOf("applewebkit") != -1,
isBadSafari: !((new RegExp("[\u0150\u0170]","g")).test("\u0150")),
firefoxDate: /gecko\/(\d{8})/i.exec(config.userAgent), // config.browser.firefoxDate[1], if it exists, will be Firefox release date as "YYYYMMDD"
isOpera: config.userAgent.indexOf("opera") != -1,
isChrome: config.userAgent.indexOf('chrome') > -1,
isLinux: config.userAgent.indexOf("linux") != -1,
isUnix: config.userAgent.indexOf("x11") != -1,
isMac: config.userAgent.indexOf("mac") != -1,
isWindows: config.userAgent.indexOf("win") != -1
};
merge(config.glyphs,{
browsers: [
function() {return config.browser.isIE;},
function() {return true;}
],
codes: {
downTriangle: ["\u25BC","\u25BE"],
downArrow: ["\u2193","\u2193"],
bentArrowLeft: ["\u2190","\u21A9"],
bentArrowRight: ["\u2192","\u21AA"]
}
});
//--
//-- Translateable strings
//--
// Strings in "double quotes" should be translated; strings in 'single quotes' should be left alone
merge(config.options,{
txtUserName: "YourName"});
merge(config.tasks,{
save: {text: "save", tooltip: "Save your changes to this TiddlyWiki"},
importTask: {text: "import", tooltip: "Import tiddlers and plugins from other TiddlyWiki files and servers", content: '<<importTiddlers>>'},
tweak: {text: "tweak", tooltip: "Tweak the appearance and behaviour of TiddlyWiki", content: '<<options>>'},
upgrade: {text: "upgrade", tooltip: "Upgrade TiddlyWiki core code", content: '<<upgrade>>'},
plugins: {text: "plugins", tooltip: "Manage installed plugins", content: '<<plugins>>'}
});
// Options that can be set in the options panel and/or cookies
merge(config.optionsDesc,{
txtUserName: "Username for signing your edits",
chkRegExpSearch: "Enable regular expressions for searches",
chkCaseSensitiveSearch: "Case-sensitive searching",
chkIncrementalSearch: "Incremental key-by-key searching",
chkAnimate: "Enable animations",
chkSaveBackups: "Keep backup file when saving changes",
chkAutoSave: "Automatically save changes",
chkGenerateAnRssFeed: "Generate an RSS feed when saving changes",
chkSaveEmptyTemplate: "Generate an empty template when saving changes",
chkOpenInNewWindow: "Open external links in a new window",
chkToggleLinks: "Clicking on links to open tiddlers causes them to close",
chkHttpReadOnly: "Hide editing features when viewed over HTTP",
chkForceMinorUpdate: "Don't update modifier username and date when editing tiddlers",
chkConfirmDelete: "Require confirmation before deleting tiddlers",
chkInsertTabs: "Use the tab key to insert tab characters instead of moving between fields",
txtBackupFolder: "Name of folder to use for backups",
txtMaxEditRows: "Maximum number of rows in edit boxes",
txtTheme: "Name of the theme to use",
txtFileSystemCharSet: "Default character set for saving changes (Firefox/Mozilla only)"});
merge(config.messages,{
customConfigError: "Problems were encountered loading plugins. See PluginManager for details",
pluginError: "Error: %0",
pluginDisabled: "Not executed because disabled via 'systemConfigDisable' tag",
pluginForced: "Executed because forced via 'systemConfigForce' tag",
pluginVersionError: "Not executed because this plugin needs a newer version of TiddlyWiki",
nothingSelected: "Nothing is selected. You must select one or more items first",
savedSnapshotError: "It appears that this TiddlyWiki has been incorrectly saved. Please see http://www.tiddlywiki.com/#Download for details",
subtitleUnknown: "(unknown)",
undefinedTiddlerToolTip: "The tiddler '%0' doesn't yet exist",
shadowedTiddlerToolTip: "The tiddler '%0' doesn't yet exist, but has a pre-defined shadow value",
tiddlerLinkTooltip: "%0 - %1, %2",
externalLinkTooltip: "External link to %0",
noTags: "There are no tagged tiddlers",
notFileUrlError: "You need to save this TiddlyWiki to a file before you can save changes",
cantSaveError: "It's not possible to save changes. Possible reasons include:\n- your browser doesn't support saving (Firefox, Internet Explorer, Safari and Opera all work if properly configured)\n- the pathname to your TiddlyWiki file contains illegal characters\n- the TiddlyWiki HTML file has been moved or renamed",
invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
backupSaved: "Backup saved",
backupFailed: "Failed to save backup file",
rssSaved: "RSS feed saved",
rssFailed: "Failed to save RSS feed file",
emptySaved: "Empty template saved",
emptyFailed: "Failed to save empty template file",
mainSaved: "Main TiddlyWiki file saved",
mainDownload: "Downloading/saving main TiddlyWiki file",
mainDownloadManual: "RIGHT CLICK HERE to download/save main TiddlyWiki file",
mainFailed: "Failed to save main TiddlyWiki file. Your changes have not been saved",
macroError: "Error in macro <<%0>>",
macroErrorDetails: "Error while executing macro <<%0>>:\n%1",
missingMacro: "No such macro",
overwriteWarning: "A tiddler named '%0' already exists. Choose OK to overwrite it",
unsavedChangesWarning: "WARNING! There are unsaved changes in TiddlyWiki\n\nChoose OK to save\nChoose CANCEL to discard",
confirmExit: "--------------------------------\n\nThere are unsaved changes in TiddlyWiki. If you continue you will lose those changes\n\n--------------------------------",
saveInstructions: "SaveChanges",
unsupportedTWFormat: "Unsupported TiddlyWiki format '%0'",
tiddlerSaveError: "Error when saving tiddler '%0'",
tiddlerLoadError: "Error when loading tiddler '%0'",
wrongSaveFormat: "Cannot save with storage format '%0'. Using standard format for save.",
invalidFieldName: "Invalid field name %0",
fieldCannotBeChanged: "Field '%0' cannot be changed",
loadingMissingTiddler: "Attempting to retrieve the tiddler '%0' from the '%1' server at:\n\n'%2' in the workspace '%3'",
upgradeDone: "The upgrade to version %0 is now complete\n\nClick 'OK' to reload the newly upgraded TiddlyWiki",
invalidCookie: "Invalid cookie '%0'"});
merge(config.messages.messageClose,{
text: "close",
tooltip: "close this message area"});
config.messages.backstage = {
open: {text: "backstage", tooltip: "Open the backstage area to perform authoring and editing tasks"},
close: {text: "close", tooltip: "Close the backstage area"},
prompt: "backstage: ",
decal: {
edit: {text: "edit", tooltip: "Edit the tiddler '%0'"}
}
};
config.messages.listView = {
tiddlerTooltip: "Click for the full text of this tiddler",
previewUnavailable: "(preview not available)"
};
config.messages.dates.months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November","December"];
config.messages.dates.days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
config.messages.dates.shortMonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
config.messages.dates.shortDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
// suffixes for dates, eg "1st","2nd","3rd"..."30th","31st"
config.messages.dates.daySuffixes = ["st","nd","rd","th","th","th","th","th","th","th",
"th","th","th","th","th","th","th","th","th","th",
"st","nd","rd","th","th","th","th","th","th","th",
"st"];
config.messages.dates.am = "am";
config.messages.dates.pm = "pm";
merge(config.messages.tiddlerPopup,{
});
merge(config.views.wikified.tag,{
labelNoTags: "no tags",
labelTags: "tags: ",
openTag: "Open tag '%0'",
tooltip: "Show tiddlers tagged with '%0'",
openAllText: "Open all",
openAllTooltip: "Open all of these tiddlers",
popupNone: "No other tiddlers tagged with '%0'"});
merge(config.views.wikified,{
defaultText: "The tiddler '%0' doesn't yet exist. Double-click to create it",
defaultModifier: "(missing)",
shadowModifier: "(built-in shadow tiddler)",
dateFormat: "DD MMM YYYY",
createdPrompt: "created"});
merge(config.views.editor,{
tagPrompt: "Type tags separated with spaces, [[use double square brackets]] if necessary, or add existing",
defaultText: "Type the text for '%0'"});
merge(config.views.editor.tagChooser,{
text: "tags",
tooltip: "Choose existing tags to add to this tiddler",
popupNone: "There are no tags defined",
tagTooltip: "Add the tag '%0'"});
merge(config.messages,{
sizeTemplates:
[
{unit: 1024*1024*1024, template: "%0\u00a0GB"},
{unit: 1024*1024, template: "%0\u00a0MB"},
{unit: 1024, template: "%0\u00a0KB"},
{unit: 1, template: "%0\u00a0B"}
]});
merge(config.macros.search,{
label: "search",
prompt: "Search this TiddlyWiki",
placeholder: "",
accessKey: "F",
successMsg: "%0 tiddlers found matching %1",
failureMsg: "No tiddlers found matching %0"});
merge(config.macros.tagging,{
label: "tagging: ",
labelNotTag: "not tagging",
tooltip: "List of tiddlers tagged with '%0'"});
merge(config.macros.timeline,{
dateFormat: "DD MMM YYYY"});
merge(config.macros.allTags,{
tooltip: "Show tiddlers tagged with '%0'",
noTags: "There are no tagged tiddlers"});
config.macros.list.all.prompt = "All tiddlers in alphabetical order";
config.macros.list.missing.prompt = "Tiddlers that have links to them but are not defined";
config.macros.list.orphans.prompt = "Tiddlers that are not linked to from any other tiddlers";
config.macros.list.shadowed.prompt = "Tiddlers shadowed with default contents";
config.macros.list.touched.prompt = "Tiddlers that have been modified locally";
merge(config.macros.closeAll,{
label: "close all",
prompt: "Close all displayed tiddlers (except any that are being edited)"});
merge(config.macros.permaview,{
label: "permaview",
prompt: "Link to an URL that retrieves all the currently displayed tiddlers"});
merge(config.macros.saveChanges,{
label: "save changes",
prompt: "Save all tiddlers to create a new TiddlyWiki",
accessKey: "S"});
merge(config.macros.newTiddler,{
label: "new tiddler",
prompt: "Create a new tiddler",
title: "New Tiddler",
accessKey: "N"});
merge(config.macros.newJournal,{
label: "new journal",
prompt: "Create a new tiddler from the current date and time",
accessKey: "J"});
merge(config.macros.options,{
wizardTitle: "Tweak advanced options",
step1Title: "These options are saved in cookies in your browser",
step1Html: "<input type='hidden' name='markList'></input><br><input type='checkbox' checked='false' name='chkUnknown'>Show unknown options</input>",
unknownDescription: "//(unknown)//",
listViewTemplate: {
columns: [
{name: 'Option', field: 'option', title: "Option", type: 'String'},
{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
{name: 'Name', field: 'name', title: "Name", type: 'String'}
],
rowClasses: [
{className: 'lowlight', field: 'lowlight'}
]}
});
merge(config.macros.plugins,{
wizardTitle: "Manage plugins",
step1Title: "Currently loaded plugins",
step1Html: "<input type='hidden' name='markList'></input>", // DO NOT TRANSLATE
skippedText: "(This plugin has not been executed because it was added since startup)",
noPluginText: "There are no plugins installed",
confirmDeleteText: "Are you sure you want to delete these plugins:\n\n%0",
removeLabel: "remove systemConfig tag",
removePrompt: "Remove systemConfig tag",
deleteLabel: "delete",
deletePrompt: "Delete these tiddlers forever",
listViewTemplate: {
columns: [
{name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'},
{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
{name: 'Description', field: 'Description', title: "Description", type: 'String'},
{name: 'Version', field: 'Version', title: "Version", type: 'String'},
{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'},
{name: 'Forced', field: 'forced', title: "Forced", tag: 'systemConfigForce', type: 'TagCheckbox'},
{name: 'Disabled', field: 'disabled', title: "Disabled", tag: 'systemConfigDisable', type: 'TagCheckbox'},
{name: 'Executed', field: 'executed', title: "Loaded", type: 'Boolean', trueText: "Yes", falseText: "No"},
{name: 'Startup Time', field: 'startupTime', title: "Startup Time", type: 'String'},
{name: 'Error', field: 'error', title: "Status", type: 'Boolean', trueText: "Error", falseText: "OK"},
{name: 'Log', field: 'log', title: "Log", type: 'StringList'}
],
rowClasses: [
{className: 'error', field: 'error'},
{className: 'warning', field: 'warning'}
]},
listViewTemplateReadOnly: {
columns: [
{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
{name: 'Description', field: 'Description', title: "Description", type: 'String'},
{name: 'Version', field: 'Version', title: "Version", type: 'String'},
{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'},
{name: 'Executed', field: 'executed', title: "Loaded", type: 'Boolean', trueText: "Yes", falseText: "No"},
{name: 'Startup Time', field: 'startupTime', title: "Startup Time", type: 'String'},
{name: 'Error', field: 'error', title: "Status", type: 'Boolean', trueText: "Error", falseText: "OK"},
{name: 'Log', field: 'log', title: "Log", type: 'StringList'}
],
rowClasses: [
{className: 'error', field: 'error'},
{className: 'warning', field: 'warning'}
]}
});
merge(config.macros.toolbar,{
moreLabel: "more",
morePrompt: "Show additional commands",
lessLabel: "less",
lessPrompt: "Hide additional commands",
separator: "|"
});
merge(config.macros.refreshDisplay,{
label: "refresh",
prompt: "Redraw the entire TiddlyWiki display"
});
merge(config.macros.importTiddlers,{
readOnlyWarning: "You cannot import into a read-only TiddlyWiki file. Try opening it from a file:// URL",
wizardTitle: "Import tiddlers from another file or server",
step1Title: "Step 1: Locate the server or TiddlyWiki file",
step1Html: "Specify the type of the server: <select name='selTypes'><option value=''>Choose...</option></select><br>Enter the URL or pathname here: <input type='text' size=50 name='txtPath'><br>...or browse for a file: <input type='file' size=50 name='txtBrowse'><br><hr>...or select a pre-defined feed: <select name='selFeeds'><option value=''>Choose...</option></select>",
openLabel: "open",
openPrompt: "Open the connection to this file or server",
statusOpenHost: "Opening the host",
statusGetWorkspaceList: "Getting the list of available workspaces",
step2Title: "Step 2: Choose the workspace",
step2Html: "Enter a workspace name: <input type='text' size=50 name='txtWorkspace'><br>...or select a workspace: <select name='selWorkspace'><option value=''>Choose...</option></select>",
cancelLabel: "cancel",
cancelPrompt: "Cancel this import",
statusOpenWorkspace: "Opening the workspace",
statusGetTiddlerList: "Getting the list of available tiddlers",
errorGettingTiddlerList: "Error getting list of tiddlers, click Cancel to try again",
errorGettingTiddlerListHttp404: "Error retrieving tiddlers from url, please ensure the url exists. Click Cancel to try again.",
errorGettingTiddlerListHttp: "Error retrieving tiddlers from url, please ensure this url exists and is <a href='http://enable-cors.org/'>CORS</a> enabled",
errorGettingTiddlerListFile: "Error retrieving tiddlers from local file, please make sure the file is in the same directory as your TiddlyWiki. Click Cancel to try again.",
step3Title: "Step 3: Choose the tiddlers to import",
step3Html: "<input type='hidden' name='markList'></input><br><input type='checkbox' checked='true' name='chkSync'>Keep these tiddlers linked to this server so that you can synchronise subsequent changes</input><br><input type='checkbox' name='chkSave'>Save the details of this server in a 'systemServer' tiddler called:</input> <input type='text' size=25 name='txtSaveTiddler'>",
importLabel: "import",
importPrompt: "Import these tiddlers",
confirmOverwriteText: "Are you sure you want to overwrite these tiddlers:\n\n%0",
step4Title: "Step 4: Importing %0 tiddler(s)",
step4Html: "<input type='hidden' name='markReport'></input>", // DO NOT TRANSLATE
doneLabel: "done",
donePrompt: "Close this wizard",
statusDoingImport: "Importing tiddlers",
statusDoneImport: "All tiddlers imported",
systemServerNamePattern: "%2 on %1",
systemServerNamePatternNoWorkspace: "%1",
confirmOverwriteSaveTiddler: "The tiddler '%0' already exists. Click 'OK' to overwrite it with the details of this server, or 'Cancel' to leave it unchanged",
serverSaveTemplate: "|''Type:''|%0|\n|''URL:''|%1|\n|''Workspace:''|%2|\n\nThis tiddler was automatically created to record the details of this server",
serverSaveModifier: "(System)",
listViewTemplate: {
columns: [
{name: 'Selected', field: 'Selected', rowName: 'title', type: 'Selector'},
{name: 'Tiddler', field: 'tiddler', title: "Tiddler", type: 'Tiddler'},
{name: 'Size', field: 'size', tiddlerLink: 'size', title: "Size", type: 'Size'},
{name: 'Tags', field: 'tags', title: "Tags", type: 'Tags'}
],
rowClasses: [
]}
});
merge(config.macros.upgrade,{
wizardTitle: "Upgrade TiddlyWiki core code",
step1Title: "Update or repair this TiddlyWiki to the latest release",
step1Html: "You are about to upgrade to the latest release of the TiddlyWiki core code (from <a href='%0' class='externalLink' target='_blank'>%1</a>). Your content will be preserved across the upgrade.<br><br>Note that core upgrades have been known to interfere with older plugins. If you run into problems with the upgraded file, see <a href='http://www.tiddlywiki.org/wiki/CoreUpgrades' class='externalLink' target='_blank'>http://www.tiddlywiki.org/wiki/CoreUpgrades</a>",
errorCantUpgrade: "Unable to upgrade this TiddlyWiki. You can only perform upgrades on TiddlyWiki files stored locally",
errorNotSaved: "You must save changes before you can perform an upgrade",
step2Title: "Confirm the upgrade details",
step2Html_downgrade: "You are about to downgrade to TiddlyWiki version %0 from %1.<br><br>Downgrading to an earlier version of the core code is not recommended",
step2Html_restore: "This TiddlyWiki appears to be already using the latest version of the core code (%0).<br><br>You can continue to upgrade anyway to ensure that the core code hasn't been corrupted or damaged",
step2Html_upgrade: "You are about to upgrade to TiddlyWiki version %0 from %1",
upgradeLabel: "upgrade",
upgradePrompt: "Prepare for the upgrade process",
statusPreparingBackup: "Preparing backup",
statusSavingBackup: "Saving backup file",
errorSavingBackup: "There was a problem saving the backup file",
statusLoadingCore: "Loading core code",
errorLoadingCore: "Error loading the core code",
errorCoreFormat: "Error with the new core code",
statusSavingCore: "Saving the new core code",
statusReloadingCore: "Reloading the new core code",
startLabel: "start",
startPrompt: "Start the upgrade process",
cancelLabel: "cancel",
cancelPrompt: "Cancel the upgrade process",
step3Title: "Upgrade cancelled",
step3Html: "You have cancelled the upgrade process"
});
merge(config.macros.annotations,{
});
merge(config.commands.closeTiddler,{
text: "close",
tooltip: "Close this tiddler"});
merge(config.commands.closeOthers,{
text: "close others",
tooltip: "Close all other tiddlers"});
merge(config.commands.editTiddler,{
text: "edit",
tooltip: "Edit this tiddler",
readOnlyText: "view",
readOnlyTooltip: "View the source of this tiddler"});
merge(config.commands.saveTiddler,{
text: "done",
tooltip: "Save changes to this tiddler"});
merge(config.commands.cancelTiddler,{
text: "cancel",
tooltip: "Undo changes to this tiddler",
warning: "Are you sure you want to abandon your changes to '%0'?",
readOnlyText: "done",
readOnlyTooltip: "View this tiddler normally"});
merge(config.commands.deleteTiddler,{
text: "delete",
tooltip: "Delete this tiddler",
warning: "Are you sure you want to delete '%0'?"});
merge(config.commands.permalink,{
text: "permalink",
tooltip: "Permalink for this tiddler"});
merge(config.commands.references,{
text: "references",
tooltip: "Show tiddlers that link to this one",
popupNone: "No references"});
merge(config.commands.jump,{
text: "jump",
tooltip: "Jump to another open tiddler"});
merge(config.commands.fields,{
text: "fields",
tooltip: "Show the extended fields of this tiddler",
emptyText: "There are no extended fields for this tiddler",
listViewTemplate: {
columns: [
{name: 'Field', field: 'field', title: "Field", type: 'String'},
{name: 'Value', field: 'value', title: "Value", type: 'String'}
],
rowClasses: [
],
buttons: [
]}});
merge(config.shadowTiddlers,{
DefaultTiddlers: "[[GettingStarted]]",
MainMenu: "[[GettingStarted]]",
SiteTitle: "My TiddlyWiki",
SiteSubtitle: "a reusable non-linear personal web notebook",
SiteUrl: "",
SideBarOptions: '<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel "options \u00bb" "Change TiddlyWiki advanced options">>',
SideBarTabs: '<<tabs txtMainTab "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>',
TabMore: '<<tabs txtMoreTab "Missing" "Missing tiddlers" TabMoreMissing "Orphans" "Orphaned tiddlers" TabMoreOrphans "Shadowed" "Shadowed tiddlers" TabMoreShadowed>>'
});
merge(config.annotations,{
AdvancedOptions: "This shadow tiddler provides access to several advanced options",
ColorPalette: "These values in this shadow tiddler determine the colour scheme of the ~TiddlyWiki user interface",
DefaultTiddlers: "The tiddlers listed in this shadow tiddler will be automatically displayed when ~TiddlyWiki starts up",
EditTemplate: "The HTML template in this shadow tiddler determines how tiddlers look while they are being edited",
GettingStarted: "This shadow tiddler provides basic usage instructions",
ImportTiddlers: "This shadow tiddler provides access to importing tiddlers",
MainMenu: "This shadow tiddler is used as the contents of the main menu in the left-hand column of the screen",
MarkupPreHead: "This tiddler is inserted at the top of the <head> section of the TiddlyWiki HTML file",
MarkupPostHead: "This tiddler is inserted at the bottom of the <head> section of the TiddlyWiki HTML file",
MarkupPreBody: "This tiddler is inserted at the top of the <body> section of the TiddlyWiki HTML file",
MarkupPostBody: "This tiddler is inserted at the end of the <body> section of the TiddlyWiki HTML file immediately after the script block",
OptionsPanel: "This shadow tiddler is used as the contents of the options panel slider in the right-hand sidebar",
PageTemplate: "The HTML template in this shadow tiddler determines the overall ~TiddlyWiki layout",
PluginManager: "This shadow tiddler provides access to the plugin manager",
SideBarOptions: "This shadow tiddler is used as the contents of the option panel in the right-hand sidebar",
SideBarTabs: "This shadow tiddler is used as the contents of the tabs panel in the right-hand sidebar",
SiteSubtitle: "This shadow tiddler is used as the second part of the page title",
SiteTitle: "This shadow tiddler is used as the first part of the page title",
SiteUrl: "This shadow tiddler should be set to the full target URL for publication",
StyleSheetColors: "This shadow tiddler contains CSS definitions related to the color of page elements. ''DO NOT EDIT THIS TIDDLER'', instead make your changes in the StyleSheet shadow tiddler",
StyleSheet: "This tiddler can contain custom CSS definitions",
StyleSheetLayout: "This shadow tiddler contains CSS definitions related to the layout of page elements. ''DO NOT EDIT THIS TIDDLER'', instead make your changes in the StyleSheet shadow tiddler",
StyleSheetLocale: "This shadow tiddler contains CSS definitions related to the translation locale",
StyleSheetPrint: "This shadow tiddler contains CSS definitions for printing",
SystemSettings: "This tiddler is used to store configuration options for this TiddlyWiki document",
TabAll: "This shadow tiddler contains the contents of the 'All' tab in the right-hand sidebar",
TabMore: "This shadow tiddler contains the contents of the 'More' tab in the right-hand sidebar",
TabMoreMissing: "This shadow tiddler contains the contents of the 'Missing' tab in the right-hand sidebar",
TabMoreOrphans: "This shadow tiddler contains the contents of the 'Orphans' tab in the right-hand sidebar",
TabMoreShadowed: "This shadow tiddler contains the contents of the 'Shadowed' tab in the right-hand sidebar",
TabTags: "This shadow tiddler contains the contents of the 'Tags' tab in the right-hand sidebar",
TabTimeline: "This shadow tiddler contains the contents of the 'Timeline' tab in the right-hand sidebar",
ToolbarCommands: "This shadow tiddler determines which commands are shown in tiddler toolbars",
ViewTemplate: "The HTML template in this shadow tiddler determines how tiddlers look"
});
//--
//-- Main
//--
var params = null; // Command line parameters
var store = null; // TiddlyWiki storage
var story = null; // Main story
var formatter = null; // Default formatters for the wikifier
var anim = typeof Animator == "function" ? new Animator() : null; // Animation engine
var readOnly = false; // Whether we're in readonly mode
var highlightHack = null; // Embarrassing hack department...
var hadConfirmExit = false; // Don't warn more than once
var safeMode = false; // Disable all plugins and cookies
var showBackstage; // Whether to include the backstage area
var installedPlugins = []; // Information filled in when plugins are executed
var startingUp = false; // Whether we're in the process of starting up
var pluginInfo,tiddler; // Used to pass information to plugins in loadPlugins()
// Whether this file can be saved back to the same location [Preemption]
window.allowSave = window.allowSave || function(l)
{
return true;
}
// Whether this file is being viewed locally
window.isLocal = function()
{
return (document.location.protocol == "file:");
}
// Whether to use the JavaSaver applet
var useJavaSaver = window.isLocal() && (config.browser.isSafari || config.browser.isOpera);
// Allow preemption code a chance to tweak config and useJavaSaver [Preemption]
if (window.tweakConfig) window.tweakConfig();
if(!window || !window.console) {
console = {tiddlywiki:true,log:function(message) {displayMessage(message);}};
}
// Starting up
function main()
{
window.originalHTML=recreateOriginal();
var t10,t9,t8,t7,t6,t5,t4,t3,t2,t1,t0 = new Date();
startingUp = true;
var doc = jQuery(document);
jQuery.noConflict();
window.onbeforeunload = function(e) {if(window.confirmExit) return confirmExit();};
params = getParameters();
if(params)
params = params.parseParams("open",null,false);
store = new TiddlyWiki({config:config});
invokeParamifier(params,"oninit");
story = new Story("tiddlerDisplay","tiddler");
addEvent(document,"click",Popup.onDocumentClick);
saveTest();
var s;
for(s=0; s<config.notifyTiddlers.length; s++)
store.addNotification(config.notifyTiddlers[s].name,config.notifyTiddlers[s].notify);
t1 = new Date();
loadShadowTiddlers();
doc.trigger("loadShadows");
t2 = new Date();
store.loadFromDiv("storeArea","store",true);
doc.trigger("loadTiddlers");
loadOptions();
t3 = new Date();
invokeParamifier(params,"onload");
t4 = new Date();
readOnly = window.isLocal() ? false : config.options.chkHttpReadOnly;
var pluginProblem = loadPlugins("systemConfig");
doc.trigger("loadPlugins");
t5 = new Date();
formatter = new Formatter(config.formatters);
invokeParamifier(params,"onconfig");
story.switchTheme(config.options.txtTheme);
showBackstage = showBackstage !== undefined ? showBackstage : !readOnly;
t6 = new Date();
var m;
for(m in config.macros) {
if(config.macros[m].init)
config.macros[m].init();
}
t7 = new Date();
store.notifyAll();
t8 = new Date();
restart();
refreshDisplay();
t9 = new Date();
if(pluginProblem) {
story.displayTiddler(null,"PluginManager");
displayMessage(config.messages.customConfigError);
}
if(showBackstage)
backstage.init();
t10 = new Date();
if(config.options.chkDisplayInstrumentation) {
displayMessage("LoadShadows " + (t2-t1) + " ms");
displayMessage("LoadFromDiv " + (t3-t2) + " ms");
displayMessage("LoadPlugins " + (t5-t4) + " ms");
displayMessage("Macro init " + (t7-t6) + " ms");
displayMessage("Notify " + (t8-t7) + " ms");
displayMessage("Restart " + (t9-t8) + " ms");
displayMessage("Total: " + (t10-t0) + " ms");
}
startingUp = false;
doc.trigger("startup");
}
// Called on unload. All functions called conditionally since they themselves may have been unloaded.
function unload()
{
if(window.checkUnsavedChanges)
checkUnsavedChanges();
if(window.scrubNodes)
scrubNodes(document.body);
}
// Restarting
function restart()
{
invokeParamifier(params,"onstart");
if(story.isEmpty()) {
story.displayDefaultTiddlers();
}
window.scrollTo(0,0);
}
function saveTest()
{
var s = document.getElementById("saveTest");
if(s.hasChildNodes())
alert(config.messages.savedSnapshotError);
s.appendChild(document.createTextNode("savetest"));
}
function loadShadowTiddlers()
{
var shadows = new TiddlyWiki();
shadows.loadFromDiv("shadowArea","shadows",true);
shadows.forEachTiddler(function(title,tiddler){config.shadowTiddlers[title] = tiddler.text;});
}
function loadPlugins(tag)
{
if(safeMode)
return false;
var tiddlers = store.getTaggedTiddlers(tag);
tiddlers.sort(function(a,b) {return a.title < b.title ? -1 : (a.title == b.title ? 0 : 1);});
var toLoad = [];
var nLoaded = 0;
var map = {};
var nPlugins = tiddlers.length;
installedPlugins = [];
var i;
for(i=0; i<nPlugins; i++) {
var p = getPluginInfo(tiddlers[i]);
installedPlugins[i] = p;
var n = p.Name || p.title;
if(n)
map[n] = p;
n = p.Source;
if(n)
map[n] = p;
}
var visit = function(p) {
if(!p || p.done)
return;
p.done = 1;
var reqs = p.Requires;
if(reqs) {
reqs = reqs.readBracketedList();
var i;
for(i=0; i<reqs.length; i++)
visit(map[reqs[i]]);
}
toLoad.push(p);
};
for(i=0; i<nPlugins; i++)
visit(installedPlugins[i]);
for(i=0; i<toLoad.length; i++) {
p = toLoad[i];
pluginInfo = p;
tiddler = p.tiddler;
if(isPluginExecutable(p)) {
if(isPluginEnabled(p)) {
p.executed = true;
var startTime = new Date();
try {
if(tiddler.text)
window.eval(tiddler.text);
nLoaded++;
} catch(ex) {
p.log.push(config.messages.pluginError.format([exceptionText(ex)]));
p.error = true;
if(!console.tiddlywiki) {
console.log("error evaluating " + tiddler.title, ex);
}
}
pluginInfo.startupTime = String((new Date()) - startTime) + "ms";
} else {
nPlugins--;
}
} else {
p.warning = true;
}
}
return nLoaded != nPlugins;
}
function getPluginInfo(tiddler)
{
var p = store.getTiddlerSlices(tiddler.title,["Name","Description","Version","Requires","CoreVersion","Date","Source","Author","License","Browsers"]);
p.tiddler = tiddler;
p.title = tiddler.title;
p.log = [];
return p;
}
// Check that a particular plugin is valid for execution
function isPluginExecutable(plugin)
{
if(plugin.tiddler.isTagged("systemConfigForce")) {
plugin.log.push(config.messages.pluginForced);
return true;
}
if(plugin["CoreVersion"]) {
var coreVersion = plugin["CoreVersion"].split(".");
var w = parseInt(coreVersion[0],10) - version.major;
if(w == 0 && coreVersion[1])
w = parseInt(coreVersion[1],10) - version.minor;
if(w == 0 && coreVersion[2])
w = parseInt(coreVersion[2],10) - version.revision;
if(w > 0) {
plugin.log.push(config.messages.pluginVersionError);
return false;
}
}
return true;
}
function isPluginEnabled(plugin)
{
if(plugin.tiddler.isTagged("systemConfigDisable")) {
plugin.log.push(config.messages.pluginDisabled);
return false;
}
return true;
}
//--
//-- Paramifiers
//--
function getParameters()
{
var p = null;
if(window.location.hash) {
p = decodeURIComponent(window.location.hash.substr(1));
if(config.browser.firefoxDate != null && config.browser.firefoxDate[1] < "20051111")
p = convertUTF8ToUnicode(p);
}
return p;
}
function invokeParamifier(params,handler)
{
if(!params || params.length == undefined || params.length <= 1)
return;
var i;
for(i=1; i<params.length; i++) {
var p = config.paramifiers[params[i].name];
if(p && p[handler] instanceof Function)
p[handler](params[i].value);
else {
var h = config.optionHandlers[params[i].name.substr(0,3)];
if(h && h.set instanceof Function)
h.set(params[i].name,params[i].value);
}
}
}
config.paramifiers = {};
config.paramifiers.start = {
oninit: function(v) {
safeMode = v.toLowerCase() == "safe";
}
};
config.paramifiers.open = {
onstart: function(v) {
if(!readOnly || store.tiddlerExists(v) || store.isShadowTiddler(v))
story.displayTiddler("bottom",v,null,false,null);
}
};
config.paramifiers.story = {
onstart: function(v) {
var list = store.getTiddlerText(v,"").parseParams("open",null,false);
invokeParamifier(list,"onstart");
}
};
config.paramifiers.search = {
onstart: function(v) {
story.search(v,false,false);
}
};
config.paramifiers.searchRegExp = {
onstart: function(v) {
story.prototype.search(v,false,true);
}
};
config.paramifiers.tag = {
onstart: function(v) {
story.displayTiddlers(null,store.filterTiddlers("[tag["+v+"]]"),null,false,null);
}
};
config.paramifiers.newTiddler = {
onstart: function(v) {
var args = v.parseParams("anon", null, null)[0];
var title = args.title ? args.title[0] : v;
var customFields = args.fields ? args.fields[0] : null;
if(!readOnly) {
story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE,false,null,customFields);
story.focusTiddler(title,"text");
var i,tags = args.tag || [];
for(i=0;i<tags.length;i++) {
story.setTiddlerTag(title,tags[i],+1);
}
}
}
};
config.paramifiers.newJournal = {
onstart: function(v) {
if(!readOnly) {
var now = new Date();
var title = now.formatString(v.trim());
story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE);
story.focusTiddler(title,"text");
}
}
};
config.paramifiers.readOnly = {
onconfig: function(v) {
var p = v.toLowerCase();
readOnly = p == "yes" ? true : (p == "no" ? false : readOnly);
}
};
config.paramifiers.theme = {
onconfig: function(v) {
story.switchTheme(v);
}
};
config.paramifiers.upgrade = {
onstart: function(v) {
upgradeFrom(v);
}
};
config.paramifiers.recent= {
onstart: function(v) {
var titles=[];
var i,tiddlers=store.getTiddlers("modified","excludeLists").reverse();
for(i=0; i<v && i<tiddlers.length; i++)
titles.push(tiddlers[i].title);
story.displayTiddlers(null,titles);
}
};
config.paramifiers.filter = {
onstart: function(v) {
story.displayTiddlers(null,store.filterTiddlers(v),null,false);
}
};
//--
//-- Formatter helpers
//--
function Formatter(formatters)
{
var n;
this.formatters = [];
var pattern = [];
for(n=0; n<formatters.length; n++) {
pattern.push("(" + formatters[n].match + ")");
this.formatters.push(formatters[n]);
}
this.formatterRegExp = new RegExp(pattern.join("|"),"mg");
}
config.formatterHelpers = {
createElementAndWikify: function(w)
{
w.subWikifyTerm(createTiddlyElement(w.output,this.element),this.termRegExp);
},
inlineCssHelper: function(w)
{
var styles = [];
config.textPrimitives.cssLookaheadRegExp.lastIndex = w.nextMatch;
var lookaheadMatch = config.textPrimitives.cssLookaheadRegExp.exec(w.source);
while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
var s,v;
if(lookaheadMatch[1]) {
s = lookaheadMatch[1].unDash();
v = lookaheadMatch[2];
} else {
s = lookaheadMatch[3].unDash();
v = lookaheadMatch[4];
}
if(s=="bgcolor")
s = "backgroundColor";
if(s=="float")
s = "cssFloat";
styles.push({style: s, value: v});
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
config.textPrimitives.cssLookaheadRegExp.lastIndex = w.nextMatch;
lookaheadMatch = config.textPrimitives.cssLookaheadRegExp.exec(w.source);
}
return styles;
},
applyCssHelper: function(e,styles)
{
var t;
for(t=0; t< styles.length; t++) {
try {
e.style[styles[t].style] = styles[t].value;
} catch (ex) {
}
}
},
enclosedTextHelper: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var text = lookaheadMatch[1];
if(config.browser.isIE && (config.browser.ieVersion[1] < 10))
text = text.replace(/\n/g,"\r");
createTiddlyElement(w.output,this.element,null,null,text);
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
},
isExternalLink: function(link)
{
if(store.tiddlerExists(link) || store.isShadowTiddler(link)) {
return false;
}
var urlRegExp = new RegExp(config.textPrimitives.urlPattern,"mg");
if(urlRegExp.exec(link)) {
return true;
}
if(link.indexOf(".")!=-1 || link.indexOf("\\")!=-1 || link.indexOf("/")!=-1 || link.indexOf("#")!=-1) {
return true;
}
return false;
}
};
//--
//-- Standard formatters
//--
config.formatters = [
{
name: "table",
match: "^\\|(?:[^\\n]*)\\|(?:[fhck]?)$",
lookaheadRegExp: /^\|([^\n]*)\|([fhck]?)$/mg,
rowTermRegExp: /(\|(?:[fhck]?)$\n?)/mg,
cellRegExp: /(?:\|([^\n\|]*)\|)|(\|[fhck]?$\n?)/mg,
cellTermRegExp: /((?:\x20*)\|)/mg,
rowTypes: {"c":"caption", "h":"thead", "":"tbody", "f":"tfoot"},
handler: function(w)
{
var table = createTiddlyElement(w.output,"table",null,"twtable");
var prevColumns = [];
var currRowType = null;
var rowContainer;
var rowCount = 0;
var onmouseover = function() {jQuery(this).addClass("hoverRow");};
var onmouseout = function() {jQuery(this).removeClass("hoverRow");};
w.nextMatch = w.matchStart;
this.lookaheadRegExp.lastIndex = w.nextMatch;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
var nextRowType = lookaheadMatch[2];
if(nextRowType == "k") {
table.className = lookaheadMatch[1];
w.nextMatch += lookaheadMatch[0].length+1;
} else {
if(nextRowType != currRowType) {
rowContainer = createTiddlyElement(table,this.rowTypes[nextRowType]);
currRowType = nextRowType;
}
if(currRowType == "c") {
// Caption
w.nextMatch++;
if(rowContainer != table.firstChild)
table.insertBefore(rowContainer,table.firstChild);
rowContainer.setAttribute("align",rowCount == 0?"top":"bottom");
w.subWikifyTerm(rowContainer,this.rowTermRegExp);
} else {
var theRow = createTiddlyElement(rowContainer,"tr",null,rowCount%2?"oddRow":"evenRow");
theRow.onmouseover = onmouseover;
theRow.onmouseout = onmouseout;
this.rowHandler(w,theRow,prevColumns);
rowCount++;
}
}
this.lookaheadRegExp.lastIndex = w.nextMatch;
lookaheadMatch = this.lookaheadRegExp.exec(w.source);
}
},
rowHandler: function(w,e,prevColumns)
{
var col = 0;
var colSpanCount = 1;
var prevCell = null;
this.cellRegExp.lastIndex = w.nextMatch;
var cellMatch = this.cellRegExp.exec(w.source);
while(cellMatch && cellMatch.index == w.nextMatch) {
if(cellMatch[1] == "~") {
// Rowspan
var last = prevColumns[col];
if(last) {
last.rowSpanCount++;
last.element.setAttribute("rowspan",last.rowSpanCount);
last.element.setAttribute("rowSpan",last.rowSpanCount); // Needed for IE
last.element.valign = "center";
if(colSpanCount > 1) {
last.element.setAttribute("colspan",colSpanCount);
last.element.setAttribute("colSpan",colSpanCount); // Needed for IE
colSpanCount = 1;
}
}
w.nextMatch = this.cellRegExp.lastIndex-1;
} else if(cellMatch[1] == ">") {
// Colspan
colSpanCount++;
w.nextMatch = this.cellRegExp.lastIndex-1;
} else if(cellMatch[2]) {
// End of row
if(prevCell && colSpanCount > 1) {
prevCell.setAttribute("colspan",colSpanCount);
prevCell.setAttribute("colSpan",colSpanCount); // Needed for IE
}
w.nextMatch = this.cellRegExp.lastIndex;
break;
} else {
// Cell
w.nextMatch++;
var styles = config.formatterHelpers.inlineCssHelper(w);
var spaceLeft = false;
var chr = w.source.substr(w.nextMatch,1);
while(chr == " ") {
spaceLeft = true;
w.nextMatch++;
chr = w.source.substr(w.nextMatch,1);
}
var cell;
if(chr == "!") {
cell = createTiddlyElement(e,"th");
w.nextMatch++;
} else {
cell = createTiddlyElement(e,"td");
}
prevCell = cell;
prevColumns[col] = {rowSpanCount:1,element:cell};
if(colSpanCount > 1) {
cell.setAttribute("colspan",colSpanCount);
cell.setAttribute("colSpan",colSpanCount); // Needed for IE
colSpanCount = 1;
}
config.formatterHelpers.applyCssHelper(cell,styles);
w.subWikifyTerm(cell,this.cellTermRegExp);
if(w.matchText.substr(w.matchText.length-2,1) == " ") // spaceRight
cell.align = spaceLeft ? "center" : "left";
else if(spaceLeft)
cell.align = "right";
w.nextMatch--;
}
col++;
this.cellRegExp.lastIndex = w.nextMatch;
cellMatch = this.cellRegExp.exec(w.source);
}
}
},
{
name: "heading",
match: "^!{1,6}",
termRegExp: /(\n)/mg,
handler: function(w)
{
w.subWikifyTerm(createTiddlyElement(w.output,"h" + w.matchLength),this.termRegExp);
}
},
{
name: "list",
match: "^(?:[\\*#;:]+)",
lookaheadRegExp: /^(?:(?:(\*)|(#)|(;)|(:))+)/mg,
termRegExp: /(\n)/mg,
handler: function(w)
{
var stack = [w.output];
var currLevel = 0, currType = null;
var listLevel, listType, itemType, baseType;
w.nextMatch = w.matchStart;
this.lookaheadRegExp.lastIndex = w.nextMatch;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
while(lookaheadMatch && lookaheadMatch.index == w.nextMatch) {
if(lookaheadMatch[1]) {
listType = "ul";
itemType = "li";
} else if(lookaheadMatch[2]) {
listType = "ol";
itemType = "li";
} else if(lookaheadMatch[3]) {
listType = "dl";
itemType = "dt";
} else if(lookaheadMatch[4]) {
listType = "dl";
itemType = "dd";
}
if(!baseType)
baseType = listType;
listLevel = lookaheadMatch[0].length;
w.nextMatch += lookaheadMatch[0].length;
var t;
if(listLevel > currLevel) {
for(t=currLevel; t<listLevel; t++) {
var target = (currLevel == 0) ? stack[stack.length-1] : stack[stack.length-1].lastChild;
stack.push(createTiddlyElement(target,listType));
}
} else if(listType!=baseType && listLevel==1) {
w.nextMatch -= lookaheadMatch[0].length;
return;
} else if(listLevel < currLevel) {
for(t=currLevel; t>listLevel; t--)
stack.pop();
} else if(listLevel == currLevel && listType != currType) {
stack.pop();
stack.push(createTiddlyElement(stack[stack.length-1].lastChild,listType));
}
currLevel = listLevel;
currType = listType;
var e = createTiddlyElement(stack[stack.length-1],itemType);
w.subWikifyTerm(e,this.termRegExp);
this.lookaheadRegExp.lastIndex = w.nextMatch;
lookaheadMatch = this.lookaheadRegExp.exec(w.source);
}
}
},
{
name: "quoteByBlock",
match: "^<<<\\n",
termRegExp: /(^<<<(\n|$))/mg,
element: "blockquote",
handler: config.formatterHelpers.createElementAndWikify
},
{
name: "quoteByLine",
match: "^>+",
lookaheadRegExp: /^>+/mg,
termRegExp: /(\n)/mg,
element: "blockquote",
handler: function(w)
{
var stack = [w.output];
var currLevel = 0;
var newLevel = w.matchLength;
var t,matched;
do {
if(newLevel > currLevel) {
for(t=currLevel; t<newLevel; t++)
stack.push(createTiddlyElement(stack[stack.length-1],this.element));
} else if(newLevel < currLevel) {
for(t=currLevel; t>newLevel; t--)
stack.pop();
}
currLevel = newLevel;
w.subWikifyTerm(stack[stack.length-1],this.termRegExp);
createTiddlyElement(stack[stack.length-1],"br");
this.lookaheadRegExp.lastIndex = w.nextMatch;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
matched = lookaheadMatch && lookaheadMatch.index == w.nextMatch;
if(matched) {
newLevel = lookaheadMatch[0].length;
w.nextMatch += lookaheadMatch[0].length;
}
} while(matched);
}
},
{
name: "rule",
match: "^----+$\\n?|<hr ?/?>\\n?",
handler: function(w)
{
createTiddlyElement(w.output,"hr");
}
},
{
name: "monospacedByLine",
match: "^(?:/\\*\\{\\{\\{\\*/|\\{\\{\\{|//\\{\\{\\{|<!--\\{\\{\\{-->)\\n",
element: "pre",
handler: function(w)
{
switch(w.matchText) {
case "/*{{{*/\n": // CSS
this.lookaheadRegExp = /\/\*\{\{\{\*\/\n*((?:^[^\n]*\n)+?)(\n*^\f*\/\*\}\}\}\*\/$\n?)/mg;
break;
case "{{{\n": // monospaced block
this.lookaheadRegExp = /^\{\{\{\n((?:^[^\n]*\n)+?)(^\f*\}\}\}$\n?)/mg;
break;
case "//{{{\n": // plugin
this.lookaheadRegExp = /^\/\/\{\{\{\n\n*((?:^[^\n]*\n)+?)(\n*^\f*\/\/\}\}\}$\n?)/mg;
break;
case "<!--{{{-->\n": //template
this.lookaheadRegExp = /<!--\{\{\{-->\n*((?:^[^\n]*\n)+?)(\n*^\f*<!--\}\}\}-->$\n?)/mg;
break;
default:
break;
}
config.formatterHelpers.enclosedTextHelper.call(this,w);
}
},
{
name: "wikifyComment",
match: "^(?:/\\*\\*\\*|<!---)\\n",
handler: function(w)
{
var termRegExp = (w.matchText == "/***\n") ? (/(^\*\*\*\/\n)/mg) : (/(^--->\n)/mg);
w.subWikifyTerm(w.output,termRegExp);
}
},
{
name: "macro",
match: "<<",
lookaheadRegExp: /<<([^>\s]+)(?:\s*)((?:[^>]|(?:>(?!>)))*)>>/mg,
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart && lookaheadMatch[1]) {
w.nextMatch = this.lookaheadRegExp.lastIndex;
invokeMacro(w.output,lookaheadMatch[1],lookaheadMatch[2],w,w.tiddler);
}
}
},
{
name: "prettyLink",
match: "\\[\\[",
lookaheadRegExp: /\[\[(.*?)(?:\|(~)?(.*?))?\]\]/mg,
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var e;
var text = lookaheadMatch[1];
if(lookaheadMatch[3]) {
// Pretty bracketted link
var link = lookaheadMatch[3];
e = (!lookaheadMatch[2] && config.formatterHelpers.isExternalLink(link)) ?
createExternalLink(w.output,link) : createTiddlyLink(w.output,link,false,null,w.isStatic,w.tiddler);
} else {
// Simple bracketted link
e = createTiddlyLink(w.output,text,false,null,w.isStatic,w.tiddler);
}
createTiddlyText(e,text);
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
},
{
name: "wikiLink",
match: config.textPrimitives.unWikiLink+"?"+config.textPrimitives.wikiLink,
handler: function(w)
{
if(w.matchText.substr(0,1) == config.textPrimitives.unWikiLink) {
w.outputText(w.output,w.matchStart+1,w.nextMatch);
return;
}
if(w.matchStart > 0) {
var preRegExp = new RegExp(config.textPrimitives.anyLetterStrict,"mg");
preRegExp.lastIndex = w.matchStart-1;
var preMatch = preRegExp.exec(w.source);
if(preMatch.index == w.matchStart-1) {
w.outputText(w.output,w.matchStart,w.nextMatch);
return;
}
}
if(w.autoLinkWikiWords || store.isShadowTiddler(w.matchText)) {
var link = createTiddlyLink(w.output,w.matchText,false,null,w.isStatic,w.tiddler);
w.outputText(link,w.matchStart,w.nextMatch);
} else {
w.outputText(w.output,w.matchStart,w.nextMatch);
}
}
},
{
name: "urlLink",
match: config.textPrimitives.urlPattern,
handler: function(w)
{
w.outputText(createExternalLink(w.output,w.matchText),w.matchStart,w.nextMatch);
}
},
{
name: "image",
match: "\\[[<>]?[Ii][Mm][Gg]\\[",
lookaheadRegExp: /\[([<]?)(>?)[Ii][Mm][Gg]\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg,
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var e = w.output;
if(lookaheadMatch[5]) {
var link = lookaheadMatch[5];
e = config.formatterHelpers.isExternalLink(link) ? createExternalLink(w.output,link) : createTiddlyLink(w.output,link,false,null,w.isStatic,w.tiddler);
jQuery(e).addClass("imageLink");
}
var img = createTiddlyElement(e,"img");
if(lookaheadMatch[1])
img.align = "left";
else if(lookaheadMatch[2])
img.align = "right";
if(lookaheadMatch[3]) {
img.title = lookaheadMatch[3];
img.setAttribute("alt",lookaheadMatch[3]);
}
img.src = lookaheadMatch[4];
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
},
{
name: "html",
match: "<[Hh][Tt][Mm][Ll]>",
lookaheadRegExp: /<[Hh][Tt][Mm][Ll]>((?:.|\n)*?)<\/[Hh][Tt][Mm][Ll]>/mg,
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
createTiddlyElement(w.output,"span").innerHTML = lookaheadMatch[1];
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
},
{
name: "commentByBlock",
match: "/%",
lookaheadRegExp: /\/%((?:.|\n)*?)%\//mg,
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart)
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
},
{
name: "characterFormat",
match: "''|//|__|\\^\\^|~~|--(?!\\s|$)|\\{\\{\\{",
handler: function(w)
{
switch(w.matchText) {
case "''":
w.subWikifyTerm(w.output.appendChild(document.createElement("strong")),/('')/mg);
break;
case "//":
w.subWikifyTerm(createTiddlyElement(w.output,"em"),/(\/\/)/mg);
break;
case "__":
w.subWikifyTerm(createTiddlyElement(w.output,"u"),/(__)/mg);
break;
case "^^":
w.subWikifyTerm(createTiddlyElement(w.output,"sup"),/(\^\^)/mg);
break;
case "~~":
w.subWikifyTerm(createTiddlyElement(w.output,"sub"),/(~~)/mg);
break;
case "--":
w.subWikifyTerm(createTiddlyElement(w.output,"strike"),/(--)/mg);
break;
case "{{{":
var lookaheadRegExp = /\{\{\{((?:.|\n)*?)\}\}\}/mg;
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
createTiddlyElement(w.output,"code",null,null,lookaheadMatch[1]);
w.nextMatch = lookaheadRegExp.lastIndex;
}
break;
}
}
},
{
name: "customFormat",
match: "@@|\\{\\{",
handler: function(w)
{
switch(w.matchText) {
case "@@":
var e = createTiddlyElement(w.output,"span");
var styles = config.formatterHelpers.inlineCssHelper(w);
if(styles.length == 0)
e.className = "marked";
else
config.formatterHelpers.applyCssHelper(e,styles);
w.subWikifyTerm(e,/(@@)/mg);
break;
case "{{":
var lookaheadRegExp = /\{\{[\s]*([\w]+[\s\w]*)[\s]*\{(\n?)/mg;
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source);
if(lookaheadMatch) {
w.nextMatch = lookaheadRegExp.lastIndex;
e = createTiddlyElement(w.output,lookaheadMatch[2] == "\n" ? "div" : "span",null,lookaheadMatch[1]);
w.subWikifyTerm(e,/(\}\}\})/mg);
}
break;
}
}
},
{
name: "mdash",
match: "--",
handler: function(w)
{
createTiddlyElement(w.output,"span").innerHTML = "—";
}
},
{
name: "lineBreak",
match: "\\n|<br ?/?>",
handler: function(w)
{
createTiddlyElement(w.output,"br");
}
},
{
name: "rawText",
match: "\"{3}|<nowiki>",
lookaheadRegExp: /(?:\"{3}|<nowiki>)((?:.|\n)*?)(?:\"{3}|<\/nowiki>)/mg,
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
createTiddlyElement(w.output,"span",null,null,lookaheadMatch[1]);
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
},
{
name: "htmlEntitiesEncoding",
match: "(?:(?:&#?[a-zA-Z0-9]{2,8};|.)(?:&#?(?:x0*(?:3[0-6][0-9a-fA-F]|1D[c-fC-F][0-9a-fA-F]|20[d-fD-F][0-9a-fA-F]|FE2[0-9a-fA-F])|0*(?:76[89]|7[7-9][0-9]|8[0-7][0-9]|761[6-9]|76[2-7][0-9]|84[0-3][0-9]|844[0-7]|6505[6-9]|6506[0-9]|6507[0-1]));)+|&#?[a-zA-Z0-9]{2,8};)",
handler: function(w)
{
createTiddlyElement(w.output,"span").innerHTML = w.matchText;
}
}
];
//--
//-- Wikifier
//--
function getParser(tiddler,format)
{
if(tiddler) {
if(!format)
format = tiddler.fields["wikiformat"];
var i;
if(format) {
for(i in config.parsers) {
if(format == config.parsers[i].format)
return config.parsers[i];
}
} else {
for(i in config.parsers) {
if(tiddler.isTagged(config.parsers[i].formatTag))
return config.parsers[i];
}
}
}
return formatter;
}
function Wikifier(source,formatter,highlightRegExp,tiddler)
{
this.source = source;
this.output = null;
this.formatter = formatter;
this.nextMatch = 0;
this.autoLinkWikiWords = tiddler && tiddler.autoLinkWikiWords() == false ? false : true;
this.highlightRegExp = highlightRegExp;
this.highlightMatch = null;
this.isStatic = false;
if(highlightRegExp) {
highlightRegExp.lastIndex = 0;
this.highlightMatch = highlightRegExp.exec(source);
}
this.tiddler = tiddler;
}
Wikifier.prototype.wikifyPlain = function()
{
var e = createTiddlyElement(document.body,"div");
e.style.display = "none";
this.subWikify(e);
var text = jQuery(e).text();
jQuery(e).remove();
return text;
};
Wikifier.prototype.subWikify = function(output,terminator)
{
try {
if(terminator)
this.subWikifyTerm(output,new RegExp("(" + terminator + ")","mg"));
else
this.subWikifyUnterm(output);
} catch(ex) {
showException(ex);
}
};
Wikifier.prototype.subWikifyUnterm = function(output)
{
var oldOutput = this.output;
this.output = output;
this.formatter.formatterRegExp.lastIndex = this.nextMatch;
var formatterMatch = this.formatter.formatterRegExp.exec(this.source);
while(formatterMatch) {
// Output any text before the match
if(formatterMatch.index > this.nextMatch)
this.outputText(this.output,this.nextMatch,formatterMatch.index);
// Set the match parameters for the handler
this.matchStart = formatterMatch.index;
this.matchLength = formatterMatch[0].length;
this.matchText = formatterMatch[0];
this.nextMatch = this.formatter.formatterRegExp.lastIndex;
var t;
for(t=1; t<formatterMatch.length; t++) {
if(formatterMatch[t]) {
this.formatter.formatters[t-1].handler(this);
this.formatter.formatterRegExp.lastIndex = this.nextMatch;
break;
}
}
formatterMatch = this.formatter.formatterRegExp.exec(this.source);
}
if(this.nextMatch < this.source.length) {
this.outputText(this.output,this.nextMatch,this.source.length);
this.nextMatch = this.source.length;
}
this.output = oldOutput;
};
Wikifier.prototype.subWikifyTerm = function(output,terminatorRegExp)
{
var oldOutput = this.output;
this.output = output;
terminatorRegExp.lastIndex = this.nextMatch;
var terminatorMatch = terminatorRegExp.exec(this.source);
this.formatter.formatterRegExp.lastIndex = this.nextMatch;
var formatterMatch = this.formatter.formatterRegExp.exec(terminatorMatch ? this.source.substr(0,terminatorMatch.index) : this.source);
while(terminatorMatch || formatterMatch) {
if(terminatorMatch && (!formatterMatch || terminatorMatch.index <= formatterMatch.index)) {
if(terminatorMatch.index > this.nextMatch)
this.outputText(this.output,this.nextMatch,terminatorMatch.index);
this.matchText = terminatorMatch[1];
this.matchLength = terminatorMatch[1].length;
this.matchStart = terminatorMatch.index;
this.nextMatch = this.matchStart + this.matchLength;
this.output = oldOutput;
return;
}
if(formatterMatch.index > this.nextMatch)
this.outputText(this.output,this.nextMatch,formatterMatch.index);
this.matchStart = formatterMatch.index;
this.matchLength = formatterMatch[0].length;
this.matchText = formatterMatch[0];
this.nextMatch = this.formatter.formatterRegExp.lastIndex;
var t;
for(t=1; t<formatterMatch.length; t++) {
if(formatterMatch[t]) {
this.formatter.formatters[t-1].handler(this);
this.formatter.formatterRegExp.lastIndex = this.nextMatch;
break;
}
}
terminatorRegExp.lastIndex = this.nextMatch;
terminatorMatch = terminatorRegExp.exec(this.source);
formatterMatch = this.formatter.formatterRegExp.exec(terminatorMatch ? this.source.substr(0,terminatorMatch.index) : this.source);
}
if(this.nextMatch < this.source.length) {
this.outputText(this.output,this.nextMatch,this.source.length);
this.nextMatch = this.source.length;
}
this.output = oldOutput;
};
Wikifier.prototype.outputText = function(place,startPos,endPos)
{
while(this.highlightMatch && (this.highlightRegExp.lastIndex > startPos) && (this.highlightMatch.index < endPos) && (startPos < endPos)) {
if(this.highlightMatch.index > startPos) {
createTiddlyText(place,this.source.substring(startPos,this.highlightMatch.index));
startPos = this.highlightMatch.index;
}
var highlightEnd = Math.min(this.highlightRegExp.lastIndex,endPos);
createTiddlyElement(place,"span",null,"highlight",this.source.substring(startPos,highlightEnd));
startPos = highlightEnd;
if(startPos >= this.highlightRegExp.lastIndex)
this.highlightMatch = this.highlightRegExp.exec(this.source);
}
if(startPos < endPos) {
createTiddlyText(place,this.source.substring(startPos,endPos));
}
};
function wikify(source,output,highlightRegExp,tiddler)
{
if(source) {
var wikifier = new Wikifier(source,getParser(tiddler),highlightRegExp,tiddler);
var t0 = new Date();
wikifier.subWikify(output);
if(tiddler && config.options.chkDisplayInstrumentation)
displayMessage("wikify:" +tiddler.title+ " in " + (new Date()-t0) + " ms");
}
}
function wikifyStatic(source,highlightRegExp,tiddler,format)
{
var e = createTiddlyElement(document.body,"pre");
e.style.display = "none";
var html = "";
if(source && source != "") {
if(!tiddler)
tiddler = new Tiddler("temp");
var wikifier = new Wikifier(source,getParser(tiddler,format),highlightRegExp,tiddler);
wikifier.isStatic = true;
wikifier.subWikify(e);
html = e.innerHTML;
jQuery(e).remove();
}
return html;
}
function wikifyPlainText(text,limit,tiddler)
{
if(limit > 0)
text = text.substr(0,limit);
var wikifier = new Wikifier(text,formatter,null,tiddler);
return wikifier.wikifyPlain();
}
function highlightify(source,output,highlightRegExp,tiddler)
{
if(source) {
var wikifier = new Wikifier(source,formatter,highlightRegExp,tiddler);
wikifier.outputText(output,0,source.length);
}
}
//--
//-- Macro definitions
//--
function invokeMacro(place,macro,params,wikifier,tiddler)
{
try {
var m = config.macros[macro];
if(m && m.handler) {
var tiddlerElem = story.findContainingTiddler(place);
window.tiddler = tiddlerElem ? store.getTiddler(tiddlerElem.getAttribute("tiddler")) : null;
window.place = place;
var allowEval = true;
if(config.evaluateMacroParameters=="system") {
if(!tiddler || tiddler.tags.indexOf("systemAllowEval") == -1) {
allowEval = false;
}
}
m.handler(place,macro,m.noPreParse?null:params.readMacroParams(!allowEval),wikifier,params,tiddler);
} else {
createTiddlyError(place,config.messages.macroError.format([macro]),config.messages.macroErrorDetails.format([macro,config.messages.missingMacro]));
}
} catch(ex) {
createTiddlyError(place,config.messages.macroError.format([macro]),config.messages.macroErrorDetails.format([macro,ex.toString()]));
}
}
config.macros.version.handler = function(place)
{
jQuery("<span/>").text(formatVersion()).appendTo(place);
};
config.macros.today.handler = function(place,macroName,params)
{
var now = new Date();
var text = params[0] ? now.formatString(params[0].trim()) : now.toLocaleString();
jQuery("<span/>").text(text).appendTo(place);
};
config.macros.list.template = "<<view title link>>";
config.macros.list.handler = function(place,macroName,params,wikifier,paramString)
{
var list = document.createElement("ul");
jQuery(list).attr({ refresh: "macro", macroName: macroName }).data("params", paramString);
place.appendChild(list);
this.refresh(list);
};
config.macros.list.refresh = function(list) {
var paramString = jQuery(list).data("params");
var params = paramString.readMacroParams();
var args = paramString.parseParams("anon", null, null)[0];
var type = args.anon ? args.anon[0] : "all";
jQuery(list).empty().addClass("list list-" + type);
var template = args.template ? store.getTiddlerText(args.template[0]) : false;
if(!template) {
template = config.macros.list.template;
}
if(this[type].prompt)
createTiddlyElement(list,"li",null,"listTitle",this[type].prompt);
var results;
if(this[type].handler)
results = this[type].handler(params);
var t;
for(t = 0; t < results.length; t++) {
var li = document.createElement("li");
list.appendChild(li);
var tiddler = results[t];
if(typeof(tiddler) == 'string') { // deal with missing etc..
tiddler = store.getTiddler(tiddler) || new Tiddler(tiddler);
}
wikify(template, li, null, tiddler);
}
if(results.length === 0 && args.emptyMessage) {
jQuery(list).addClass("emptyList");
jQuery("<li />").text(args.emptyMessage[0]).appendTo(list);
}
};
config.macros.list.all.handler = function(params)
{
return store.reverseLookup("tags","excludeLists",false,"title");
};
config.macros.list.missing.handler = function(params)
{
return store.getMissingLinks();
};
config.macros.list.orphans.handler = function(params)
{
return store.getOrphans();
};
config.macros.list.shadowed.handler = function(params)
{
return store.getShadowed();
};
config.macros.list.touched.handler = function(params)
{
return store.getTouched();
};
config.macros.list.filter.handler = function(params)
{
var filter = params[1];
var results = [];
if(filter) {
var tiddlers = store.filterTiddlers(filter);
var t;
for(t=0; t<tiddlers.length; t++)
results.push(tiddlers[t].title);
}
return results;
};
config.macros.allTags.handler = function(place,macroName,params)
{
var tags = store.getTags(params[0]);
var ul = createTiddlyElement(place,"ul");
if(tags.length == 0)
createTiddlyElement(ul,"li",null,"listTitle",this.noTags);
var t;
for(t=0; t<tags.length; t++) {
var title = tags[t][0];
var info = getTiddlyLinkInfo(title);
var li = createTiddlyElement(ul,"li");
var btn = createTiddlyButton(li,title + " (" + tags[t][1] + ")",this.tooltip.format([title]),onClickTag,info.classes);
btn.setAttribute("tag",title);
btn.setAttribute("refresh","link");
btn.setAttribute("tiddlyLink",title);
if(params[1]) {
btn.setAttribute("sortby",params[1]);
}
}
};
var macro = config.macros.timeline;
merge(macro, {
handler: function(place,macroName,params, wikifier, paramString, tiddler) {
var container = jQuery("<div />").attr("params", paramString).
attr("macroName", macroName).appendTo(place)[0];
macro.refresh(container);
},
refresh: function(container) {
jQuery(container).attr("refresh", "macro").empty();
var paramString = jQuery(container).attr("params");
var args = paramString.parseParams("anon", null, null)[0];
var params = args.anon || [];
var field = params[0] || "modified";
var prefix = field.charAt(0);
var no_prefix_field = prefix === "-" || prefix === "+" ? field.substr(1, field.length) : field;
var dateFormat = params[2] || this.dateFormat;
var groupTemplate = macro.groupTemplate.format(no_prefix_field, dateFormat);
groupTemplate = args.groupTemplate ? store.getTiddlerText(args.groupTemplate[0]) || groupTemplate :
groupTemplate;
var itemTemplate = macro.itemTemplate;
itemTemplate = args.template ? store.getTiddlerText(args.template[0]) || itemTemplate :
itemTemplate;
var tiddlers = args.filter ? store.sortTiddlers(store.filterTiddlers(args.filter[0]), field) :
store.reverseLookup("tags", "excludeLists", false, field);
var lastGroup = "", ul;
var last = params[1] ? tiddlers.length-Math.min(tiddlers.length,parseInt(params[1],10)) : 0;
var t;
for(t=tiddlers.length-1; t>=last; t--) {
var tiddler = tiddlers[t];
var theGroup = wikifyPlainText(groupTemplate,0,tiddler);
if(typeof(ul) == "undefined" || theGroup != lastGroup) {
ul = document.createElement("ul");
jQuery(ul).addClass("timeline");
container.appendChild(ul);
createTiddlyElement(ul,"li",null,"listTitle",theGroup);
lastGroup = theGroup;
}
var item = createTiddlyElement(ul,"li",null,"listLink");
wikify(itemTemplate,item,null,tiddler);
}
},
groupTemplate: "<<view %0 date '%1'>>",
itemTemplate: "<<view title link>>"
});
config.macros.tiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var allowEval = true;
var stack = config.macros.tiddler.tiddlerStack;
if(stack.length > 0 && config.evaluateMacroParameters == "system") {
// included tiddler and "system" evaluation required, so check tiddler tagged appropriately
var title = stack[stack.length-1];
var pos = title.indexOf(config.textPrimitives.sectionSeparator);
if(pos != -1) {
title = title.substr(0,pos); // get the base tiddler title
}
var t = store.getTiddler(title);
if(!t || t.tags.indexOf("systemAllowEval") == -1) {
allowEval = false;
}
}
params = paramString.parseParams("name",null,allowEval,false,true);
var names = params[0]["name"];
var tiddlerName = names[0];
var className = names[1] || null;
var args = params[0]["with"];
var wrapper = createTiddlyElement(place,"span",null,className,null,{
refresh: "content", tiddler: tiddlerName
});
if(args!==undefined)
wrapper.setAttribute("args","[["+args.join("]] [[")+"]]");
this.transclude(wrapper,tiddlerName,args);
};
config.macros.tiddler.transclude = function(wrapper,tiddlerName,args)
{
var text = store.getTiddlerText(tiddlerName);
if(!text)
return;
var stack = config.macros.tiddler.tiddlerStack;
if(stack.indexOf(tiddlerName) !== -1)
return;
stack.push(tiddlerName);
try {
if(typeof args == "string")
args = args.readBracketedList();
var n = args ? Math.min(args.length,9) : 0;
var i;
for(i=0; i<n; i++) {
var placeholderRE = new RegExp("\\$" + (i + 1),"mg");
text = text.replace(placeholderRE,args[i]);
}
config.macros.tiddler.renderText(wrapper,text,tiddlerName);
} finally {
stack.pop();
}
};
config.macros.tiddler.renderText = function(place,text,tiddlerName)
{
wikify(text,place,null,store.getTiddler(tiddlerName));
};
config.macros.tiddler.tiddlerStack = [];
config.macros.tag.handler = function(place,macroName,params)
{
var btn = createTagButton(place,params[0],null,params[1],params[2]);
if(params[3]) {
btn.setAttribute('sortby',params[3]);
}
};
config.macros.tags.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
params = paramString.parseParams("anon",null,true,false,false);
var ul = createTiddlyElement(place,"ul");
var title = getParam(params,"anon","");
if(title && store.tiddlerExists(title))
tiddler = store.getTiddler(title);
var sep = getParam(params,"sep"," ");
var lingo = config.views.wikified.tag;
var label = null;
var t;
for(t=0; t<tiddler.tags.length; t++) {
var tag = store.getTiddler(tiddler.tags[t]);
if(!tag || !tag.tags.contains("excludeLists")) {
if(!label)
label = createTiddlyElement(ul,"li",null,"listTitle",lingo.labelTags.format([tiddler.title]));
createTagButton(createTiddlyElement(ul,"li"),tiddler.tags[t],tiddler.title);
if(t<tiddler.tags.length-1)
createTiddlyText(ul,sep);
}
}
if(!label)
createTiddlyElement(ul,"li",null,"listTitle",lingo.labelNoTags.format([tiddler.title]));
};
config.macros.tagging.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
params = paramString.parseParams("anon",null,true,false,false);
var ul = createTiddlyElement(place,"ul");
var title = getParam(params,"anon","");
if(title == "" && tiddler instanceof Tiddler)
title = tiddler.title;
var sep = getParam(params,"sep"," ");
ul.setAttribute("title",this.tooltip.format([title]));
var sortby = getParam(params,"sortBy",false);
var tagged = store.getTaggedTiddlers(title,sortby);
var prompt = tagged.length == 0 ? this.labelNotTag : this.label;
createTiddlyElement(ul,"li",null,"listTitle",prompt.format([title,tagged.length]));
var t;
for(t=0; t<tagged.length; t++) {
createTiddlyLink(createTiddlyElement(ul,"li"),tagged[t].title,true);
if(t<tagged.length-1)
createTiddlyText(ul,sep);
}
};
config.macros.closeAll.handler = function(place)
{
createTiddlyButton(place,this.label,this.prompt,this.onClick);
};
config.macros.closeAll.onClick = function(e)
{
story.closeAllTiddlers();
return false;
};
config.macros.permaview.handler = function(place)
{
createTiddlyButton(place,this.label,this.prompt,this.onClick);
};
config.macros.permaview.onClick = function(e)
{
story.permaView();
return false;
};
config.macros.saveChanges.handler = function(place,macroName,params)
{
if(!readOnly)
createTiddlyButton(place,params[0] || this.label,params[1] || this.prompt,this.onClick,null,null,this.accessKey);
};
config.macros.saveChanges.onClick = function(e)
{
saveChanges();
return false;
};
config.macros.slider.onClickSlider = function(ev)
{
var n = this.nextSibling;
var cookie = n.getAttribute("cookie");
var isOpen = n.style.display != "none";
if(config.options.chkAnimate && anim && typeof Slider == "function")
anim.startAnimating(new Slider(n,!isOpen,null,"none"));
else
n.style.display = isOpen ? "none" : "block";
config.options[cookie] = !isOpen;
saveOption(cookie);
return false;
};
config.macros.slider.createSlider = function(place,cookie,title,tooltip)
{
var c = cookie || "";
createTiddlyButton(place,title,tooltip,this.onClickSlider);
var panel = createTiddlyElement(null,"div",null,"sliderPanel");
panel.setAttribute("cookie",c);
panel.style.display = config.options[c] ? "block" : "none";
place.appendChild(panel);
return panel;
};
config.macros.slider.handler = function(place,macroName,params)
{
var panel = this.createSlider(place,params[0],params[2],params[3]);
var text = store.getTiddlerText(params[1]);
panel.setAttribute("refresh","content");
panel.setAttribute("tiddler",params[1]);
if(text)
wikify(text,panel,null,store.getTiddler(params[1]));
};
// <<gradient [[tiddler name]] vert|horiz rgb rgb rgb rgb... >>
config.macros.gradient.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var panel = wikifier ? createTiddlyElement(place,"div",null,"gradient") : place;
panel.style.position = "relative";
panel.style.overflow = "hidden";
panel.style.zIndex = "0";
if(wikifier) {
var styles = config.formatterHelpers.inlineCssHelper(wikifier);
config.formatterHelpers.applyCssHelper(panel,styles);
}
params = paramString.parseParams("color");
var locolors = [], hicolors = [];
var t;
for(t=2; t<params.length; t++) {
var c = params[t].value;
if(params[t].name == "snap") {
hicolors[hicolors.length-1] = c;
} else {
locolors.push(c);
hicolors.push(c);
}
}
drawGradient(panel,params[1].value != "vert",locolors,hicolors);
if(wikifier)
wikifier.subWikify(panel,">>");
if(document.all) {
panel.style.height = "100%";
panel.style.width = "100%";
}
};
config.macros.message.handler = function(place,macroName,params)
{
if(params[0]) {
var names = params[0].split(".");
var lookupMessage = function(root,nameIndex) {
if(root[names[nameIndex]]) {
if(nameIndex < names.length-1)
return (lookupMessage(root[names[nameIndex]],nameIndex+1));
else
return root[names[nameIndex]];
} else
return null;
};
var m = lookupMessage(config,0);
if(m == null)
m = lookupMessage(window,0);
createTiddlyText(place,m.toString().format(params.splice(1)));
}
};
config.macros.view.depth = 0;
config.macros.view.values = [];
config.macros.view.views = {
text: function(value,place,params,wikifier,paramString,tiddler) {
highlightify(value,place,highlightHack,tiddler);
},
link: function(value,place,params,wikifier,paramString,tiddler) {
createTiddlyLink(place,value,true);
},
wikified: function(value,place,params,wikifier,paramString,tiddler) {
if(config.macros.view.depth>50)
return;
if(config.macros.view.depth>0) {
if (value==config.macros.view.values[config.macros.view.depth-1]) {
return;
}
}
config.macros.view.values[config.macros.view.depth] = value;
config.macros.view.depth++;
if(params[2])
value=params[2].unescapeLineBreaks().format([value]);
wikify(value,place,highlightHack,tiddler);
config.macros.view.depth--;
config.macros.view.values[config.macros.view.depth] = null;
},
date: function(value,place,params,wikifier,paramString,tiddler) {
value = Date.convertFromYYYYMMDDHHMM(value);
createTiddlyText(place,value.formatString(params[2] || config.views.wikified.dateFormat));
}
};
config.macros.view.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
if((tiddler instanceof Tiddler) && params[0]) {
var value = store.getValue(tiddler,params[0]);
if(value) {
var type = params[1] || config.macros.view.defaultView;
var handler = config.macros.view.views[type];
if(handler)
handler(value,place,params,wikifier,paramString,tiddler);
}
}
};
config.macros.edit.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var field = params[0];
var rows = params[1] || 0;
var defVal = params[2] || '';
if((tiddler instanceof Tiddler) && field) {
story.setDirty(tiddler.title,true);
var e,v;
if(field != "text" && !rows) {
e = createTiddlyElement(null,"input",null,null,null,{
type: "text", edit: field, size: "40", autocomplete: "off"
});
e.value = store.getValue(tiddler,field) || defVal;
place.appendChild(e);
} else {
var wrapper1 = createTiddlyElement(null,"fieldset",null,"fieldsetFix");
var wrapper2 = createTiddlyElement(wrapper1,"div");
e = createTiddlyElement(wrapper2,"textarea");
e.value = v = store.getValue(tiddler,field) || defVal;
rows = rows || 10;
var lines = v.match(/\n/mg);
var maxLines = Math.max(parseInt(config.options.txtMaxEditRows,10),5);
if(lines != null && lines.length > rows)
rows = lines.length + 5;
rows = Math.min(rows,maxLines);
e.setAttribute("rows",rows);
e.setAttribute("edit",field);
place.appendChild(wrapper1);
}
if(tiddler.isReadOnly()) {
e.setAttribute("readOnly","readOnly");
jQuery(e).addClass("readOnly");
}
return e;
}
};
config.macros.tagChooser.onClick = function(ev)
{
var e = ev || window.event;
var lingo = config.views.editor.tagChooser;
var popup = Popup.create(this);
var tags = store.getTags(this.getAttribute("tags"));
if(tags.length == 0)
jQuery("<li/>").text(lingo.popupNone).appendTo(popup);
var t;
for(t=0; t<tags.length; t++) {
var tag = createTiddlyButton(createTiddlyElement(popup,"li"),tags[t][0],lingo.tagTooltip.format([tags[t][0]]),config.macros.tagChooser.onTagClick);
tag.setAttribute("tag",tags[t][0]);
tag.setAttribute("tiddler",this.getAttribute("tiddler"));
}
Popup.show();
e.cancelBubble = true;
if(e.stopPropagation) e.stopPropagation();
return false;
};
config.macros.tagChooser.onTagClick = function(ev)
{
var e = ev || window.event;
if(e.metaKey || e.ctrlKey) stopEvent(e); //# keep popup open on CTRL-click
var tag = this.getAttribute("tag");
var title = this.getAttribute("tiddler");
if(!readOnly)
story.setTiddlerTag(title,tag,0);
return false;
};
config.macros.tagChooser.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
if(tiddler instanceof Tiddler) {
var lingo = config.views.editor.tagChooser;
var btn = createTiddlyButton(place,lingo.text,lingo.tooltip,this.onClick);
btn.setAttribute("tiddler",tiddler.title);
btn.setAttribute("tags",params[0]);
}
};
config.macros.refreshDisplay.handler = function(place)
{
createTiddlyButton(place,this.label,this.prompt,this.onClick);
};
config.macros.refreshDisplay.onClick = function(e)
{
refreshAll();
return false;
};
config.macros.annotations.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var title = tiddler ? tiddler.title : null;
var a = title ? config.annotations[title] : null;
if(!tiddler || !title || !a)
return;
var text = a.format([title]);
wikify(text,createTiddlyElement(place,"div",null,"annotation"),null,tiddler);
};
//--
//-- NewTiddler and NewJournal macros
//--
config.macros.newTiddler.createNewTiddlerButton = function(place,title,params,label,prompt,accessKey,newFocus,isJournal)
{
var tags = [];
var t;
for(t=1; t<params.length; t++) {
if((params[t].name == "anon" && t != 1) || (params[t].name == "tag"))
tags.push(params[t].value);
}
label = getParam(params,"label",label);
prompt = getParam(params,"prompt",prompt);
accessKey = getParam(params,"accessKey",accessKey);
newFocus = getParam(params,"focus",newFocus);
var customFields = getParam(params,"fields","");
if(!customFields && !store.isShadowTiddler(title))
customFields = String.encodeHashMap(config.defaultCustomFields);
var btn = createTiddlyButton(place,label,prompt,this.onClickNewTiddler,null,null,accessKey);
btn.setAttribute("newTitle",title);
btn.setAttribute("isJournal",isJournal ? "true" : "false");
if(tags.length > 0)
btn.setAttribute("params",tags.join("|"));
btn.setAttribute("newFocus",newFocus);
btn.setAttribute("newTemplate",getParam(params,"template",DEFAULT_EDIT_TEMPLATE));
if(customFields !== "")
btn.setAttribute("customFields",customFields);
var text = getParam(params,"text");
if(text !== undefined)
btn.setAttribute("newText",text);
return btn;
};
config.macros.newTiddler.onClickNewTiddler = function()
{
var title = this.getAttribute("newTitle");
if(this.getAttribute("isJournal") == "true") {
title = new Date().formatString(title.trim());
}
var params = this.getAttribute("params");
var tags = params ? params.split("|") : [];
var focus = this.getAttribute("newFocus");
var template = this.getAttribute("newTemplate");
var customFields = this.getAttribute("customFields");
if(!customFields && !store.isShadowTiddler(title))
customFields = String.encodeHashMap(config.defaultCustomFields);
story.displayTiddler(null,title,template,false,null,null);
var tiddlerElem = story.getTiddler(title);
if(customFields)
story.addCustomFields(tiddlerElem,customFields);
var text = this.getAttribute("newText");
if(typeof text == "string" && story.getTiddlerField(title,"text"))
story.getTiddlerField(title,"text").value = text.format([title]);
var t;
for(t=0;t<tags.length;t++)
story.setTiddlerTag(title,tags[t],+1);
story.focusTiddler(title,focus);
return false;
};
config.macros.newTiddler.handler = function(place,macroName,params,wikifier,paramString)
{
if(!readOnly) {
params = paramString.parseParams("anon",null,true,false,false);
var title = params[1] && params[1].name == "anon" ? params[1].value : this.title;
title = getParam(params,"title",title);
this.createNewTiddlerButton(place,title,params,this.label,this.prompt,this.accessKey,"title",false);
}
};
config.macros.newJournal.handler = function(place,macroName,params,wikifier,paramString)
{
if(!readOnly) {
params = paramString.parseParams("anon",null,true,false,false);
var title = params[1] && params[1].name == "anon" ? params[1].value : config.macros.timeline.dateFormat;
title = getParam(params,"title",title);
config.macros.newTiddler.createNewTiddlerButton(place,title,params,this.label,this.prompt,this.accessKey,"text",true);
}
};
//--
//-- Search macro
//--
config.macros.search.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
params = paramString.parseParams("anon",null,false,false,false);
createTiddlyButton(place,this.label,this.prompt,this.onClick,"searchButton");
var txt = createTiddlyElement(null,"input",null,"txtOptionInput searchField");
txt.value = getParam(params,"anon","");
if(config.browser.isSafari) {
txt.setAttribute("type","search");
txt.setAttribute("results","5");
} else {
txt.setAttribute("type","text");
}
place.appendChild(txt);
txt.onkeyup = this.onKeyPress;
txt.onfocus = this.onFocus;
txt.setAttribute("size",this.sizeTextbox);
txt.setAttribute("accessKey",getParam(params,"accesskey",this.accessKey));
txt.setAttribute("autocomplete","off");
txt.setAttribute("lastSearchText","");
txt.setAttribute("placeholder",getParam(params,"placeholder",this.placeholder));
};
// Global because there's only ever one outstanding incremental search timer
config.macros.search.timeout = null;
config.macros.search.doSearch = function(txt)
{
if(txt.value.length > 0) {
story.search(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch);
txt.setAttribute("lastSearchText",txt.value);
}
};
config.macros.search.onClick = function(e)
{
config.macros.search.doSearch(this.nextSibling);
return false;
};
config.macros.search.onKeyPress = function(ev)
{
var me = config.macros.search;
var e = ev || window.event;
switch(e.keyCode) {
case 9: // Tab
return;
case 13: // Ctrl-Enter
case 10: // Ctrl-Enter on IE PC
me.doSearch(this);
break;
case 27: // Escape
this.value = "";
clearMessage();
break;
}
if(config.options.chkIncrementalSearch) {
if(this.value.length > 2) {
if(this.value != this.getAttribute("lastSearchText")) {
if(me.timeout) {
clearTimeout(me.timeout);
}
var txt = this;
me.timeout = setTimeout(function() {me.doSearch(txt);},500);
}
} else {
if(me.timeout) {
clearTimeout(me.timeout);
}
}
}
};
config.macros.search.onFocus = function(e)
{
this.select();
};
//--
//-- Tabs macro
//--
config.macros.tabs.handler = function(place,macroName,params)
{
var cookie = params[0];
var numTabs = (params.length-1)/3;
var wrapper = createTiddlyElement(null,"div",null,"tabsetWrapper " + cookie);
var tabset = createTiddlyElement(wrapper,"div",null,"tabset");
tabset.setAttribute("cookie",cookie);
var validTab = false;
var t;
for(t=0; t<numTabs; t++) {
var label = params[t*3+1];
var prompt = params[t*3+2];
var content = params[t*3+3];
var tab = createTiddlyButton(tabset,label,prompt,this.onClickTab,"tab tabUnselected");
createTiddlyElement(tab,"span",null,null," ",{style:"font-size:0pt;line-height:0px"});
tab.setAttribute("tab",label);
tab.setAttribute("content",content);
tab.title = prompt;
if(config.options[cookie] == label)
validTab = true;
}
if(!validTab)
config.options[cookie] = params[1];
place.appendChild(wrapper);
this.switchTab(tabset,config.options[cookie]);
};
config.macros.tabs.onClickTab = function(e)
{
config.macros.tabs.switchTab(this.parentNode,this.getAttribute("tab"));
return false;
};
config.macros.tabs.switchTab = function(tabset,tab)
{
var cookie = tabset.getAttribute("cookie");
var theTab = null;
var nodes = tabset.childNodes;
var t;
for(t=0; t<nodes.length; t++) {
if(nodes[t].getAttribute && nodes[t].getAttribute("tab") == tab) {
theTab = nodes[t];
theTab.className = "tab tabSelected";
} else {
nodes[t].className = "tab tabUnselected";
}
}
if(theTab) {
if(tabset.nextSibling && tabset.nextSibling.className == "tabContents")
jQuery(tabset.nextSibling).remove();
var tabContent = createTiddlyElement(null,"div",null,"tabContents");
tabset.parentNode.insertBefore(tabContent,tabset.nextSibling);
var contentTitle = theTab.getAttribute("content");
wikify(store.getTiddlerText(contentTitle),tabContent,null,store.getTiddler(contentTitle));
if(cookie) {
config.options[cookie] = tab;
saveOption(cookie);
}
}
};
//--
//-- Tiddler toolbar
//--
// Create a toolbar command button
config.macros.toolbar.createCommand = function(place,commandName,tiddler,className)
{
if(typeof commandName != "string") {
var c = null;
var t;
for(t in config.commands) {
if(config.commands[t] == commandName)
c = t;
}
commandName = c;
}
if((tiddler instanceof Tiddler) && (typeof commandName == "string")) {
var command = config.commands[commandName];
if(command.isEnabled ? command.isEnabled(tiddler) : this.isCommandEnabled(command,tiddler)) {
var text = command.getText ? command.getText(tiddler) : this.getCommandText(command,tiddler);
var tooltip = command.getTooltip ? command.getTooltip(tiddler) : this.getCommandTooltip(command,tiddler);
var cmd = command.type == "popup" ? this.onClickPopup : this.onClickCommand;
var btn = createTiddlyButton(null,text,tooltip,cmd);
btn.setAttribute("commandName",commandName);
btn.setAttribute("tiddler",tiddler.title);
jQuery(btn).addClass("command_" + commandName);
if(className)
jQuery(btn).addClass(className);
place.appendChild(btn);
}
}
};
config.macros.toolbar.isCommandEnabled = function(command,tiddler)
{
var title = tiddler.title;
var ro = tiddler.isReadOnly();
var shadow = store.isShadowTiddler(title) && !store.tiddlerExists(title);
return (!ro || (ro && !command.hideReadOnly)) && !(shadow && command.hideShadow);
};
config.macros.toolbar.getCommandText = function(command,tiddler)
{
return (tiddler.isReadOnly() && command.readOnlyText) || command.text;
};
config.macros.toolbar.getCommandTooltip = function(command,tiddler)
{
return (tiddler.isReadOnly() && command.readOnlyTooltip) || command.tooltip;
};
config.macros.toolbar.onClickCommand = function(ev)
{
var e = ev || window.event;
e.cancelBubble = true;
if(e.stopPropagation) e.stopPropagation();
var command = config.commands[this.getAttribute("commandName")];
return command.handler(e,this,this.getAttribute("tiddler"));
};
config.macros.toolbar.onClickPopup = function(ev)
{
var e = ev || window.event;
e.cancelBubble = true;
if(e.stopPropagation) e.stopPropagation();
var popup = Popup.create(this);
var command = config.commands[this.getAttribute("commandName")];
var title = this.getAttribute("tiddler");
popup.setAttribute("tiddler",title);
command.handlePopup(popup,title);
Popup.show();
return false;
};
// Invoke the first command encountered from a given place that is tagged with a specified class
config.macros.toolbar.invokeCommand = function(place,className,event)
{
var children = place.getElementsByTagName("a");
var t;
for(t=0; t<children.length; t++) {
var c = children[t];
if(jQuery(c).hasClass(className) && c.getAttribute && c.getAttribute("commandName")) {
if(c.onclick instanceof Function)
c.onclick.call(c,event);
break;
}
}
};
config.macros.toolbar.onClickMore = function(ev)
{
var e = this.nextSibling;
e.style.display = "inline";
this.style.display = "none";
return false;
};
config.macros.toolbar.onClickLess = function(ev)
{
var e = this.parentNode;
var m = e.previousSibling;
e.style.display = "none";
m.style.display = "inline";
return false;
};
config.macros.toolbar.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var t;
for(t=0; t<params.length; t++) {
var btn;
var c = params[t];
switch(c) {
case "!":
createTiddlyText(place,this.separator);
break;
case "*":
createTiddlyElement(place,"br");
break;
case "<":
btn = createTiddlyButton(place,this.lessLabel,this.lessPrompt,config.macros.toolbar.onClickLess);
jQuery(btn).addClass("lessCommand");
break;
case ">":
btn = createTiddlyButton(place,this.moreLabel,this.morePrompt,config.macros.toolbar.onClickMore);
jQuery(btn).addClass("moreCommand");
var e = createTiddlyElement(place,"span",null,"moreCommand");
e.style.display = "none";
place = e;
break;
default:
var className = "";
switch(c.substr(0,1)) {
case "+":
className = "defaultCommand";
c = c.substr(1);
break;
case "-":
className = "cancelCommand";
c = c.substr(1);
break;
}
if(config.commands[c]) {
this.createCommand(place,c,tiddler,className);
} else {
this.customCommand(place,c,wikifier,tiddler);
}
break;
}
}
};
// Overrideable function to extend toolbar handler
config.macros.toolbar.customCommand = function(place,command,wikifier,tiddler)
{
};
//--
//-- Menu and toolbar commands
//--
config.commands.closeTiddler.handler = function(event,src,title)
{
if(story.isDirty(title) && !readOnly) {
if(!confirm(config.commands.cancelTiddler.warning.format([title])))
return false;
}
story.setDirty(title,false);
story.closeTiddler(title,true);
return false;
};
config.commands.closeOthers.handler = function(event,src,title)
{
story.closeAllTiddlers(title);
return false;
};
config.commands.editTiddler.handler = function(event,src,title)
{
clearMessage();
var tiddlerElem = story.getTiddler(title);
var fields = tiddlerElem.getAttribute("tiddlyFields");
story.displayTiddler(null,title,DEFAULT_EDIT_TEMPLATE,false,null,fields);
var e = story.getTiddlerField(title,config.options.txtEditorFocus||"text");
if(e) {
setCaretPosition(e,0);
}
return false;
};
config.commands.saveTiddler.handler = function(event,src,title)
{
var newTitle = story.saveTiddler(title,event.shiftKey);
if(newTitle)
story.displayTiddler(null,newTitle);
return false;
};
config.commands.cancelTiddler.handler = function(event,src,title)
{
if(story.hasChanges(title) && !readOnly) {
if(!confirm(this.warning.format([title])))
return false;
}
story.setDirty(title,false);
story.displayTiddler(null,title);
return false;
};
config.commands.deleteTiddler.handler = function(event,src,title)
{
var deleteIt = true;
if(config.options.chkConfirmDelete)
deleteIt = confirm(this.warning.format([title]));
if(deleteIt) {
store.removeTiddler(title);
story.closeTiddler(title,true);
autoSaveChanges();
}
return false;
};
config.commands.permalink.handler = function(event,src,title)
{
var t = encodeURIComponent(String.encodeTiddlyLink(title));
if(window.location.hash != t)
window.location.hash = t;
return false;
};
config.commands.references.handlePopup = function(popup,title)
{
var references = store.getReferringTiddlers(title);
var c = false;
var r;
for(r=0; r<references.length; r++) {
if(references[r].title != title && !references[r].isTagged("excludeLists")) {
createTiddlyLink(createTiddlyElement(popup,"li"),references[r].title,true);
c = true;
}
}
if(!c)
createTiddlyElement(popup,"li",null,"disabled",this.popupNone);
};
config.commands.jump.handlePopup = function(popup,title)
{
story.forEachTiddler(function(title,element) {
createTiddlyLink(createTiddlyElement(popup,"li"),title,true,null,false,null,true);
});
};
config.commands.fields.handlePopup = function(popup,title)
{
var tiddler = store.fetchTiddler(title);
if(!tiddler)
return;
var items = [];
store.forEachField(tiddler,function(tiddler,fieldName,value){items.push({field:fieldName,value:value});},true);
items.sort(function(a,b) {return a.field < b.field ? -1 : (a.field == b.field ? 0 : +1);});
if(items.length > 0)
ListView.create(popup,items,this.listViewTemplate);
else
createTiddlyElement(popup,"div",null,null,this.emptyText);
};
//--
//-- Tiddler() object
//--
function Tiddler(title)
{
this.title = title;
this.text = "";
this.creator = null;
this.modifier = null;
this.created = new Date();
this.modified = this.created;
this.links = [];
this.linksUpdated = false;
this.tags = [];
this.fields = {};
return this;
}
Tiddler.prototype.getLinks = function()
{
if(this.linksUpdated==false)
this.changed();
return this.links;
};
// Returns the fields that are inherited in string field:"value" field2:"value2" format
Tiddler.prototype.getInheritedFields = function()
{
var f = {};
var i;
for(i in this.fields) {
if(i=="server.host" || i=="server.workspace" || i=="wikiformat"|| i=="server.type") {
f[i] = this.fields[i];
}
}
return String.encodeHashMap(f);
};
// Increment the changeCount of a tiddler
Tiddler.prototype.incChangeCount = function()
{
var c = this.fields['changecount'];
c = c ? parseInt(c,10) : 0;
this.fields['changecount'] = String(c+1);
};
// Clear the changeCount of a tiddler
Tiddler.prototype.clearChangeCount = function()
{
if(this.fields['changecount']) {
delete this.fields['changecount'];
}
};
Tiddler.prototype.doNotSave = function()
{
return this.fields['doNotSave'];
};
// Returns true if the tiddler has been updated since the tiddler was created or downloaded
Tiddler.prototype.isTouched = function()
{
var changecount = this.fields.changecount || 0;
return changecount > 0;
};
// Change the text and other attributes of a tiddler
Tiddler.prototype.set = function(title,text,modifier,modified,tags,created,fields,creator)
{
this.assign(title,text,modifier,modified,tags,created,fields,creator);
this.changed();
return this;
};
// Change the text and other attributes of a tiddler without triggered a tiddler.changed() call
Tiddler.prototype.assign = function(title,text,modifier,modified,tags,created,fields,creator)
{
if(title != undefined)
this.title = title;
if(text != undefined)
this.text = text;
if(modifier != undefined)
this.modifier = modifier;
if(modified != undefined)
this.modified = modified;
if(creator != undefined)
this.creator = creator;
if(created != undefined)
this.created = created;
if(fields != undefined)
this.fields = fields;
if(tags != undefined)
this.tags = (typeof tags == "string") ? tags.readBracketedList() : tags;
else if(this.tags == undefined)
this.tags = [];
return this;
};
// Get the tags for a tiddler as a string (space delimited, using [[brackets]] for tags containing spaces)
Tiddler.prototype.getTags = function()
{
return String.encodeTiddlyLinkList(this.tags);
};
// Test if a tiddler carries a tag
Tiddler.prototype.isTagged = function(tag)
{
return this.tags.indexOf(tag) != -1;
};
// Static method to convert "\n" to newlines, "\s" to "\"
Tiddler.unescapeLineBreaks = function(text)
{
return text ? text.unescapeLineBreaks() : "";
};
// Convert newlines to "\n", "\" to "\s"
Tiddler.prototype.escapeLineBreaks = function()
{
return this.text.escapeLineBreaks();
};
// Updates the secondary information (like links[] array) after a change to a tiddler
Tiddler.prototype.changed = function()
{
this.links = [];
var text = this.text;
// remove 'quoted' text before scanning tiddler source
text = text.replace(/\/%((?:.|\n)*?)%\//g,"").
replace(/\{{3}((?:.|\n)*?)\}{3}/g,"").
replace(/"""((?:.|\n)*?)"""/g,"").
replace(/<nowiki\>((?:.|\n)*?)<\/nowiki\>/g,"").
replace(/<html\>((?:.|\n)*?)<\/html\>/g,"").
replace(/<script((?:.|\n)*?)<\/script\>/g,"");
var t = this.autoLinkWikiWords() ? 0 : 1;
var tiddlerLinkRegExp = t==0 ? config.textPrimitives.tiddlerAnyLinkRegExp : config.textPrimitives.tiddlerForcedLinkRegExp;
tiddlerLinkRegExp.lastIndex = 0;
var formatMatch = tiddlerLinkRegExp.exec(text);
while(formatMatch) {
var lastIndex = tiddlerLinkRegExp.lastIndex;
if(t==0 && formatMatch[1] && formatMatch[1] != this.title) {
// wikiWordLink
if(formatMatch.index > 0) {
var preRegExp = new RegExp(config.textPrimitives.unWikiLink+"|"+config.textPrimitives.anyLetter,"mg");
preRegExp.lastIndex = formatMatch.index-1;
var preMatch = preRegExp.exec(text);
if(preMatch.index != formatMatch.index-1)
this.links.pushUnique(formatMatch[1]);
} else {
this.links.pushUnique(formatMatch[1]);
}
}
else if(formatMatch[2-t] && !config.formatterHelpers.isExternalLink(formatMatch[3-t])) // titledBrackettedLink
this.links.pushUnique(formatMatch[3-t]);
else if(formatMatch[4-t] && formatMatch[4-t] != this.title) // brackettedLink
this.links.pushUnique(formatMatch[4-t]);
tiddlerLinkRegExp.lastIndex = lastIndex;
formatMatch = tiddlerLinkRegExp.exec(text);
}
this.linksUpdated = true;
};
Tiddler.prototype.getSubtitle = function()
{
var modifier = this.modifier;
if(!modifier)
modifier = config.messages.subtitleUnknown || "";
var modified = this.modified;
if(modified)
modified = modified.toLocaleString();
else
modified = config.messages.subtitleUnknown || "";
var f = config.messages.tiddlerLinkTooltip || "%0 - %1, %2";
return f.format([this.title,modifier,modified]);
};
Tiddler.prototype.isReadOnly = function()
{
return readOnly;
};
Tiddler.prototype.autoLinkWikiWords = function()
{
return !(this.isTagged("systemConfig") || this.isTagged("excludeMissing"));
};
Tiddler.prototype.getServerType = function()
{
var serverType = null;
if(this.fields['server.type'])
serverType = this.fields['server.type'];
if(!serverType)
serverType = this.fields['wikiformat'];
if(serverType && !config.adaptors[serverType])
serverType = null;
return serverType;
};
Tiddler.prototype.getAdaptor = function()
{
var serverType = this.getServerType();
return serverType ? new config.adaptors[serverType]() : null;
};
//--
//-- TiddlyWiki instance contains TiddlerS
//--
function TiddlyWiki(params)
{
var tiddlers = {}; // Hashmap by name of tiddlers
if(params && params.config) {
this.config = config;
}
this.tiddlersUpdated = false;
this.namedNotifications = []; // Array of {name:,notify:} of notification functions
this.notificationLevel = 0;
this.slices = {}; // map tiddlerName->(map sliceName->sliceValue). Lazy.
this.clear = function() {
tiddlers = {};
this.setDirty(false);
};
this.fetchTiddler = function(title) {
var t = tiddlers[title];
return t instanceof Tiddler ? t : null;
};
this.deleteTiddler = function(title) {
delete this.slices[title];
delete tiddlers[title];
};
this.addTiddler = function(tiddler) {
delete this.slices[tiddler.title];
tiddlers[tiddler.title] = tiddler;
};
this.forEachTiddler = function(callback) {
var t;
for(t in tiddlers) {
var tiddler = tiddlers[t];
if(tiddler instanceof Tiddler)
callback.call(this,t,tiddler);
}
};
}
TiddlyWiki.prototype.setDirty = function(dirty)
{
this.dirty = dirty;
};
TiddlyWiki.prototype.isDirty = function()
{
return this.dirty;
};
TiddlyWiki.prototype.tiddlerExists = function(title)
{
var t = this.fetchTiddler(title);
return t != undefined;
};
TiddlyWiki.prototype.isShadowTiddler = function(title)
{
return config.shadowTiddlers[title] === undefined ? false : true;
};
TiddlyWiki.prototype.isAvailable = function(title) {
if (!title)
return false;
var s = title ? title.indexOf(config.textPrimitives.sectionSeparator) : -1;
if(s!=-1)
title = title.substr(0,s);
return this.tiddlerExists(title) || this.isShadowTiddler(title);
};
TiddlyWiki.prototype.createTiddler = function(title)
{
var tiddler = this.fetchTiddler(title);
if(!tiddler) {
tiddler = new Tiddler(title);
this.addTiddler(tiddler);
this.setDirty(true);
}
return tiddler;
};
TiddlyWiki.prototype.getTiddler = function(title)
{
var t = this.fetchTiddler(title);
if(t != undefined)
return t;
else
return null;
};
TiddlyWiki.prototype.getShadowTiddlerText = function(title)
{
if(typeof config.shadowTiddlers[title] == "string")
return config.shadowTiddlers[title];
else
return "";
};
// Retrieve tiddler contents
TiddlyWiki.prototype.getTiddlerText = function(title,defaultText)
{
if(!title)
return defaultText;
var pos = title.indexOf(config.textPrimitives.sectionSeparator);
var section = null;
if(pos != -1) {
section = title.substr(pos + config.textPrimitives.sectionSeparator.length);
title = title.substr(0,pos);
}
pos = title.indexOf(config.textPrimitives.sliceSeparator);
if(pos != -1) {
var slice = this.getTiddlerSlice(title.substr(0,pos),title.substr(pos + config.textPrimitives.sliceSeparator.length));
if(slice)
return slice;
}
var tiddler = this.fetchTiddler(title);
var text = tiddler ? tiddler.text : null;
if(!tiddler && this.isShadowTiddler(title)) {
text = this.getShadowTiddlerText(title);
}
if(text) {
if(!section)
return text;
var re = new RegExp("(^!{1,6}[ \t]*" + section.escapeRegExp() + "[ \t]*\n)","mg");
re.lastIndex = 0;
var match = re.exec(text);
if(match) {
var t = text.substr(match.index+match[1].length);
var re2 = /^!/mg;
re2.lastIndex = 0;
match = re2.exec(t); //# search for the next heading
if(match)
t = t.substr(0,match.index-1);//# don't include final \n
return t;
}
return defaultText;
}
if(defaultText != undefined)
return defaultText;
return null;
};
TiddlyWiki.prototype.getRecursiveTiddlerText = function(title,defaultText,depth)
{
var bracketRegExp = new RegExp("(?:\\[\\[([^\\]]+)\\]\\])","mg");
var text = this.getTiddlerText(title,null);
if(text == null)
return defaultText;
var textOut = [];
var match,lastPos = 0;
do {
match = bracketRegExp.exec(text);
if(match) {
textOut.push(text.substr(lastPos,match.index-lastPos));
if(match[1]) {
if(depth <= 0)
textOut.push(match[1]);
else
textOut.push(this.getRecursiveTiddlerText(match[1],"",depth-1));
}
lastPos = match.index + match[0].length;
} else {
textOut.push(text.substr(lastPos));
}
} while(match);
return textOut.join("");
};
//TiddlyWiki.prototype.slicesRE = /(?:^([\'\/]{0,2})~?([\.\w]+)\:\1[\t\x20]*([^\n]+)[\t\x20]*$)|(?:^\|([\'\/]{0,2})~?([\.\w]+)\:?\4\|[\t\x20]*([^\n]+)[\t\x20]*\|$)/gm;
TiddlyWiki.prototype.slicesRE = /(?:^([\'\/]{0,2})~?([\.\w]+)\:\1[\t\x20]*([^\n]*)[\t\x20]*$)|(?:^\|([\'\/]{0,2})~?([\.\w]+)\:?\4\|[\t\x20]*([^\|\n]*)[\t\x20]*\|$)/gm;
// @internal
TiddlyWiki.prototype.calcAllSlices = function(title)
{
var slices = {};
var text = this.getTiddlerText(title,"");
this.slicesRE.lastIndex = 0;
var m = this.slicesRE.exec(text);
while(m) {
if(m[2])
slices[m[2]] = m[3];
else
slices[m[5]] = m[6];
m = this.slicesRE.exec(text);
}
return slices;
};
// Returns the slice of text of the given name
TiddlyWiki.prototype.getTiddlerSlice = function(title,sliceName)
{
var slices = this.slices[title];
if(!slices) {
slices = this.calcAllSlices(title);
this.slices[title] = slices;
}
return slices[sliceName];
};
// Build an hashmap of the specified named slices of a tiddler
TiddlyWiki.prototype.getTiddlerSlices = function(title,sliceNames)
{
var t,r = {};
for(t=0; t<sliceNames.length; t++) {
var slice = this.getTiddlerSlice(title,sliceNames[t]);
if(slice)
r[sliceNames[t]] = slice;
}
return r;
};
TiddlyWiki.prototype.suspendNotifications = function()
{
this.notificationLevel--;
};
TiddlyWiki.prototype.resumeNotifications = function()
{
this.notificationLevel++;
};
// Invoke the notification handlers for a particular tiddler
TiddlyWiki.prototype.notify = function(title,doBlanket)
{
if(!this.notificationLevel) {
var t;
for(t=0; t<this.namedNotifications.length; t++) {
var n = this.namedNotifications[t];
if((n.name == null && doBlanket) || (n.name == title))
n.notify(title);
}
}
};
// Invoke the notification handlers for all tiddlers
TiddlyWiki.prototype.notifyAll = function()
{
if(!this.notificationLevel) {
var t;
for(t=0; t<this.namedNotifications.length; t++) {
var n = this.namedNotifications[t];
if(n.name)
n.notify(n.name);
}
}
};
// Add a notification handler to a tiddler
TiddlyWiki.prototype.addNotification = function(title,fn)
{
var i;
for(i=0; i<this.namedNotifications.length; i++) {
if((this.namedNotifications[i].name == title) && (this.namedNotifications[i].notify == fn))
return this;
}
this.namedNotifications.push({name: title, notify: fn});
return this;
};
TiddlyWiki.prototype.removeTiddler = function(title)
{
var tiddler = this.fetchTiddler(title);
if(tiddler) {
this.deleteTiddler(title);
this.notify(title,true);
this.setDirty(true);
}
};
// Reset the sync status of a freshly synced tiddler
TiddlyWiki.prototype.resetTiddler = function(title)
{
var tiddler = this.fetchTiddler(title);
if(tiddler) {
tiddler.clearChangeCount();
this.notify(title,true);
this.setDirty(true);
}
};
TiddlyWiki.prototype.setTiddlerTag = function(title,status,tag)
{
var tiddler = this.fetchTiddler(title);
if(tiddler) {
var t = tiddler.tags.indexOf(tag);
if(t != -1)
tiddler.tags.splice(t,1);
if(status)
tiddler.tags.push(tag);
tiddler.changed();
tiddler.incChangeCount();
this.notify(title,true);
this.setDirty(true);
}
};
TiddlyWiki.prototype.addTiddlerFields = function(title,fields)
{
var tiddler = this.fetchTiddler(title);
if(!tiddler)
return;
merge(tiddler.fields,fields);
tiddler.changed();
tiddler.incChangeCount();
this.notify(title,true);
this.setDirty(true);
};
// Store tiddler in TiddlyWiki instance
TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created,creator)
{
var tiddler;
if(title instanceof Tiddler) {
tiddler = title;
tiddler.fields = merge(merge({},tiddler.fields),config.defaultCustomFields,true);
title = tiddler.title;
newTitle = title;
} else {
tiddler = this.fetchTiddler(title);
if(tiddler) {
created = created || tiddler.created; // Preserve created date
creator = creator || tiddler.creator;
this.deleteTiddler(title);
} else {
created = created || modified;
tiddler = new Tiddler();
}
fields = merge(merge({},fields),config.defaultCustomFields,true);
tiddler.set(newTitle,newBody,modifier,modified,tags,created,fields,creator);
}
this.addTiddler(tiddler);
if(clearChangeCount)
tiddler.clearChangeCount();
else
tiddler.incChangeCount();
if(title != newTitle)
this.notify(title,true);
this.notify(newTitle,true);
this.setDirty(true);
return tiddler;
};
TiddlyWiki.prototype.incChangeCount = function(title)
{
var tiddler = this.fetchTiddler(title);
if(tiddler)
tiddler.incChangeCount();
};
TiddlyWiki.prototype.getLoader = function()
{
if(!this.loader)
this.loader = new TW21Loader();
return this.loader;
};
TiddlyWiki.prototype.getSaver = function()
{
if(!this.saver)
this.saver = new TW21Saver();
return this.saver;
};
// Return all tiddlers formatted as an HTML string
TiddlyWiki.prototype.allTiddlersAsHtml = function()
{
return this.getSaver().externalize(store);
};
// Load contents of a TiddlyWiki from an HTML DIV
TiddlyWiki.prototype.loadFromDiv = function(src,idPrefix,noUpdate)
{
this.idPrefix = idPrefix;
var storeElem = (typeof src == "string") ? document.getElementById(src) : src;
if(!storeElem)
return;
var tiddlers = this.getLoader().loadTiddlers(this,storeElem.childNodes);
this.setDirty(false);
if(!noUpdate) {
var i;
for(i = 0;i<tiddlers.length; i++)
tiddlers[i].changed();
}
jQuery(document).trigger("loadTiddlers");
};
// Load contents of a TiddlyWiki from a string
// Returns null if there's an error
TiddlyWiki.prototype.importTiddlyWiki = function(text)
{
var posDiv = locateStoreArea(text);
if(!posDiv)
return null;
var content = "<" + "html><" + "body>" + text.substring(posDiv[0],posDiv[1] + endSaveArea.length) + "<" + "/body><" + "/html>";
// Create the iframe
var iframe = document.createElement("iframe");
iframe.style.display = "none";
document.body.appendChild(iframe);
var doc = iframe.document;
if(iframe.contentDocument)
doc = iframe.contentDocument; // For NS6
else if(iframe.contentWindow)
doc = iframe.contentWindow.document; // For IE5.5 and IE6
// Put the content in the iframe
doc.open();
doc.writeln(content);
doc.close();
// Load the content into a TiddlyWiki() object
var storeArea = doc.getElementById("storeArea");
this.loadFromDiv(storeArea,"store");
// Get rid of the iframe
iframe.parentNode.removeChild(iframe);
return this;
};
TiddlyWiki.prototype.updateTiddlers = function()
{
this.tiddlersUpdated = true;
this.forEachTiddler(function(title,tiddler) {
tiddler.changed();
});
};
// Return an array of tiddlers matching a search regular expression
TiddlyWiki.prototype.search = function(searchRegExp,sortField,excludeTag,match)
{
var candidates = this.reverseLookup("tags",excludeTag,!!match);
var t,results = [];
for(t=0; t<candidates.length; t++) {
if((candidates[t].title.search(searchRegExp) != -1) || (candidates[t].text.search(searchRegExp) != -1))
results.push(candidates[t]);
}
if(!sortField)
sortField = "title";
results.sort(function(a,b) {return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);});
return results;
};
// Returns a list of all tags in use
// excludeTag - if present, excludes tags that are themselves tagged with excludeTag
// Returns an array of arrays where [tag][0] is the name of the tag and [tag][1] is the number of occurances
TiddlyWiki.prototype.getTags = function(excludeTag)
{
var results = [];
this.forEachTiddler(function(title,tiddler) {
var g,c;
for(g=0; g<tiddler.tags.length; g++) {
var tag = tiddler.tags[g];
var n = true;
for(c=0; c<results.length; c++) {
if(results[c][0] == tag) {
n = false;
results[c][1]++;
}
}
if(n && excludeTag) {
var t = this.fetchTiddler(tag);
if(t && t.isTagged(excludeTag))
n = false;
}
if(n)
results.push([tag,1]);
}
});
results.sort(function(a,b) {return a[0].toLowerCase() < b[0].toLowerCase() ? -1 : (a[0].toLowerCase() == b[0].toLowerCase() ? 0 : +1);});
return results;
};
// Return an array of the tiddlers that are tagged with a given tag
TiddlyWiki.prototype.getTaggedTiddlers = function(tag,sortField)
{
return this.reverseLookup("tags",tag,true,sortField);
};
TiddlyWiki.prototype.getValueTiddlers = function(field,value,sortField)
{
return this.reverseLookup(field,value,true,sortField);
};
// Return an array of the tiddlers that link to a given tiddler
TiddlyWiki.prototype.getReferringTiddlers = function(title,unusedParameter,sortField)
{
if(!this.tiddlersUpdated)
this.updateTiddlers();
return this.reverseLookup("links",title,true,sortField);
};
// Return an array of the tiddlers that do or do not have a specified entry in the specified storage array (ie, "links" or "tags")
// lookupMatch == true to match tiddlers, false to exclude tiddlers
TiddlyWiki.prototype.reverseLookup = function(lookupField,lookupValue,lookupMatch,sortField)
{
var results = [];
this.forEachTiddler(function(title,tiddler) {
var f = !lookupMatch;
var values;
if(["links", "tags"].contains(lookupField)) {
values = tiddler[lookupField];
} else {
var accessor = TiddlyWiki.standardFieldAccess[lookupField];
if(accessor) {
values = [ accessor.get(tiddler) ];
} else {
values = tiddler.fields[lookupField] ? [tiddler.fields[lookupField]] : [];
}
}
var lookup;
for(lookup=0; lookup<values.length; lookup++) {
if(values[lookup] == lookupValue)
f = lookupMatch;
}
if(f)
results.push(tiddler);
});
if(!sortField)
sortField = "title";
return this.sortTiddlers(results,sortField);
};
// Return the tiddlers as a sorted array
TiddlyWiki.prototype.getTiddlers = function(field,excludeTag)
{
var results = [];
this.forEachTiddler(function(title,tiddler) {
if(excludeTag == undefined || !tiddler.isTagged(excludeTag))
results.push(tiddler);
});
if(field)
results.sort(function(a,b) {return a[field] < b[field] ? -1 : (a[field] == b[field] ? 0 : +1);});
return results;
};
// Return array of names of tiddlers that are referred to but not defined
TiddlyWiki.prototype.getMissingLinks = function()
{
if(!this.tiddlersUpdated)
this.updateTiddlers();
var results = [];
this.forEachTiddler(function (title,tiddler) {
if(tiddler.isTagged("excludeMissing") || tiddler.isTagged("systemConfig"))
return;
var n;
for(n=0; n<tiddler.links.length;n++) {
var link = tiddler.links[n];
if(this.getTiddlerText(link,null) == null && !this.isShadowTiddler(link) && !config.macros[link])
results.pushUnique(link);
}
});
results.sort();
return results;
};
// Return an array of names of tiddlers that are defined but not referred to
TiddlyWiki.prototype.getOrphans = function()
{
var results = [];
this.forEachTiddler(function (title,tiddler) {
if(this.getReferringTiddlers(title).length == 0 && !tiddler.isTagged("excludeLists"))
results.push(title);
});
results.sort();
return results;
};
// Return an array of names of all the shadow tiddlers
TiddlyWiki.prototype.getShadowed = function()
{
var t,results = [];
for(t in config.shadowTiddlers) {
if(this.isShadowTiddler(t))
results.push(t);
}
results.sort();
return results;
};
// Return an array of tiddlers that have been touched since they were downloaded or created
TiddlyWiki.prototype.getTouched = function()
{
var results = [];
this.forEachTiddler(function(title,tiddler) {
if(tiddler.isTouched())
results.push(tiddler);
});
results.sort();
return results;
};
// Resolves a Tiddler reference or tiddler title into a Tiddler object, or null if it doesn't exist
TiddlyWiki.prototype.resolveTiddler = function(tiddler)
{
var t = (typeof tiddler == "string") ? this.getTiddler(tiddler) : tiddler;
return t instanceof Tiddler ? t : null;
};
// Sort a list of tiddlers
TiddlyWiki.prototype.sortTiddlers = function(tiddlers,field)
{
var asc = +1;
switch(field.substr(0,1)) {
case "-":
asc = -1;
field = field.substr(1);
break;
case "+":
field = field.substr(1);
break;
}
if(TiddlyWiki.standardFieldAccess[field]) {
if(field=="title") {
tiddlers.sort(function(a,b) {return a[field].toLowerCase() < b[field].toLowerCase() ? -asc : (a[field].toLowerCase() == b[field].toLowerCase() ? 0 : asc);});
} else {
tiddlers.sort(function(a,b) {return a[field] < b[field] ? -asc : (a[field] == b[field] ? 0 : asc);});
}
} else {
tiddlers.sort(function(a,b) {return a.fields[field] < b.fields[field] ? -asc : (a.fields[field] == b.fields[field] ? 0 : +asc);});
}
return tiddlers;
};
//--
//-- Filter a list of tiddlers
//--
config.filters = {
tiddler: function(results,match) {
var title = match[1]||match[4];
var tiddler = this.fetchTiddler(title);
if(tiddler) {
results.pushUnique(tiddler);
} else if(this.isShadowTiddler(title)) {
tiddler = new Tiddler();
tiddler.set(title,this.getTiddlerText(title));
results.pushUnique(tiddler);
} else {
results.pushUnique(new Tiddler(title));
}
return results;
},
tag: function(results,match) {
var m,matched = this.getTaggedTiddlers(match[3]);
for(m=0; m<matched.length; m++) {
results.pushUnique(matched[m]);
}
return results;
},
sort: function(results,match) {
return this.sortTiddlers(results,match[3]);
},
limit: function(results,match) {
return results.slice(0,parseInt(match[3],10));
},
field: function(results,match) {
var m,matched = this.getValueTiddlers(match[2],match[3]);
for (m = 0; m < matched.length; m++) {
results.pushUnique(matched[m]);
}
return results;
}
};
// Filter a list of tiddlers
TiddlyWiki.prototype.filterTiddlers = function(filter)
{
var re = /([^\s\[\]]+)|(?:\[([ \w\.\-]+)\[([^\]]+)\]\])|(?:\[\[([^\]]+)\]\])/mg;
var results = [];
if(filter) {
var match = re.exec(filter);
while(match) {
var handler = (match[1]||match[4])?'tiddler':config.filters[match[2]]?match[2]:'field';
results = config.filters[handler].call(this,results,match);
match = re.exec(filter);
}
}
return results;
};
// Returns true if path is a valid field name (path),
// i.e. a sequence of identifiers, separated by "."
TiddlyWiki.isValidFieldName = function(name)
{
var match = /[a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*/.exec(name);
return match && (match[0] == name);
};
// Throws an exception when name is not a valid field name.
TiddlyWiki.checkFieldName = function(name)
{
if(!TiddlyWiki.isValidFieldName(name))
throw config.messages.invalidFieldName.format([name]);
};
function StringFieldAccess(n,readOnly)
{
this.set = readOnly ?
function(t,v) {if(v != t[n]) throw config.messages.fieldCannotBeChanged.format([n]);} :
function(t,v) {if(v != t[n]) {t[n] = v; return true;}};
this.get = function(t) {return t[n];};
}
function DateFieldAccess(n)
{
this.set = function(t,v) {
var d = v instanceof Date ? v : Date.convertFromYYYYMMDDHHMM(v);
if(d != t[n]) {
t[n] = d; return true;
}
};
this.get = function(t) {return t[n].convertToYYYYMMDDHHMM();};
}
function LinksFieldAccess(n)
{
this.set = function(t,v) {
var s = (typeof v == "string") ? v.readBracketedList() : v;
if(s.toString() != t[n].toString()) {
t[n] = s; return true;
}
};
this.get = function(t) {return String.encodeTiddlyLinkList(t[n]);};
}
TiddlyWiki.standardFieldAccess = {
// The set functions return true when setting the data has changed the value.
"title": new StringFieldAccess("title",true),
// Handle the "tiddler" field name as the title
"tiddler": new StringFieldAccess("title",true),
"text": new StringFieldAccess("text"),
"modifier": new StringFieldAccess("modifier"),
"modified": new DateFieldAccess("modified"),
"creator": new StringFieldAccess("creator"),
"created": new DateFieldAccess("created"),
"tags": new LinksFieldAccess("tags")
};
TiddlyWiki.isStandardField = function(name)
{
return TiddlyWiki.standardFieldAccess[name] != undefined;
};
// Sets the value of the given field of the tiddler to the value.
// Setting an ExtendedField's value to null or undefined removes the field.
// Setting a namespace to undefined removes all fields of that namespace.
// The fieldName is case-insensitive.
// All values will be converted to a string value.
TiddlyWiki.prototype.setValue = function(tiddler,fieldName,value)
{
TiddlyWiki.checkFieldName(fieldName);
var t = this.resolveTiddler(tiddler);
if(!t)
return;
fieldName = fieldName.toLowerCase();
var isRemove = (value === undefined) || (value === null);
var accessor = TiddlyWiki.standardFieldAccess[fieldName];
if(accessor) {
if(isRemove)
// don't remove StandardFields
return;
var h = TiddlyWiki.standardFieldAccess[fieldName];
if(!h.set(t,value))
return;
} else {
var oldValue = t.fields[fieldName];
if(isRemove) {
if(oldValue !== undefined) {
// deletes a single field
delete t.fields[fieldName];
} else {
// no concrete value is defined for the fieldName
// so we guess this is a namespace path.
// delete all fields in a namespace
var re = new RegExp("^"+fieldName+"\\.");
var dirty = false;
var n;
for(n in t.fields) {
if(n.match(re)) {
delete t.fields[n];
dirty = true;
}
}
if(!dirty)
return;
}
} else {
// the "normal" set case. value is defined (not null/undefined)
// For convenience provide a nicer conversion Date->String
value = value instanceof Date ? value.convertToYYYYMMDDHHMMSSMMM() : String(value);
if(oldValue == value)
return;
t.fields[fieldName] = value;
}
}
// When we are here the tiddler/store really was changed.
this.notify(t.title,true);
if(!fieldName.match(/^temp\./))
this.setDirty(true);
};
// Returns the value of the given field of the tiddler.
// The fieldName is case-insensitive.
// Will only return String values (or undefined).
TiddlyWiki.prototype.getValue = function(tiddler,fieldName)
{
var t = this.resolveTiddler(tiddler);
if(!t)
return undefined;
if(fieldName.indexOf(config.textPrimitives.sectionSeparator) === 0 || fieldName.indexOf(config.textPrimitives.sliceSeparator) === 0) {
var sliceType = fieldName.substr(0, 2);
var sliceName = fieldName.substring(2);
return store.getTiddlerText("%0%1%2".format(t.title,sliceType,sliceName));
} else {
fieldName = fieldName.toLowerCase();
var accessor = TiddlyWiki.standardFieldAccess[fieldName];
if(accessor) {
return accessor.get(t);
}
}
return t.fields[fieldName];
};
// Calls the callback function for every field in the tiddler.
// When callback function returns a non-false value the iteration stops
// and that value is returned.
// The order of the fields is not defined.
// @param callback a function(tiddler,fieldName,value).
TiddlyWiki.prototype.forEachField = function(tiddler,callback,onlyExtendedFields)
{
var t = this.resolveTiddler(tiddler);
if(!t)
return undefined;
var n,result;
for(n in t.fields) {
result = callback(t,n,t.fields[n]);
if(result)
return result;
}
if(onlyExtendedFields)
return undefined;
for(n in TiddlyWiki.standardFieldAccess) {
if(n != "tiddler") {
// even though the "title" field can also be referenced through the name "tiddler"
// we only visit this field once.
result = callback(t,n,TiddlyWiki.standardFieldAccess[n].get(t));
if(result)
return result;
}
}
return undefined;
};
//--
//-- Story functions
//--
function Story(containerId,idPrefix)
{
this.container = containerId;
this.idPrefix = idPrefix;
this.highlightRegExp = null;
this.tiddlerId = function(title) {
title = title.replace(/_/g, "__").replace(/ /g, "_");
var id = this.idPrefix + title;
return id==this.container ? this.idPrefix + "_" + title : id;
};
this.containerId = function() {
return this.container;
};
}
Story.prototype.getTiddler = function(title)
{
return document.getElementById(this.tiddlerId(title));
};
Story.prototype.getContainer = function()
{
return document.getElementById(this.containerId());
};
Story.prototype.forEachTiddler = function(fn)
{
var place = this.getContainer();
if(!place)
return;
var e = place.firstChild;
while(e) {
var n = e.nextSibling;
var title = e.getAttribute("tiddler");
if(title) {
fn.call(this,title,e);
}
e = n;
}
};
Story.prototype.displayDefaultTiddlers = function()
{
this.displayTiddlers(null,store.filterTiddlers(store.getTiddlerText("DefaultTiddlers")));
};
Story.prototype.displayTiddlers = function(srcElement,titles,template,animate,unused,customFields,toggle)
{
var t;
for(t = titles.length-1;t>=0;t--)
this.displayTiddler(srcElement,titles[t],template,animate,unused,customFields);
};
Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle,animationSrc)
{
var title = (tiddler instanceof Tiddler) ? tiddler.title : tiddler;
var tiddlerElem = this.getTiddler(title);
if(tiddlerElem) {
if(toggle) {
if(tiddlerElem.getAttribute("dirty") != "true")
this.closeTiddler(title,true);
} else {
this.refreshTiddler(title,template,false,customFields);
}
} else {
var place = this.getContainer();
var before = this.positionTiddler(srcElement);
tiddlerElem = this.createTiddler(place,before,title,template,customFields);
}
if(animationSrc && typeof animationSrc !== "string") {
srcElement = animationSrc;
}
if(srcElement && typeof srcElement !== "string") {
if(config.options.chkAnimate && (animate == undefined || animate == true) && anim && typeof Zoomer == "function" && typeof Scroller == "function")
anim.startAnimating(new Zoomer(title,srcElement,tiddlerElem),new Scroller(tiddlerElem));
else
window.scrollTo(0,ensureVisible(tiddlerElem));
}
return tiddlerElem;
};
Story.prototype.positionTiddler = function(srcElement)
{
var place = this.getContainer();
var before = null;
if(typeof srcElement == "string") {
switch(srcElement) {
case "top":
before = place.firstChild;
break;
case "bottom":
before = null;
break;
}
} else {
var after = this.findContainingTiddler(srcElement);
if(after == null) {
before = place.firstChild;
} else if(after.nextSibling) {
before = after.nextSibling;
if(before.nodeType != 1)
before = null;
}
}
return before;
};
Story.prototype.createTiddler = function(place,before,title,template,customFields)
{
var tiddlerElem = createTiddlyElement(null,"div",this.tiddlerId(title),"tiddler");
tiddlerElem.setAttribute("refresh","tiddler");
if(customFields)
tiddlerElem.setAttribute("tiddlyFields",customFields);
place.insertBefore(tiddlerElem,before);
var defaultText = null;
if(!store.tiddlerExists(title) && !store.isShadowTiddler(title))
defaultText = this.loadMissingTiddler(title,customFields);
this.refreshTiddler(title,template,false,customFields,defaultText);
return tiddlerElem;
};
Story.prototype.loadMissingTiddler = function(title,fields,callback)
{
var getTiddlerCallback = function(context)
{
if(context.status) {
var t = context.tiddler;
if(!t.created)
t.created = new Date();
if(!t.modified)
t.modified = t.created;
var dirty = store.isDirty();
context.tiddler = store.saveTiddler(t.title,t.title,t.text,t.modifier,t.modified,t.tags,t.fields,true,t.created,t.creator);
if(!window.allowSave())
store.setDirty(dirty);
autoSaveChanges();
} else {
story.refreshTiddler(context.title,null,true);
}
context.adaptor.close();
if(callback) {
callback(context);
}
};
var tiddler = new Tiddler(title);
tiddler.fields = typeof fields == "string" ? fields.decodeHashMap() : fields||{};
var context = {serverType:tiddler.getServerType()};
if(!context.serverType)
return "";
context.host = tiddler.fields['server.host'];
context.workspace = tiddler.fields['server.workspace'];
var adaptor = new config.adaptors[context.serverType]();
adaptor.getTiddler(title,context,null,getTiddlerCallback);
return config.messages.loadingMissingTiddler.format([title,context.serverType,context.host,context.workspace]);
};
Story.prototype.chooseTemplateForTiddler = function(title,template)
{
if(!template)
template = DEFAULT_VIEW_TEMPLATE;
if(template == DEFAULT_VIEW_TEMPLATE || template == DEFAULT_EDIT_TEMPLATE)
template = config.tiddlerTemplates[template];
return template;
};
Story.prototype.getTemplateForTiddler = function(title,template,tiddler)
{
return store.getRecursiveTiddlerText(template,null,10);
};
Story.prototype.refreshTiddler = function(title,template,force,customFields,defaultText)
{
var tiddlerElem = this.getTiddler(title);
if(tiddlerElem) {
if(tiddlerElem.getAttribute("dirty") == "true" && !force)
return tiddlerElem;
template = this.chooseTemplateForTiddler(title,template);
var currTemplate = tiddlerElem.getAttribute("template");
if((template != currTemplate) || force) {
var tiddler = store.getTiddler(title);
if(!tiddler) {
tiddler = new Tiddler();
if(store.isShadowTiddler(title)) {
var tags = [];
tiddler.set(title,store.getTiddlerText(title),config.views.wikified.shadowModifier,version.date,tags,version.date);
} else {
var text = template=="EditTemplate" ?
config.views.editor.defaultText.format([title]) :
config.views.wikified.defaultText.format([title]);
text = defaultText || text;
var fields = customFields ? customFields.decodeHashMap() : null;
tiddler.set(title,text,config.views.wikified.defaultModifier,version.date,[],version.date,fields);
}
}
tiddlerElem.setAttribute("tags",tiddler.tags.join(" "));
tiddlerElem.setAttribute("tiddler",title);
tiddlerElem.setAttribute("template",template);
tiddlerElem.onmouseover = this.onTiddlerMouseOver;
tiddlerElem.onmouseout = this.onTiddlerMouseOut;
tiddlerElem.ondblclick = this.onTiddlerDblClick;
tiddlerElem[window.event?"onkeydown":"onkeypress"] = this.onTiddlerKeyPress;
tiddlerElem.innerHTML = this.getTemplateForTiddler(title,template,tiddler);
applyHtmlMacros(tiddlerElem,tiddler);
if(store.getTaggedTiddlers(title).length > 0)
jQuery(tiddlerElem).addClass("isTag");
else
jQuery(tiddlerElem).removeClass("isTag");
if(store.tiddlerExists(title)) {
jQuery(tiddlerElem).removeClass("shadow");
jQuery(tiddlerElem).removeClass("missing");
} else {
jQuery(tiddlerElem).addClass(store.isShadowTiddler(title) ? "shadow" : "missing");
}
if(customFields)
this.addCustomFields(tiddlerElem,customFields);
}
}
return tiddlerElem;
};
Story.prototype.addCustomFields = function(place,customFields)
{
var fields = customFields.decodeHashMap();
var w = createTiddlyElement(place,"div",null,"customFields");
w.style.display = "none";
var t;
for(t in fields) {
var e = document.createElement("input");
e.setAttribute("type","text");
e.setAttribute("value",fields[t]);
w.appendChild(e);
e.setAttribute("edit",t);
}
};
Story.prototype.refreshAllTiddlers = function(force)
{
var e = this.getContainer().firstChild;
while(e) {
var template = e.getAttribute("template");
if(template && e.getAttribute("dirty") != "true") {
this.refreshTiddler(e.getAttribute("tiddler"),force ? null : template,true);
}
e = e.nextSibling;
}
};
Story.prototype.onTiddlerMouseOver = function(e)
{
jQuery(this).addClass("selected");
};
Story.prototype.onTiddlerMouseOut = function(e)
{
jQuery(this).removeClass("selected");
};
Story.prototype.onTiddlerDblClick = function(ev)
{
var e = ev || window.event;
var target = resolveTarget(e);
if(target && target.nodeName.toLowerCase() != "input" && target.nodeName.toLowerCase() != "textarea") {
if(document.selection && document.selection.empty)
document.selection.empty();
config.macros.toolbar.invokeCommand(this,"defaultCommand",e);
e.cancelBubble = true;
if(e.stopPropagation) e.stopPropagation();
return true;
}
return false;
};
Story.prototype.onTiddlerKeyPress = function(ev)
{
var e = ev || window.event;
clearMessage();
var consume = false;
var title = this.getAttribute("tiddler");
var target = resolveTarget(e);
switch(e.keyCode) {
case 9: // Tab
var ed = story.getTiddlerField(title,"text");
if(target.tagName.toLowerCase() == "input" && ed.value==config.views.editor.defaultText.format([title])) {
// moving from input field and editor still contains default text, so select it
ed.focus();
ed.select();
consume = true;
}
if(config.options.chkInsertTabs && target.tagName.toLowerCase() == "textarea") {
replaceSelection(target,String.fromCharCode(9));
consume = true;
}
if(config.isOpera) {
target.onblur = function() {
this.focus();
this.onblur = null;
};
}
break;
case 13: // Ctrl-Enter
case 10: // Ctrl-Enter on IE PC
case 77: // Ctrl-Enter is "M" on some platforms
if(e.ctrlKey) {
blurElement(this);
config.macros.toolbar.invokeCommand(this,"defaultCommand",e);
consume = true;
}
break;
case 27: // Escape
blurElement(this);
config.macros.toolbar.invokeCommand(this,"cancelCommand",e);
consume = true;
break;
}
e.cancelBubble = consume;
if(consume) {
if(e.stopPropagation) e.stopPropagation(); // Stop Propagation
e.returnValue = true; // Cancel The Event in IE
if(e.preventDefault ) e.preventDefault(); // Cancel The Event in Moz
}
return !consume;
};
Story.prototype.getTiddlerField = function(title,field)
{
var tiddlerElem = this.getTiddler(title);
var e = null;
if(tiddlerElem) {
var t,children = tiddlerElem.getElementsByTagName("*");
for(t=0; t<children.length; t++) {
var c = children[t];
if(c.tagName.toLowerCase() == "input" || c.tagName.toLowerCase() == "textarea") {
if(!e)
e = c;
if(c.getAttribute("edit") == field)
e = c;
}
}
}
return e;
};
Story.prototype.focusTiddler = function(title,field)
{
var e = this.getTiddlerField(title,field);
if(e) {
e.focus();
e.select();
}
};
Story.prototype.blurTiddler = function(title)
{
var tiddlerElem = this.getTiddler(title);
if(tiddlerElem && tiddlerElem.focus && tiddlerElem.blur) {
tiddlerElem.focus();
tiddlerElem.blur();
}
};
Story.prototype.setTiddlerField = function(title,tag,mode,field)
{
var c = this.getTiddlerField(title,field);
var tags = c.value.readBracketedList();
tags.setItem(tag,mode);
c.value = String.encodeTiddlyLinkList(tags);
};
Story.prototype.setTiddlerTag = function(title,tag,mode)
{
this.setTiddlerField(title,tag,mode,"tags");
};
Story.prototype.closeTiddler = function(title,animate,unused)
{
var tiddlerElem = this.getTiddler(title);
if(tiddlerElem) {
clearMessage();
this.scrubTiddler(tiddlerElem);
if(config.options.chkAnimate && animate && anim && typeof Slider == "function")
anim.startAnimating(new Slider(tiddlerElem,false,null,"all"));
else {
jQuery(tiddlerElem).remove();
}
}
};
Story.prototype.scrubTiddler = function(tiddlerElem)
{
tiddlerElem.id = null;
};
Story.prototype.setDirty = function(title,dirty)
{
var tiddlerElem = this.getTiddler(title);
if(tiddlerElem)
tiddlerElem.setAttribute("dirty",dirty ? "true" : "false");
};
Story.prototype.isDirty = function(title)
{
var tiddlerElem = this.getTiddler(title);
if(tiddlerElem)
return tiddlerElem.getAttribute("dirty") == "true";
return null;
};
Story.prototype.areAnyDirty = function()
{
var r = false;
this.forEachTiddler(function(title,element) {
if(this.isDirty(title))
r = true;
});
return r;
};
Story.prototype.closeAllTiddlers = function(exclude)
{
clearMessage();
this.forEachTiddler(function(title,element) {
if((title != exclude) && element.getAttribute("dirty") != "true")
this.closeTiddler(title);
});
window.scrollTo(0,ensureVisible(this.container));
};
Story.prototype.isEmpty = function()
{
var place = this.getContainer();
return place && place.firstChild == null;
};
Story.prototype.search = function(text,useCaseSensitive,useRegExp)
{
this.closeAllTiddlers();
highlightHack = new RegExp(useRegExp ? text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img");
var matches = store.search(highlightHack,"title","excludeSearch");
this.displayTiddlers(null,matches);
highlightHack = null;
var q = useRegExp ? "/" : "'";
if(matches.length > 0)
displayMessage(config.macros.search.successMsg.format([matches.length.toString(),q + text + q]));
else
displayMessage(config.macros.search.failureMsg.format([q + text + q]));
};
Story.prototype.findContainingTiddler = function(e)
{
while(e && !jQuery(e).hasClass("tiddler")) {
e = jQuery(e).hasClass("popup") && Popup.stack[0] ? Popup.stack[0].root : e.parentNode;
}
return e;
};
Story.prototype.gatherSaveFields = function(e,fields)
{
if(e && e.getAttribute) {
var f = e.getAttribute("edit");
if(f)
fields[f] = e.value.replace(/\r/mg,"");
if(e.hasChildNodes()) {
var t,c = e.childNodes;
for(t=0; t<c.length; t++)
this.gatherSaveFields(c[t],fields);
}
}
};
Story.prototype.hasChanges = function(title)
{
var e = this.getTiddler(title);
if(e) {
var fields = {};
this.gatherSaveFields(e,fields);
if(store.fetchTiddler(title)) {
var n;
for(n in fields) {
if(store.getValue(title,n) != fields[n]) //# tiddler changed
return true;
}
} else {
if(store.isShadowTiddler(title) && store.getShadowTiddlerText(title) == fields.text) { //# not checking for title or tags
return false;
} else { //# changed shadow or new tiddler
return true;
}
}
}
return false;
};
Story.prototype.saveTiddler = function(title,minorUpdate)
{
var tiddlerElem = this.getTiddler(title);
if(tiddlerElem) {
var fields = {};
this.gatherSaveFields(tiddlerElem,fields);
var newTitle = fields.title || title;
if(!store.tiddlerExists(newTitle)) {
newTitle = newTitle.trim();
var creator = config.options.txtUserName;
}
if(store.tiddlerExists(newTitle) && newTitle != title) {
if(!confirm(config.messages.overwriteWarning.format([newTitle.toString()])))
return null;
title = newTitle;
}
if(newTitle != title)
this.closeTiddler(newTitle,false);
tiddlerElem.id = this.tiddlerId(newTitle);
tiddlerElem.setAttribute("tiddler",newTitle);
tiddlerElem.setAttribute("template",DEFAULT_VIEW_TEMPLATE);
tiddlerElem.setAttribute("dirty","false");
if(config.options.chkForceMinorUpdate)
minorUpdate = !minorUpdate;
if(!store.tiddlerExists(newTitle))
minorUpdate = false;
var newDate = new Date();
if(store.tiddlerExists(title)) {
var t = store.fetchTiddler(title);
var extendedFields = t.fields;
creator = t.creator;
} else {
extendedFields = merge({},config.defaultCustomFields);
}
var n;
for(n in fields) {
if(!TiddlyWiki.isStandardField(n))
extendedFields[n] = fields[n];
}
var tiddler = store.saveTiddler(title,newTitle,fields.text,minorUpdate ? undefined : config.options.txtUserName,minorUpdate ? undefined : newDate,fields.tags,extendedFields,null,null,creator);
autoSaveChanges(null,[tiddler]);
return newTitle;
}
return null;
};
Story.prototype.permaView = function()
{
var links = [];
this.forEachTiddler(function(title,element) {
links.push(String.encodeTiddlyLink(title));
});
var t = encodeURIComponent(links.join(" "));
if(t == "")
t = "#";
if(window.location.hash != t)
window.location.hash = t;
};
Story.prototype.switchTheme = function(theme)
{
if(safeMode)
return;
var getSlice = function(theme,slice) {
var r;
if(readOnly)
r = store.getTiddlerSlice(theme,slice+"ReadOnly") || store.getTiddlerSlice(theme,"Web"+slice);
r = r || store.getTiddlerSlice(theme,slice);
if(r && r.indexOf(config.textPrimitives.sectionSeparator)==0)
r = theme + r;
return store.isAvailable(r) ? r : slice;
};
var replaceNotification = function(i,name,theme,slice) {
var newName = getSlice(theme,slice);
if(name!=newName && store.namedNotifications[i].name==name) {
store.namedNotifications[i].name = newName;
return newName;
}
return name;
};
var pt = config.refresherData.pageTemplate;
var vi = DEFAULT_VIEW_TEMPLATE;
var vt = config.tiddlerTemplates[vi];
var ei = DEFAULT_EDIT_TEMPLATE;
var et = config.tiddlerTemplates[ei];
var i;
for(i=0; i<config.notifyTiddlers.length; i++) {
var name = config.notifyTiddlers[i].name;
switch(name) {
case "PageTemplate":
config.refresherData.pageTemplate = replaceNotification(i,config.refresherData.pageTemplate,theme,name);
break;
case "StyleSheet":
removeStyleSheet(config.refresherData.styleSheet);
config.refresherData.styleSheet = replaceNotification(i,config.refresherData.styleSheet,theme,name);
break;
case "ColorPalette":
config.refresherData.colorPalette = replaceNotification(i,config.refresherData.colorPalette,theme,name);
break;
default:
break;
}
}
config.tiddlerTemplates[vi] = getSlice(theme,"ViewTemplate");
config.tiddlerTemplates[ei] = getSlice(theme,"EditTemplate");
if(!startingUp) {
if(config.refresherData.pageTemplate!=pt || config.tiddlerTemplates[vi]!=vt || config.tiddlerTemplates[ei]!=et) {
refreshAll();
this.refreshAllTiddlers(true);
} else {
setStylesheet(store.getRecursiveTiddlerText(config.refresherData.styleSheet,"",10),config.refreshers.styleSheet);
}
config.options.txtTheme = theme;
saveOption("txtTheme");
}
};
//--
//-- Backstage
//--
// Backstage tasks
config.tasks.save.action = saveChanges;
var backstage = {
area: null,
toolbar: null,
button: null,
showButton: null,
hideButton: null,
cloak: null,
panel: null,
panelBody: null,
panelFooter: null,
currTabName: null,
currTabElem: null,
content: null,
init: function() {
var cmb = config.messages.backstage;
this.area = document.getElementById("backstageArea");
this.toolbar = jQuery("#backstageToolbar").empty()[0];
this.button = jQuery("#backstageButton").empty()[0];
this.button.style.display = "block";
var t = cmb.open.text + " " + glyph("bentArrowLeft");
this.showButton = createTiddlyButton(this.button,t,cmb.open.tooltip,
function(e) {backstage.show(); return false;},null,"backstageShow");
t = glyph("bentArrowRight") + " " + cmb.close.text;
this.hideButton = createTiddlyButton(this.button,t,cmb.close.tooltip,
function(e) {backstage.hide(); return false;},null,"backstageHide");
this.cloak = document.getElementById("backstageCloak");
this.panel = document.getElementById("backstagePanel");
this.panelFooter = createTiddlyElement(this.panel,"div",null,"backstagePanelFooter");
this.panelBody = createTiddlyElement(this.panel,"div",null,"backstagePanelBody");
this.cloak.onmousedown = function(e) {backstage.switchTab(null);};
createTiddlyText(this.toolbar,cmb.prompt);
for(t=0; t<config.backstageTasks.length; t++) {
var taskName = config.backstageTasks[t];
var task = config.tasks[taskName];
var handler = task.action ? this.onClickCommand : this.onClickTab;
var text = task.text + (task.action ? "" : glyph("downTriangle"));
var btn = createTiddlyButton(this.toolbar,text,task.tooltip,handler,"backstageTab");
jQuery(btn).addClass(task.action ? "backstageAction" : "backstageTask");
btn.setAttribute("task", taskName);
}
this.content = document.getElementById("contentWrapper");
if(config.options.chkBackstage)
this.show();
else
this.hide();
},
isVisible: function() {
return this.area ? this.area.style.display == "block" : false;
},
show: function() {
this.area.style.display = "block";
if(anim && config.options.chkAnimate) {
backstage.toolbar.style.left = findWindowWidth() + "px";
var p = [{style: "left", start: findWindowWidth(), end: 0, template: "%0px"}];
anim.startAnimating(new Morpher(backstage.toolbar,config.animDuration,p));
} else {
backstage.area.style.left = "0px";
}
jQuery(this.showButton).hide();
jQuery(this.hideButton).show();
config.options.chkBackstage = true;
saveOption("chkBackstage");
jQuery(this.content).addClass("backstageVisible");
},
hide: function() {
if(this.currTabElem) {
this.switchTab(null);
} else {
backstage.toolbar.style.left = "0px";
if(anim && config.options.chkAnimate) {
var p = [{style: "left", start: 0, end: findWindowWidth(), template: "%0px"}];
var c = function(element,properties) {backstage.area.style.display = "none";};
anim.startAnimating(new Morpher(backstage.toolbar,config.animDuration,p,c));
} else {
this.area.style.display = "none";
}
this.showButton.style.display = "block";
this.hideButton.style.display = "none";
config.options.chkBackstage = false;
saveOption("chkBackstage");
jQuery(this.content).removeClass("backstageVisible");
}
},
onClickCommand: function(e) {
var task = config.tasks[this.getAttribute("task")];
if(task.action) {
backstage.switchTab(null);
task.action();
}
return false;
},
onClickTab: function(e) {
backstage.switchTab(this.getAttribute("task"));
return false;
},
// Switch to a given tab, or none if null is passed
switchTab: function(tabName) {
var tabElem = null;
var e = this.toolbar.firstChild;
while(e) {
if(e.getAttribute && e.getAttribute("task") == tabName)
tabElem = e;
e = e.nextSibling;
}
if(tabName == backstage.currTabName) {
backstage.hidePanel();
return;
}
if(backstage.currTabElem) {
jQuery(this.currTabElem).removeClass("backstageSelTab");
}
if(tabElem && tabName) {
backstage.preparePanel();
jQuery(tabElem).addClass("backstageSelTab");
var task = config.tasks[tabName];
wikify(task.content,backstage.panelBody,null,null);
backstage.showPanel();
} else if(backstage.currTabElem) {
backstage.hidePanel();
}
backstage.currTabName = tabName;
backstage.currTabElem = tabElem;
},
isPanelVisible: function() {
return backstage.panel ? backstage.panel.style.display == "block" : false;
},
preparePanel: function() {
backstage.cloak.style.height = findDocHeight() + "px";
backstage.cloak.style.display = "block";
jQuery(backstage.panelBody).empty();
return backstage.panelBody;
},
showPanel: function() {
backstage.panel.style.display = "block";
if(anim && config.options.chkAnimate) {
backstage.panel.style.top = (-backstage.panel.offsetHeight) + "px";
var p = [{style: "top", start: -backstage.panel.offsetHeight, end: 0, template: "%0px"}];
anim.startAnimating(new Morpher(backstage.panel,config.animDuration,p),new Scroller(backstage.panel,false));
} else {
backstage.panel.style.top = "0px";
}
return backstage.panelBody;
},
hidePanel: function() {
if(backstage.currTabElem)
jQuery(backstage.currTabElem).removeClass("backstageSelTab");
backstage.currTabElem = null;
backstage.currTabName = null;
if(anim && config.options.chkAnimate) {
var p = [
{style: "top", start: 0, end: -(backstage.panel.offsetHeight), template: "%0px"},
{style: "display", atEnd: "none"}
];
var c = function(element,properties) {backstage.cloak.style.display = "none";};
anim.startAnimating(new Morpher(backstage.panel,config.animDuration,p,c));
} else {
jQuery([backstage.panel,backstage.cloak]).hide();
}
}
};
config.macros.backstage = {};
config.macros.backstage.handler = function(place,macroName,params)
{
var backstageTask = config.tasks[params[0]];
if(backstageTask)
createTiddlyButton(place,backstageTask.text,backstageTask.tooltip,function(e) {backstage.switchTab(params[0]); return false;});
};
//--
//-- ImportTiddlers macro
//--
config.macros.importTiddlers.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
if(readOnly) {
createTiddlyElement(place,"div",null,"marked",this.readOnlyWarning);
return;
}
var w = new Wizard();
w.createWizard(place,this.wizardTitle);
this.restart(w);
};
config.macros.importTiddlers.onCancel = function(e)
{
var wizard = new Wizard(this);
wizard.clear();
config.macros.importTiddlers.restart(wizard);
return false;
};
config.macros.importTiddlers.onClose = function(e)
{
backstage.hidePanel();
return false;
};
config.macros.importTiddlers.restart = function(wizard)
{
var me = config.macros.importTiddlers;
wizard.addStep(this.step1Title,this.step1Html);
var t,s = wizard.getElement("selTypes");
for(t in config.adaptors) {
var e = createTiddlyElement(s,"option",null,null,config.adaptors[t].serverLabel || t);
e.value = t;
}
if(config.defaultAdaptor)
s.value = config.defaultAdaptor;
s = wizard.getElement("selFeeds");
var feeds = this.getFeeds();
for(t in feeds) {
e = createTiddlyElement(s,"option",null,null,t);
e.value = t;
}
wizard.setValue("feeds",feeds);
s.onchange = me.onFeedChange;
var fileInput = wizard.getElement("txtBrowse");
fileInput.onchange = me.onBrowseChange;
fileInput.onkeyup = me.onBrowseChange;
wizard.setButtons([{caption: this.openLabel, tooltip: this.openPrompt, onClick: me.onOpen}]);
wizard.formElem.action = "javascript:;";
wizard.formElem.onsubmit = function() {
if(!this.txtPath || this.txtPath.value.length) //# check for manually entered path in first step
this.lastChild.firstChild.onclick();
};
};
config.macros.importTiddlers.getFeeds = function()
{
var feeds = {};
var t,tagged = store.getTaggedTiddlers("systemServer","title");
for(t=0; t<tagged.length; t++) {
var title = tagged[t].title;
var serverType = store.getTiddlerSlice(title,"Type");
if(!serverType)
serverType = "file";
feeds[title] = {title: title,
url: store.getTiddlerSlice(title,"URL"),
workspace: store.getTiddlerSlice(title,"Workspace"),
workspaceList: store.getTiddlerSlice(title,"WorkspaceList"),
tiddlerFilter: store.getTiddlerSlice(title,"TiddlerFilter"),
serverType: serverType,
description: store.getTiddlerSlice(title,"Description")};
}
return feeds;
};
config.macros.importTiddlers.onFeedChange = function(e)
{
var wizard = new Wizard(this);
var selTypes = wizard.getElement("selTypes");
var fileInput = wizard.getElement("txtPath");
var feeds = wizard.getValue("feeds");
var f = feeds[this.value];
if(f) {
selTypes.value = f.serverType;
fileInput.value = f.url;
wizard.setValue("feedName",f.serverType);
wizard.setValue("feedHost",f.url);
wizard.setValue("feedWorkspace",f.workspace);
wizard.setValue("feedWorkspaceList",f.workspaceList);
wizard.setValue("feedTiddlerFilter",f.tiddlerFilter);
}
return false;
};
config.macros.importTiddlers.onBrowseChange = function(e)
{
var wizard = new Wizard(this);
var file = this.value;
file = file.replace(/^C:\\fakepath\\/i,''); // remove fakepath (chrome/opera/safari)
if(this.files && this.files[0]) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
file = this.files[0].fileName; // REQUIRES PRIVILEGES.. NULL otherwise
} catch (ex) {
// non-priv fallback: combine filename with path to current document
var path=getLocalPath(document.location.href);
var slashpos=path.lastIndexOf('/'); if (slashpos==-1) slashpos=path.lastIndexOf('\\');
if (slashpos!=-1) path=path.substr(0,slashpos+1); // remove filename, leave trailing slash
file=path+file;
}
}
var fileInput = wizard.getElement("txtPath");
fileInput.value = config.macros.importTiddlers.getURLFromLocalPath(file);
var serverType = wizard.getElement("selTypes");
serverType.value = "file";
return true;
};
config.macros.importTiddlers.getURLFromLocalPath = function(v)
{
if(!v || !v.length)
return v;
v = v.replace(/\\/g,"/"); // use "/" for cross-platform consistency
var u;
var t = v.split(":");
var p = t[1] || t[0]; // remove drive letter (if any)
if(t[1] && (t[0] == "http" || t[0] == "https" || t[0] == "file")) {
u = v;
} else if(p.substr(0,1)=="/") {
u = document.location.protocol + "//" + document.location.hostname + (t[1] ? "/" : "") + v;
} else {
var c = document.location.href.replace(/\\/g,"/");
var pos = c.lastIndexOf("/");
if(pos!=-1)
c = c.substr(0,pos); // remove filename
u = c + "/" + p;
}
return u;
};
config.macros.importTiddlers.onOpen = function(e)
{
var me = config.macros.importTiddlers;
var wizard = new Wizard(this);
var fileInput = wizard.getElement("txtPath");
var url = fileInput.value;
var serverType = wizard.getElement("selTypes").value || config.defaultAdaptor;
var adaptor = new config.adaptors[serverType]();
wizard.setValue("adaptor",adaptor);
wizard.setValue("serverType",serverType);
wizard.setValue("host",url);
adaptor.openHost(url,null,wizard,me.onOpenHost);
wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusOpenHost);
return false;
};
config.macros.importTiddlers.onOpenHost = function(context,wizard)
{
var me = config.macros.importTiddlers;
var adaptor = wizard.getValue("adaptor");
if(context.status !== true)
displayMessage("Error in importTiddlers.onOpenHost: " + context.statusText);
adaptor.getWorkspaceList(context,wizard,me.onGetWorkspaceList);
wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusGetWorkspaceList);
};
config.macros.importTiddlers.onGetWorkspaceList = function(context,wizard)
{
var me = config.macros.importTiddlers;
if(context.status !== true)
displayMessage("Error in importTiddlers.onGetWorkspaceList: " + context.statusText);
wizard.setValue("context",context);
var workspace = wizard.getValue("feedWorkspace");
if(!workspace && context.workspaces.length==1)
workspace = context.workspaces[0].title;
if(workspace) {
context.adaptor.openWorkspace(workspace,context,wizard,me.onOpenWorkspace);
wizard.setValue("workspace",workspace);
wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusOpenWorkspace);
return;
}
wizard.addStep(me.step2Title,me.step2Html);
var t,s = wizard.getElement("selWorkspace");
s.onchange = me.onWorkspaceChange;
for(t=0; t<context.workspaces.length; t++) {
var e = createTiddlyElement(s,"option",null,null,context.workspaces[t].title);
e.value = context.workspaces[t].title;
}
var workspaceList = wizard.getValue("feedWorkspaceList");
if(workspaceList) {
var n,list = workspaceList.parseParams("workspace",null,false,true);
for(n=1; n<list.length; n++) {
if(context.workspaces.findByField("title",list[n].value) == null) {
e = createTiddlyElement(s,"option",null,null,list[n].value);
e.value = list[n].value;
}
}
}
if(workspace) {
t = wizard.getElement("txtWorkspace");
t.value = workspace;
}
wizard.setButtons([{caption: me.openLabel, tooltip: me.openPrompt, onClick: me.onChooseWorkspace}]);
};
config.macros.importTiddlers.onWorkspaceChange = function(e)
{
var wizard = new Wizard(this);
var t = wizard.getElement("txtWorkspace");
t.value = this.value;
this.selectedIndex = 0;
return false;
};
config.macros.importTiddlers.onChooseWorkspace = function(e)
{
var me = config.macros.importTiddlers;
var wizard = new Wizard(this);
var adaptor = wizard.getValue("adaptor");
var workspace = wizard.getElement("txtWorkspace").value;
wizard.setValue("workspace",workspace);
var context = wizard.getValue("context");
adaptor.openWorkspace(workspace,context,wizard,me.onOpenWorkspace);
wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusOpenWorkspace);
return false;
};
config.macros.importTiddlers.onOpenWorkspace = function(context,wizard)
{
var me = config.macros.importTiddlers;
if(context.status !== true)
displayMessage("Error in importTiddlers.onOpenWorkspace: " + context.statusText);
var adaptor = wizard.getValue("adaptor");
var browse=wizard.getElement("txtBrowse");
if (browse.files) context.file=browse.files[0]; // for HTML5 FileReader
adaptor.getTiddlerList(context,wizard,me.onGetTiddlerList,wizard.getValue("feedTiddlerFilter"));
wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],me.statusGetTiddlerList);
};
config.macros.importTiddlers.onGetTiddlerList = function(context,wizard)
{
var me = config.macros.importTiddlers;
if(context.status !== true) {
var error = context.statusText||me.errorGettingTiddlerList;
if(context.host.indexOf("file://") === 0) {
error = me.errorGettingTiddlerListFile;
} else {
error = context.xhr && context.xhr.status == 404 ? me.errorGettingTiddlerListHttp404 :
me.errorGettingTiddlerListHttp;
}
wizard.setButtons([{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}],"");
jQuery("span.status", wizard.footerEl).html(error); // so error message can be html
return;
}
// Extract data for the listview
var listedTiddlers = [];
if(context.tiddlers) {
var n;
for(n=0; n<context.tiddlers.length; n++) {
var tiddler = context.tiddlers[n];
listedTiddlers.push({
title: tiddler.title,
modified: tiddler.modified,
modifier: tiddler.modifier,
text: tiddler.text ? wikifyPlainText(tiddler.text,100) : "",
tags: tiddler.tags,
size: tiddler.text ? tiddler.text.length : 0,
tiddler: tiddler
});
}
}
listedTiddlers.sort(function(a,b) {return a.title < b.title ? -1 : (a.title == b.title ? 0 : +1);});
// Display the listview
wizard.addStep(me.step3Title,me.step3Html);
var markList = wizard.getElement("markList");
var listWrapper = document.createElement("div");
markList.parentNode.insertBefore(listWrapper,markList);
var listView = ListView.create(listWrapper,listedTiddlers,me.listViewTemplate);
wizard.setValue("listView",listView);
wizard.setValue("context",context);
var txtSaveTiddler = wizard.getElement("txtSaveTiddler");
txtSaveTiddler.value = me.generateSystemServerName(wizard);
wizard.setButtons([
{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel},
{caption: me.importLabel, tooltip: me.importPrompt, onClick: me.doImport}
]);
};
config.macros.importTiddlers.generateSystemServerName = function(wizard)
{
var serverType = wizard.getValue("serverType");
var host = wizard.getValue("host");
var workspace = wizard.getValue("workspace");
var pattern = config.macros.importTiddlers[workspace ? "systemServerNamePattern" : "systemServerNamePatternNoWorkspace"];
return pattern.format([serverType,host,workspace]);
};
config.macros.importTiddlers.saveServerTiddler = function(wizard)
{
var me = config.macros.importTiddlers;
var txtSaveTiddler = wizard.getElement("txtSaveTiddler").value;
if(store.tiddlerExists(txtSaveTiddler)) {
if(!confirm(me.confirmOverwriteSaveTiddler.format([txtSaveTiddler])))
return;
store.suspendNotifications();
store.removeTiddler(txtSaveTiddler);
store.resumeNotifications();
}
var serverType = wizard.getValue("serverType");
var host = wizard.getValue("host");
var workspace = wizard.getValue("workspace");
var text = me.serverSaveTemplate.format([serverType,host,workspace]);
store.saveTiddler(txtSaveTiddler,txtSaveTiddler,text,me.serverSaveModifier,new Date(),["systemServer"]);
};
config.macros.importTiddlers.doImport = function(e)
{
var me = config.macros.importTiddlers;
var wizard = new Wizard(this);
if(wizard.getElement("chkSave").checked)
me.saveServerTiddler(wizard);
var chkSync = wizard.getElement("chkSync").checked;
wizard.setValue("sync",chkSync);
var listView = wizard.getValue("listView");
var rowNames = ListView.getSelectedRows(listView);
var adaptor = wizard.getValue("adaptor");
var overwrite = [];
var t;
for(t=0; t<rowNames.length; t++) {
if(store.tiddlerExists(rowNames[t]))
overwrite.push(rowNames[t]);
}
if(overwrite.length > 0) {
if(!confirm(me.confirmOverwriteText.format([overwrite.join(", ")])))
return false;
}
wizard.addStep(me.step4Title.format([rowNames.length]),me.step4Html);
for(t=0; t<rowNames.length; t++) {
var link = document.createElement("div");
createTiddlyLink(link,rowNames[t],true);
var place = wizard.getElement("markReport");
place.parentNode.insertBefore(link,place);
}
wizard.setValue("remainingImports",rowNames.length);
wizard.setButtons([
{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}
],me.statusDoingImport);
var wizardContext = wizard.getValue("context");
var tiddlers = wizardContext ? wizardContext.tiddlers : [];
for(t=0; t<rowNames.length; t++) {
var context = {
allowSynchronous:true,
tiddler:tiddlers[tiddlers.findByField("title",rowNames[t])]
};
adaptor.getTiddler(rowNames[t],context,wizard,me.onGetTiddler);
}
return false;
};
config.macros.importTiddlers.onGetTiddler = function(context,wizard)
{
var me = config.macros.importTiddlers;
if(!context.status)
displayMessage("Error in importTiddlers.onGetTiddler: " + context.statusText);
var tiddler = context.tiddler;
store.suspendNotifications();
store.saveTiddler(tiddler.title, tiddler.title, tiddler.text, tiddler.modifier, tiddler.modified, tiddler.tags, tiddler.fields, true, tiddler.created);
if(!wizard.getValue("sync")) {
store.setValue(tiddler.title,'server',null);
}
store.resumeNotifications();
if(!context.isSynchronous)
store.notify(tiddler.title,true);
var remainingImports = wizard.getValue("remainingImports")-1;
wizard.setValue("remainingImports",remainingImports);
if(remainingImports == 0) {
if(context.isSynchronous) {
store.notifyAll();
refreshDisplay();
}
wizard.setButtons([
{caption: me.doneLabel, tooltip: me.donePrompt, onClick: me.onClose}
],me.statusDoneImport);
autoSaveChanges();
}
};
//--
//-- Upgrade macro
//--
config.macros.upgrade.handler = function(place)
{
var w = new Wizard();
w.createWizard(place,this.wizardTitle);
w.addStep(this.step1Title,this.step1Html.format([this.source,this.source]));
w.setButtons([{caption: this.upgradeLabel, tooltip: this.upgradePrompt, onClick: this.onClickUpgrade}]);
};
config.macros.upgrade.onClickUpgrade = function(e)
{
var me = config.macros.upgrade;
var w = new Wizard(this);
if(!window.allowSave()) {
alert(me.errorCantUpgrade);
return false;
}
if(story.areAnyDirty() || store.isDirty()) {
alert(me.errorNotSaved);
return false;
}
var localPath = getLocalPath(document.location.toString());
var backupPath = getBackupPath(localPath,me.backupExtension);
w.setValue("backupPath",backupPath);
w.setButtons([],me.statusPreparingBackup);
var original = loadOriginal(localPath);
w.setButtons([],me.statusSavingBackup);
var backup = copyFile(backupPath,localPath);
if(!backup)
backup = saveFile(backupPath,original);
if(!backup) {
w.setButtons([],me.errorSavingBackup);
alert(me.errorSavingBackup);
return false;
}
w.setButtons([],me.statusLoadingCore);
var options = {
type:"GET",
url:me.source,
processData:false,
success:function(data,textStatus,jqXHR) {
me.onLoadCore(true,w,jqXHR.responseText,me.source,jqXHR);
},
error:function(jqXHR,textStatus,errorThrown) {
me.onLoadCore(false,w,null,me.source,jqXHR);
}
};
ajaxReq(options);
return false;
};
config.macros.upgrade.onLoadCore = function(status,params,responseText,url,xhr)
{
var me = config.macros.upgrade;
var w = params;
var errMsg;
if(!status)
errMsg = me.errorLoadingCore;
var newVer = me.extractVersion(responseText);
if(!newVer)
errMsg = me.errorCoreFormat;
if(errMsg) {
w.setButtons([],errMsg);
alert(errMsg);
return;
}
var onStartUpgrade = function(e) {
w.setButtons([],me.statusSavingCore);
var localPath = getLocalPath(document.location.toString());
saveFile(localPath,responseText);
w.setButtons([],me.statusReloadingCore);
var backupPath = w.getValue("backupPath");
var newLoc = document.location.toString() + "?time=" + new Date().convertToYYYYMMDDHHMM() + "#upgrade:[[" + encodeURI(backupPath) + "]]";
window.setTimeout(function () {window.location = newLoc;},10);
};
var step2 = [me.step2Html_downgrade,me.step2Html_restore,me.step2Html_upgrade][compareVersions(version,newVer) + 1];
w.addStep(me.step2Title,step2.format([formatVersion(newVer),formatVersion(version)]));
w.setButtons([{caption: me.startLabel, tooltip: me.startPrompt, onClick: onStartUpgrade},{caption: me.cancelLabel, tooltip: me.cancelPrompt, onClick: me.onCancel}]);
};
config.macros.upgrade.onCancel = function(e)
{
var me = config.macros.upgrade;
var w = new Wizard(this);
w.addStep(me.step3Title,me.step3Html);
w.setButtons([]);
return false;
};
config.macros.upgrade.extractVersion = function(upgradeFile)
{
var re = /^var version = \{title: "([^"]+)", major: (\d+), minor: (\d+), revision: (\d+)(, beta: (\d+)){0,1}, date: new Date\("([^"]+)"\)/mg;
var m = re.exec(upgradeFile);
return m ? {title: m[1], major: m[2], minor: m[3], revision: m[4], beta: m[6], date: new Date(m[7])} : null;
};
function upgradeFrom(path)
{
var importStore = new TiddlyWiki();
var tw = loadFile(path);
if(window.netscape !== undefined)
tw = convertUTF8ToUnicode(tw);
importStore.importTiddlyWiki(tw);
importStore.forEachTiddler(function(title,tiddler) {
if(!store.getTiddler(title)) {
store.addTiddler(tiddler);
}
});
refreshDisplay();
saveChanges(); //# To create appropriate Markup* sections
alert(config.messages.upgradeDone.format([formatVersion()]));
window.location = window.location.toString().substr(0,window.location.toString().lastIndexOf("?"));
}
//--
//-- Manager UI for groups of tiddlers
//--
config.macros.plugins.handler = function(place,macroName,params,wikifier,paramString)
{
var wizard = new Wizard();
wizard.createWizard(place,this.wizardTitle);
wizard.addStep(this.step1Title,this.step1Html);
var markList = wizard.getElement("markList");
var listWrapper = document.createElement("div");
markList.parentNode.insertBefore(listWrapper,markList);
listWrapper.setAttribute("refresh","macro");
listWrapper.setAttribute("macroName","plugins");
listWrapper.setAttribute("params",paramString);
this.refresh(listWrapper,paramString);
};
config.macros.plugins.refresh = function(listWrapper,params)
{
var me = config.macros.plugins;
var wizard = new Wizard(listWrapper);
var selectedRows = [];
ListView.forEachSelector(listWrapper,function(e,rowName) {
if(e.checked)
selectedRows.push(e.getAttribute("rowName"));
});
jQuery(listWrapper).empty();
params = params.parseParams("anon");
var plugins = installedPlugins.slice(0);
var t,tiddler,p;
var configTiddlers = store.getTaggedTiddlers("systemConfig");
for(t=0; t<configTiddlers.length; t++) {
tiddler = configTiddlers[t];
if(plugins.findByField("title",tiddler.title) == null) {
p = getPluginInfo(tiddler);
p.executed = false;
p.log.splice(0,0,this.skippedText);
plugins.push(p);
}
}
for(t=0; t<plugins.length; t++) {
p = plugins[t];
p.size = p.tiddler.text ? p.tiddler.text.length : 0;
p.forced = p.tiddler.isTagged("systemConfigForce");
p.disabled = p.tiddler.isTagged("systemConfigDisable");
p.Selected = selectedRows.indexOf(plugins[t].title) != -1;
}
if(plugins.length == 0) {
createTiddlyElement(listWrapper,"em",null,null,this.noPluginText);
wizard.setButtons([]);
} else {
var template = readOnly ? this.listViewTemplateReadOnly : this.listViewTemplate;
var listView = ListView.create(listWrapper,plugins,template,this.onSelectCommand);
wizard.setValue("listView",listView);
if(!readOnly) {
wizard.setButtons([
{caption: me.removeLabel, tooltip: me.removePrompt, onClick: me.doRemoveTag},
{caption: me.deleteLabel, tooltip: me.deletePrompt, onClick: me.doDelete}
]);
}
}
};
config.macros.plugins.doRemoveTag = function(e)
{
var wizard = new Wizard(this);
var listView = wizard.getValue("listView");
var rowNames = ListView.getSelectedRows(listView);
if(rowNames.length == 0) {
alert(config.messages.nothingSelected);
} else {
var t;
for(t=0; t<rowNames.length; t++) {
store.setTiddlerTag(rowNames[t],false,"systemConfig");
}
autoSaveChanges();
}
};
config.macros.plugins.doDelete = function(e)
{
var wizard = new Wizard(this);
var listView = wizard.getValue("listView");
var rowNames = ListView.getSelectedRows(listView);
if(rowNames.length == 0) {
alert(config.messages.nothingSelected);
} else {
if(confirm(config.macros.plugins.confirmDeleteText.format([rowNames.join(", ")]))) {
var t;
for(t=0; t<rowNames.length; t++) {
store.removeTiddler(rowNames[t]);
story.closeTiddler(rowNames[t],true);
}
}
autoSaveChanges();
}
};
//--
//-- Message area
//--
function getMessageDiv()
{
var msgArea = document.getElementById("messageArea");
if(!msgArea)
return null;
if(!msgArea.hasChildNodes())
createTiddlyButton(createTiddlyElement(msgArea,"div",null,"messageToolbar"),
config.messages.messageClose.text,
config.messages.messageClose.tooltip,
clearMessage);
msgArea.style.display = "block";
return createTiddlyElement(msgArea,"div");
}
function displayMessage(text,linkText)
{
var e = getMessageDiv();
if(!e) {
alert(text);
return;
}
if(linkText) {
var link = createTiddlyElement(e,"a",null,null,text);
link.href = linkText;
link.target = "_blank";
} else {
e.appendChild(document.createTextNode(text));
}
}
function clearMessage()
{
var msgArea = document.getElementById("messageArea");
if(msgArea) {
jQuery(msgArea).empty();
msgArea.style.display = "none";
}
return false;
}
//--
//-- Refresh mechanism
//--
config.notifyTiddlers = [
{name: "SystemSettings", notify: onSystemSettingsChange},
{name: "StyleSheetLayout", notify: refreshStyles},
{name: "StyleSheetColors", notify: refreshStyles},
{name: "StyleSheet", notify: refreshStyles},
{name: "StyleSheetPrint", notify: refreshStyles},
{name: "PageTemplate", notify: refreshPageTemplate},
{name: "SiteTitle", notify: refreshPageTitle},
{name: "SiteSubtitle", notify: refreshPageTitle},
{name: "WindowTitle", notify: refreshPageTitle},
{name: "ColorPalette", notify: refreshColorPalette},
{name: null, notify: refreshDisplay}
];
config.refreshers = {
link: function(e,changeList)
{
var title = e.getAttribute("tiddlyLink");
refreshTiddlyLink(e,title);
return true;
},
tiddler: function(e,changeList)
{
var title = e.getAttribute("tiddler");
var template = e.getAttribute("template");
if(changeList && (changeList.indexOf && changeList.indexOf(title) != -1) && !story.isDirty(title))
story.refreshTiddler(title,template,true);
else
refreshElements(e,changeList);
return true;
},
content: function(e,changeList)
{
var title = e.getAttribute("tiddler");
var force = e.getAttribute("force");
var args = e.getAttribute("args");
if(force != null || changeList == null || (changeList.indexOf && changeList.indexOf(title) != -1)) {
jQuery(e).empty();
config.macros.tiddler.transclude(e,title,args);
return true;
} else
return false;
},
macro: function(e,changeList)
{
var macro = e.getAttribute("macroName");
var params = e.getAttribute("params");
if(macro)
macro = config.macros[macro];
if(macro && macro.refresh)
macro.refresh(e,params);
return true;
}
};
config.refresherData = {
styleSheet: "StyleSheet",
defaultStyleSheet: "StyleSheet",
pageTemplate: "PageTemplate",
defaultPageTemplate: "PageTemplate",
colorPalette: "ColorPalette",
defaultColorPalette: "ColorPalette"
};
function refreshElements(root,changeList)
{
var c,nodes = root.childNodes;
for(c=0; c<nodes.length; c++) {
var e = nodes[c], type = null;
if(e.getAttribute && (e.tagName ? e.tagName != "IFRAME" : true))
type = e.getAttribute("refresh");
var refresher = config.refreshers[type];
var refreshed = false;
if(refresher != undefined)
refreshed = refresher(e,changeList);
if(e.hasChildNodes() && !refreshed)
refreshElements(e,changeList);
}
}
function applyHtmlMacros(root,tiddler)
{
var e = root.firstChild;
while(e) {
var nextChild = e.nextSibling;
if(e.getAttribute) {
var macro = e.getAttribute("macro");
if(macro) {
e.removeAttribute("macro");
var params = "";
var p = macro.indexOf(" ");
if(p != -1) {
params = macro.substr(p+1);
macro = macro.substr(0,p);
}
invokeMacro(e,macro,params,null,tiddler);
}
}
if(e.hasChildNodes())
applyHtmlMacros(e,tiddler);
e = nextChild;
}
}
function refreshPageTemplate(title)
{
var stash = jQuery("<div/>").appendTo("body").hide()[0];
var display = story.getContainer();
var nodes,t;
if(display) {
nodes = display.childNodes;
for(t=nodes.length-1; t>=0; t--)
stash.appendChild(nodes[t]);
}
var wrapper = document.getElementById("contentWrapper");
if(!title || !store.isAvailable(title))
title = config.refresherData.pageTemplate;
if(!store.isAvailable(title))
title = config.refresherData.defaultPageTemplate; //# this one is always avaialable
wrapper.innerHTML = store.getRecursiveTiddlerText(title,null,10);
applyHtmlMacros(wrapper);
refreshElements(wrapper);
display = story.getContainer();
jQuery(display).empty();
if(!display)
display = createTiddlyElement(wrapper,"div",story.containerId());
nodes = stash.childNodes;
for(t=nodes.length-1; t>=0; t--)
display.appendChild(nodes[t]);
jQuery(stash).remove();
}
function refreshDisplay(hint)
{
if(typeof hint == "string")
hint = [hint];
var e = document.getElementById("contentWrapper");
refreshElements(e,hint);
if(backstage.isPanelVisible()) {
e = document.getElementById("backstage");
refreshElements(e,hint);
}
}
function refreshPageTitle()
{
document.title = getPageTitle();
}
function getPageTitle()
{
return wikifyPlainText(store.getTiddlerText("WindowTitle",""),null,tiddler);
}
function refreshStyles(title,doc)
{
setStylesheet(title == null ? "" : store.getRecursiveTiddlerText(title,"",10),title,doc || document);
}
function refreshColorPalette(title)
{
if(!startingUp)
refreshAll();
}
function refreshAll()
{
refreshPageTemplate();
refreshDisplay();
refreshStyles("StyleSheetLayout");
refreshStyles("StyleSheetColors");
refreshStyles(config.refresherData.styleSheet);
refreshStyles("StyleSheetPrint");
}
//--
//-- Option handling
//--
config.optionHandlers = {
'txt': {
get: function(name) {return encodeCookie(config.options[name].toString());},
set: function(name,value) {config.options[name] = decodeCookie(value);}
},
'chk': {
get: function(name) {return config.options[name] ? 'true' : 'false';},
set: function(name,value) {config.options[name] = value == 'true';}
}
};
function setOption(name,value)
{
var optType = name.substr(0,3);
if(config.optionHandlers[optType] && config.optionHandlers[optType].set)
config.optionHandlers[optType].set(name,value);
}
// Gets the value of an option as a string. Most code should just read from config.options.* directly
function getOption(name)
{
var optType = name.substr(0,3);
return config.optionHandlers[optType] && config.optionHandlers[optType].get ? config.optionHandlers[optType].get(name) : null;
}
function loadOptions()
{
if(safeMode)
return;
loadCookies();
loadSystemSettings();
}
// @Deprecated; retained for backwards compatibility
var loadOptionsCookie = loadOptions;
function getCookies()
{
var cookieList = document.cookie.split(';');
var i,cookies = {};
for(i=0; i<cookieList.length; i++) {
var p = cookieList[i].indexOf('=');
if(p != -1) {
var name = cookieList[i].substr(0,p).trim();
var value = cookieList[i].substr(p+1).trim();
cookies[name] = value;
}
}
return cookies;
}
function loadCookies()
{
var i,cookies = getCookies();
if(cookies['TiddlyWiki']) {
cookies = cookies['TiddlyWiki'].decodeHashMap();
}
for(i in cookies) {
if(config.optionsSource[i] != 'setting') {
setOption(i,cookies[i]);
}
}
}
function loadSystemSettings()
{
var key,settings = store.calcAllSlices('SystemSettings');
config.optionsSource = {};
for(key in settings) {
setOption(key,settings[key]);
config.optionsSource[key] = 'setting';
}
}
function onSystemSettingsChange()
{
if(!startingUp) {
loadSystemSettings();
}
}
function saveOption(name)
{
if(safeMode)
return;
if(name.match(/[()\s]/g, '_')) {
alert(config.messages.invalidCookie.format([name]));
return;
}
saveCookie(name);
if(config.optionsSource[name] == 'setting') {
saveSystemSetting(name,true);
}
}
// @Deprecated; retained for backwards compatibility
var saveOptionCookie = saveOption;
function removeCookie(name)
{
document.cookie = name + '=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;';
}
function saveCookie(name)
{
var key,cookies = {};
for(key in config.options) {
var value = getOption(key);
value = value == null ? 'false' : value;
cookies[key] = value;
}
document.cookie = 'TiddlyWiki=' + String.encodeHashMap(cookies) + '; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/';
cookies = getCookies();
var c;
for(c in cookies) {
var optType = c.substr(0,3);
if(config.optionHandlers[optType])
removeCookie(c);
}
}
var systemSettingSave;
function commitSystemSettings(storeWasDirty)
{
if(systemSettingSave) {
window.clearTimeout(systemSettingSave);
}
systemSettingSave = window.setTimeout(function() {
var tiddler = store.getTiddler('SystemSettings');
autoSaveChanges(null,[tiddler]);
}, 1000);
}
function saveSystemSetting(name,saveFile)
{
var title = 'SystemSettings';
var slice = store.getTiddlerSlice(title,name);
if(readOnly || slice === getOption(name)) {
return; //# don't save if read-only or the option hasn't changed
}
var slices = store.calcAllSlices(title);
var key;
for(key in config.optionsSource) {
var value = getOption(key) || '';
if(slices[key] !== value) {
slices[key] = value;
}
}
var text = [];
for(key in slices) {
text.push('%0: %1'.format([key,slices[key]]));
}
text = text.sort().join('\n');
var storeWasDirty = store.isDirty();
var tiddler = store.getTiddler(title);
if(tiddler) {
tiddler.text = text;
tiddler = store.saveTiddler(tiddler);
} else {
tiddler = store.saveTiddler(title,title,text,'System',new Date(),['excludeLists'],config.defaultCustomFields);
}
if(saveFile) {
commitSystemSettings(storeWasDirty);
}
}
function encodeCookie(s)
{
return escape(convertUnicodeToHtmlEntities(s));
}
function decodeCookie(s)
{
s = unescape(s);
var re = /&#[0-9]{1,5};/g;
return s.replace(re,function($0) {return String.fromCharCode(eval($0.replace(/[&#;]/g,'')));});
}
config.macros.option.genericCreate = function(place,type,opt,className,desc)
{
var typeInfo = config.macros.option.types[type];
var c = document.createElement(typeInfo.elementType);
if(typeInfo.typeValue)
c.setAttribute('type',typeInfo.typeValue);
c[typeInfo.eventName] = typeInfo.onChange;
c.setAttribute('option',opt);
c.className = className || typeInfo.className;
if(config.optionsDesc[opt])
c.setAttribute('title',config.optionsDesc[opt]);
place.appendChild(c);
if(desc != 'no')
createTiddlyText(place,config.optionsDesc[opt] || opt);
c[typeInfo.valueField] = config.options[opt];
return c;
};
config.macros.option.genericOnChange = function(e)
{
var opt = this.getAttribute('option');
if(opt) {
var optType = opt.substr(0,3);
var handler = config.macros.option.types[optType];
if(handler.elementType && handler.valueField)
config.macros.option.propagateOption(opt,handler.valueField,this[handler.valueField],handler.elementType,this);
}
return true;
};
config.macros.option.types = {
'txt': {
elementType: 'input',
valueField: 'value',
eventName: 'onchange',
className: 'txtOptionInput',
create: config.macros.option.genericCreate,
onChange: config.macros.option.genericOnChange
},
'chk': {
elementType: 'input',
valueField: 'checked',
eventName: 'onclick',
className: 'chkOptionInput',
typeValue: 'checkbox',
create: config.macros.option.genericCreate,
onChange: config.macros.option.genericOnChange
}
};
config.macros.option.propagateOption = function(opt,valueField,value,elementType,elem)
{
config.options[opt] = value;
saveOption(opt);
var t,nodes = document.getElementsByTagName(elementType);
for(t=0; t<nodes.length; t++) {
var optNode = nodes[t].getAttribute('option');
if(opt == optNode && nodes[t]!=elem)
nodes[t][valueField] = value;
}
};
config.macros.option.handler = function(place,macroName,params,wikifier,paramString)
{
params = paramString.parseParams('anon',null,true,false,false);
var opt = (params[1] && params[1].name == 'anon') ? params[1].value : getParam(params,'name',null);
var className = (params[2] && params[2].name == 'anon') ? params[2].value : getParam(params,'class',null);
var desc = getParam(params,'desc','no');
var type = opt.substr(0,3);
var h = config.macros.option.types[type];
if(h && h.create)
h.create(place,type,opt,className,desc);
};
config.macros.options.handler = function(place,macroName,params,wikifier,paramString)
{
params = paramString.parseParams('anon',null,true,false,false);
var showUnknown = getParam(params,'showUnknown','no');
var wizard = new Wizard();
wizard.createWizard(place,this.wizardTitle);
wizard.addStep(this.step1Title,this.step1Html);
var markList = wizard.getElement('markList');
var chkUnknown = wizard.getElement('chkUnknown');
chkUnknown.checked = showUnknown == 'yes';
chkUnknown.onchange = this.onChangeUnknown;
var listWrapper = document.createElement('div');
markList.parentNode.insertBefore(listWrapper,markList);
wizard.setValue('listWrapper',listWrapper);
this.refreshOptions(listWrapper,showUnknown == 'yes');
};
config.macros.options.refreshOptions = function(listWrapper,showUnknown)
{
var n,opts = [];
for(n in config.options) {
var opt = {};
opt.option = '';
opt.name = n;
opt.lowlight = !config.optionsDesc[n];
opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
if(!opt.lowlight || showUnknown)
opts.push(opt);
}
opts.sort(function(a,b) {return a.name.substr(3) < b.name.substr(3) ? -1 : (a.name.substr(3) == b.name.substr(3) ? 0 : +1);});
ListView.create(listWrapper,opts,this.listViewTemplate);
for(n=0; n<opts.length; n++) {
var type = opts[n].name.substr(0,3);
var h = config.macros.option.types[type];
if(h && h.create) {
h.create(opts[n].colElements['option'],type,opts[n].name,null,'no');
}
}
};
config.macros.options.onChangeUnknown = function(e)
{
var wizard = new Wizard(this);
var listWrapper = wizard.getValue('listWrapper');
jQuery(listWrapper).empty();
config.macros.options.refreshOptions(listWrapper,this.checked);
return false;
};
//--
//-- Saving
//--
var saveUsingSafari = false;
var startSaveArea = '<div id="' + 'storeArea">'; // Split up into two so that indexOf() of this source doesn't find it
var startSaveAreaRE = /<((div)|(DIV)) ((id)|(ID))=["']?storeArea['"]?>/; // Used for IE6
var endSaveArea = '</d' + 'iv>';
var endSaveAreaCaps = '</D' + 'IV>';
// If there are unsaved changes, force the user to confirm before exitting
function confirmExit()
{
hadConfirmExit = true;
if((store && store.isDirty && store.isDirty()) || (story && story.areAnyDirty && story.areAnyDirty()))
return config.messages.confirmExit;
}
// Give the user a chance to save changes before exitting
function checkUnsavedChanges()
{
if(store && store.isDirty && store.isDirty() && window.hadConfirmExit === false) {
if(confirm(config.messages.unsavedChangesWarning))
saveChanges();
}
}
function updateLanguageAttribute(s)
{
if(config.locale) {
var mRE = /(<html(?:.*?)?)(?: xml:lang\="([a-z]+)")?(?: lang\="([a-z]+)")?>/;
var m = mRE.exec(s);
if(m) {
var t = m[1];
if(m[2])
t += ' xml:lang="' + config.locale + '"';
if(m[3])
t += ' lang="' + config.locale + '"';
t += ">";
s = s.substr(0,m.index) + t + s.substr(m.index+m[0].length);
}
}
return s;
}
function updateMarkupBlock(s,blockName,tiddlerName)
{
return s.replaceChunk(
"<!--%0-START-->".format([blockName]),
"<!--%0-END-->".format([blockName]),
"\n" + convertUnicodeToFileFormat(store.getRecursiveTiddlerText(tiddlerName,"")) + "\n");
}
function updateOriginal(original,posDiv,localPath)
{
if(!posDiv)
posDiv = locateStoreArea(original);
if(!posDiv) {
alert(config.messages.invalidFileError.format([localPath]));
return null;
}
var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
convertUnicodeToFileFormat(store.allTiddlersAsHtml()) + "\n" +
original.substr(posDiv[1]);
var newSiteTitle = convertUnicodeToFileFormat(getPageTitle()).htmlEncode();
revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
revised = updateLanguageAttribute(revised);
revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
return revised;
}
function locateStoreArea(original)
{
// Locate the storeArea divs
if(!original)
return null;
var posOpeningDiv = original.search(startSaveAreaRE);
var limitClosingDiv = original.indexOf("<"+"!--POST-STOREAREA--"+">");
if(limitClosingDiv == -1)
limitClosingDiv = original.indexOf("<"+"!--POST-BODY-START--"+">");
var start = limitClosingDiv == -1 ? original.length : limitClosingDiv;
var posClosingDiv = original.lastIndexOf(endSaveArea,start);
if(posClosingDiv == -1)
posClosingDiv = original.lastIndexOf(endSaveAreaCaps,start);
return (posOpeningDiv != -1 && posClosingDiv != -1) ? [posOpeningDiv,posClosingDiv] : null;
}
function autoSaveChanges(onlyIfDirty,tiddlers)
{
if(config.options.chkAutoSave)
saveChanges(onlyIfDirty,tiddlers);
}
function loadOriginal(localPath)
{
var content=loadFile(localPath);
if (!content) content=window.originalHTML||recreateOriginal();
return content;
}
function recreateOriginal()
{
// construct doctype
var content = "<!DOCTYPE ";
var t=document.doctype;
if (!t)
content+="html"
else {
content+=t.name;
if (t.publicId) content+=' PUBLIC "'+t.publicId+'"';
else if (t.systemId) content+=' SYSTEM "'+t.systemId+'"';
}
content+=' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"';
content+='>\n';
// append current document content
content+=document.documentElement.outerHTML;
content=content.replace(/<div id="saveTest">savetest<\/div>/,'<div id="saveTest"></div>');
content=content.replace(/script><applet [^\>]*><\/applet>/g,'script>');
content=content.replace(/><head>/,'>\n<head>');
content=content.replace(/\n\n<\/body><\/html>$/,'</body>\n</html>\n');
content=content.replace(/(<(meta) [^\>]*[^\/])>/g,'$1 />');
content=content.replace(/<noscript>[^\<]*<\/noscript>/,
function(m){return m.replace(/</g,'<').replace(/>/g,'>');});
content=content.replace(/<div id="copyright">[^\<]*<\/div>/,
function(m){return m.replace(/\xA9/g,'©');});
return content;
}
// Save this tiddlywiki with the pending changes
function saveChanges(onlyIfDirty,tiddlers)
{
if(onlyIfDirty && !store.isDirty())
return;
clearMessage();
var t0 = new Date();
var msg = config.messages;
var originalPath = document.location.toString();
if(!window.allowSave()) {
alert(msg.notFileUrlError);
if(store.tiddlerExists(msg.saveInstructions))
story.displayTiddler(null,msg.saveInstructions);
return;
}
var localPath = getLocalPath(originalPath);
var original = loadOriginal(localPath);
if(original == null) {
alert(msg.cantSaveError);
if(store.tiddlerExists(msg.saveInstructions))
story.displayTiddler(null,msg.saveInstructions);
return;
}
var posDiv = locateStoreArea(original);
if(!posDiv) {
alert(msg.invalidFileError.format([localPath]));
return;
}
var co=config.options; //# abbreviation
config.saveByDownload=false;
config.saveByManualDownload=false;
saveMain(localPath,original,posDiv);
if (!config.saveByDownload && !config.saveByManualDownload) {
if(co.chkSaveBackups)
saveBackup(localPath,original);
if(co.chkSaveEmptyTemplate)
saveEmpty(localPath,original,posDiv);
if(co.chkGenerateAnRssFeed && saveRss instanceof Function)
saveRss(localPath);
}
if(co.chkDisplayInstrumentation)
displayMessage("saveChanges " + (new Date()-t0) + " ms");
}
function saveMain(localPath,original,posDiv)
{
var save;
try {
var revised = updateOriginal(original,posDiv,localPath);
save = saveFile(localPath,revised);
} catch (ex) {
showException(ex);
}
if(save) {
if (!config.saveByManualDownload) {
if (config.saveByDownload) { //# set by HTML5DownloadSaveFile()
var link = getDataURI(revised);
var msg = config.messages.mainDownload;
} else {
var link = "file://" + localPath;
var msg = config.messages.mainSaved;
}
displayMessage(msg,link);
}
store.setDirty(false);
} else {
alert(config.messages.mainFailed);
}
}
function saveBackup(localPath,original)
{
var backupPath = getBackupPath(localPath);
var backup = copyFile(backupPath,localPath);
if(!backup)
backup = saveFile(backupPath,original);
if(backup)
displayMessage(config.messages.backupSaved,"file://" + backupPath);
else
alert(config.messages.backupFailed);
}
function saveEmpty(localPath,original,posDiv)
{
var emptyPath,p;
if((p = localPath.lastIndexOf("/")) != -1)
emptyPath = localPath.substr(0,p) + "/";
else if((p = localPath.lastIndexOf("\\")) != -1)
emptyPath = localPath.substr(0,p) + "\\";
else
emptyPath = localPath + ".";
emptyPath += "empty.html";
var empty = original.substr(0,posDiv[0] + startSaveArea.length) + original.substr(posDiv[1]);
var emptySave = saveFile(emptyPath,empty);
if(emptySave)
displayMessage(config.messages.emptySaved,"file://" + emptyPath);
else
alert(config.messages.emptyFailed);
}
// Translate URL to local path [Preemption]
window.getLocalPath = window.getLocalPath || function(origPath)
{
var originalPath = convertUriToUTF8(origPath,config.options.txtFileSystemCharSet);
// Remove any location or query part of the URL
var argPos = originalPath.indexOf("?");
if(argPos != -1)
originalPath = originalPath.substr(0,argPos);
var hashPos = originalPath.indexOf("#");
if(hashPos != -1)
originalPath = originalPath.substr(0,hashPos);
// Convert file://localhost/ to file:///
if(originalPath.indexOf("file://localhost/") == 0)
originalPath = "file://" + originalPath.substr(16);
// Convert to a native file format
var localPath;
if(originalPath.charAt(9) == ":") // pc local file
localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\\");
else if(originalPath.indexOf("file://///") == 0) // FireFox pc network file
localPath = "\\\\" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\\");
else if(originalPath.indexOf("file:///") == 0) // mac/unix local file
localPath = unescape(originalPath.substr(7));
else if(originalPath.indexOf("file:/") == 0) // mac/unix local file
localPath = unescape(originalPath.substr(5));
else // pc network file
localPath = "\\\\" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\\");
return localPath;
}
function getBackupPath(localPath,title,extension)
{
var slash = "\\";
var dirPathPos = localPath.lastIndexOf("\\");
if(dirPathPos == -1) {
dirPathPos = localPath.lastIndexOf("/");
slash = "/";
}
var backupFolder = config.options.txtBackupFolder;
if(!backupFolder || backupFolder == "")
backupFolder = ".";
var backupPath = localPath.substr(0,dirPathPos) + slash + backupFolder + localPath.substr(dirPathPos);
backupPath = backupPath.substr(0,backupPath.lastIndexOf(".")) + ".";
if(title)
backupPath += title.replace(/[\\\/\*\?\":<> ]/g,"_") + ".";
backupPath += (new Date()).convertToYYYYMMDDHHMMSSMMM() + "." + (extension || "html");
return backupPath;
}
//--
//-- RSS Saving
//--
function saveRss(localPath)
{
var rssPath = localPath.substr(0,localPath.lastIndexOf(".")) + ".xml";
if(saveFile(rssPath,convertUnicodeToFileFormat(generateRss())))
displayMessage(config.messages.rssSaved,"file://" + rssPath);
else
alert(config.messages.rssFailed);
}
tiddlerToRssItem = function(tiddler,uri)
{
var s = "<title" + ">" + tiddler.title.htmlEncode() + "</title" + ">\n";
s += "<description>" + wikifyStatic(tiddler.text,null,tiddler).htmlEncode() + "</description>\n";
var i;
for(i=0; i<tiddler.tags.length; i++)
s += "<category>" + tiddler.tags[i] + "</category>\n";
s += "<link>" + uri + "#" + encodeURIComponent(String.encodeTiddlyLink(tiddler.title)) + "</link>\n";
s +="<pubDate>" + tiddler.modified.toGMTString() + "</pubDate>\n";
return s;
};
function generateRss()
{
var s = [];
var d = new Date();
var u = store.getTiddlerText("SiteUrl");
// Assemble the header
s.push("<" + "?xml version=\"1.0\"?" + ">");
s.push("<rss version=\"2.0\">");
s.push("<channel>");
s.push("<title" + ">" + wikifyPlainText(store.getTiddlerText("SiteTitle",""),null,tiddler).htmlEncode() + "</title" + ">");
if(u)
s.push("<link>" + u.htmlEncode() + "</link>");
s.push("<description>" + wikifyPlainText(store.getTiddlerText("SiteSubtitle",""),null,tiddler).htmlEncode() + "</description>");
s.push("<language>" + config.locale + "</language>");
s.push("<copyright>Copyright " + d.getFullYear() + " " + config.options.txtUserName.htmlEncode() + "</copyright>");
s.push("<pubDate>" + d.toGMTString() + "</pubDate>");
s.push("<lastBuildDate>" + d.toGMTString() + "</lastBuildDate>");
s.push("<docs>http://blogs.law.harvard.edu/tech/rss</docs>");
s.push("<generator>TiddlyWiki " + formatVersion() + "</generator>");
// The body
var tiddlers = store.getTiddlers("modified","excludeLists");
var i,n = config.numRssItems > tiddlers.length ? 0 : tiddlers.length-config.numRssItems;
for(i=tiddlers.length-1; i>=n; i--) {
s.push("<item>\n" + tiddlerToRssItem(tiddlers[i],u) + "\n</item>");
}
// And footer
s.push("</channel>");
s.push("</rss>");
// Save it all
return s.join("\n");
}
//--
//-- Filesystem code
//--
// Copy a file in filesystem [Preemption]
window.copyFile = window.copyFile || function(dest,source)
{
return config.browser.isIE ? ieCopyFile(dest,source) : false;
}
// Save a file in filesystem [Preemption]
window.saveFile = window.saveFile || function(fileUrl,content)
{
var r = mozillaSaveFile(fileUrl,content);
if(!r)
r = ieSaveFile(fileUrl,content);
if(!r)
r = javaSaveFile(fileUrl,content);
if(!r)
r = HTML5DownloadSaveFile(fileUrl,content);
if(!r)
r = manualSaveFile(fileUrl,content);
return r;
}
// Load a file from filesystem [Preemption]
window.loadFile = window.loadFile || function(fileUrl)
{
var r = mozillaLoadFile(fileUrl);
if((r == null) || (r == false))
r = ieLoadFile(fileUrl);
if((r == null) || (r == false))
r = javaLoadFile(fileUrl);
return r;
}
function ieCreatePath(path)
{
try {
var fso = new ActiveXObject("Scripting.FileSystemObject");
} catch(ex) {
return null;
}
var pos = path.lastIndexOf("\\");
if(pos==-1)
pos = path.lastIndexOf("/");
if(pos!=-1)
path = path.substring(0,pos+1);
var scan = [path];
var parent = fso.GetParentFolderName(path);
while(parent && !fso.FolderExists(parent)) {
scan.push(parent);
parent = fso.GetParentFolderName(parent);
}
for(i=scan.length-1;i>=0;i--) {
if(!fso.FolderExists(scan[i])) {
fso.CreateFolder(scan[i]);
}
}
return true;
}
// Returns null if it can't do it, false if there's an error, true if it saved OK
function ieSaveFile(filePath,content)
{
ieCreatePath(filePath);
try {
var fso = new ActiveXObject("Scripting.FileSystemObject");
} catch(ex) {
return null;
}
var file = fso.OpenTextFile(filePath,2,-1,0);
file.Write(content);
file.Close();
return true;
}
// Returns null if it can't do it, false if there's an error, or a string of the content if successful
function ieLoadFile(filePath)
{
try {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.OpenTextFile(filePath,1);
var content = file.ReadAll();
file.Close();
} catch(ex) {
return null;
}
return content;
}
function ieCopyFile(dest,source)
{
ieCreatePath(dest);
try {
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.GetFile(source).Copy(dest);
} catch(ex) {
return false;
}
return true;
}
// Returns null if it can't do it, false if there's an error, true if it saved OK
function mozillaSaveFile(filePath,content)
{
if(window.Components) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(filePath);
if(!file.exists())
file.create(0,0x01B4);// 0x01B4 = 0664
var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
out.init(file,0x22,0x04,null);
out.write(content,content.length);
out.flush();
out.close();
return true;
} catch(ex) {
return false;
}
}
return null;
}
// Returns null if it can't do it, false if there's an error, or a string of the content if successful
function mozillaLoadFile(filePath)
{
if(window.Components) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(filePath);
if(!file.exists())
return null;
var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
inputStream.init(file,0x01,0x04,null);
var sInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
sInputStream.init(inputStream);
var contents = sInputStream.read(sInputStream.available());
sInputStream.close();
inputStream.close();
return contents;
} catch(ex) {
return false;
}
}
return null;
}
function javaUrlToFilename(url)
{
var f = "//localhost";
if(url.indexOf(f) == 0)
return url.substring(f.length);
var i = url.indexOf(":");
return i > 0 ? url.substring(i-1) : url;
}
/*
*
* in between when the applet has been started
* and the user has given permission to run the applet
* we get an applet object, but it doesn't have the methods
* we expect yet.
*
*/
var LOG_TIDDLYSAVER = true;
function logTiddlySaverException(msg, ex) {
var applet = document.applets['TiddlySaver'];
console.log(msg + ": " + ex);
if (LOG_TIDDLYSAVER && applet) {
try {
console.log(msg + ": " + applet.getLastErrorMsg());
console.log(msg + ": " + applet.getLastErrorStackTrace());
} catch (ex) {}
}
}
function javaDebugInformation () {
var applet = document.applets['TiddlySaver'];
var what = [
["Java Version", applet.getJavaVersion],
["Last Exception", applet.getLastErrorMessage],
["Last Exception Stack Trace", applet.getLastErrorStackTrace],
["System Properties", applet.getSystemProperties] ];
function formatItem (description, method) {
try {
result = String(method.call(applet));
} catch (ex) {
result = String(ex)
}
return description + ": " + result
}
return jQuery.map(what, function (item) { return formatItem.apply(this, item) })
.join('\n\n')
}
function javaSaveFile(filePath,content)
{
var applet = document.applets['TiddlySaver'];
try {
if (applet && filePath)
return applet.saveFile(javaUrlToFilename(filePath), "UTF-8", content);
} catch(ex) {
logTiddlySaverException("javaSaveFile", ex);
}
// is this next block working anywhere ? -- grmble
try {
var s = new java.io.PrintStream(new java.io.FileOutputStream(javaUrlToFilename(filePath)));
s.print(content);
s.close();
} catch(ex2) {
return null;
}
return true;
}
function javaLoadFile(filePath)
{
var applet = document.applets['TiddlySaver'];
try {
if (applet && filePath) {
var ret = applet.loadFile(javaUrlToFilename(filePath),"UTF-8");
if(!ret)
return null;
return String(ret);
}
} catch(ex) {
logTiddlySaverException("javaLoadFile", ex);
}
// is this next block working anywhere ? -- grmble
var content = [];
try {
var r = new java.io.BufferedReader(new java.io.FileReader(javaUrlToFilename(filePath)));
var line;
while((line = r.readLine()) != null)
content.push(String(line));
r.close();
} catch(ex2) {
return null;
}
return content.join("\n");
}
function HTML5DownloadSaveFile(filePath,content)
{
if(document.createElement("a").download !== undefined) {
config.saveByDownload=true;
var slashpos=filePath.lastIndexOf("/");
if (slashpos==-1) slashpos=filePath.lastIndexOf("\\");
var filename=filePath.substr(slashpos+1);
var uri = getDataURI(content);
var link = document.createElement("a");
link.setAttribute("target","_blank");
link.setAttribute("href",uri);
link.setAttribute("download",filename);
document.body.appendChild(link); link.click(); document.body.removeChild(link);
return true;
}
return null;
}
// Returns null if it can't do it, false if there's an error, true if it saved OK
function manualSaveFile(filePath,content)
{
// FALLBACK for showing a link to data: URI
config.saveByManualDownload=true;
var slashpos=filePath.lastIndexOf("/");
if (slashpos==-1) slashpos=filePath.lastIndexOf("\\");
var filename=filePath.substr(slashpos+1);
var uri = getDataURI(content);
displayMessage(config.messages.mainDownloadManual,uri);
return true;
}
// construct data URI (using base64 encoding to preserve multi-byte encodings)
function getDataURI(data) {
if (config.browser.isIE)
return "data:text/html,"+encodeURIComponent(data);
else
return "data:text/html;base64,"+encodeBase64(data);
}
function encodeBase64(data) {
if (!data) return "";
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var out = "";
var chr1,chr2,chr3="";
var enc1,enc2,enc3,enc4="";
for (var count=0,i=0; i<data.length; ) {
chr1=data.charCodeAt(i++);
chr2=data.charCodeAt(i++);
chr3=data.charCodeAt(i++);
enc1=chr1 >> 2;
enc2=((chr1 & 3) << 4) | (chr2 >> 4);
enc3=((chr2 & 15) << 2) | (chr3 >> 6);
enc4=chr3 & 63;
if (isNaN(chr2)) enc3=enc4=64;
else if (isNaN(chr3)) enc4=64;
out+=keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);
chr1=chr2=chr3=enc1=enc2=enc3=enc4="";
}
return out;
}//--
//-- Filesystem utilities
//--
function convertUTF8ToUnicode(u)
{
return config.browser.isOpera || !window.netscape ? manualConvertUTF8ToUnicode(u) : mozConvertUTF8ToUnicode(u);
}
function manualConvertUTF8ToUnicode(utf)
{
var uni = utf;
var src = 0;
var dst = 0;
var b1, b2, b3;
var c;
while(src < utf.length) {
b1 = utf.charCodeAt(src++);
if(b1 < 0x80) {
dst++;
} else if(b1 < 0xE0) {
b2 = utf.charCodeAt(src++);
c = String.fromCharCode(((b1 & 0x1F) << 6) | (b2 & 0x3F));
uni = uni.substring(0,dst++).concat(c,utf.substr(src));
} else {
b2 = utf.charCodeAt(src++);
b3 = utf.charCodeAt(src++);
c = String.fromCharCode(((b1 & 0xF) << 12) | ((b2 & 0x3F) << 6) | (b3 & 0x3F));
uni = uni.substring(0,dst++).concat(c,utf.substr(src));
}
}
return uni;
}
function mozConvertUTF8ToUnicode(u)
{
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
} catch(ex) {
return manualConvertUTF8ToUnicode(u);
} // fallback
var s = converter.ConvertToUnicode(u);
var fin = converter.Finish();
return fin.length > 0 ? s+fin : s;
}
function convertUnicodeToFileFormat(s)
{
return config.browser.isOpera || !window.netscape ? (config.browser.isIE ? convertUnicodeToHtmlEntities(s) : s) : mozConvertUnicodeToUTF8(s);
}
function convertUnicodeToHtmlEntities(s)
{
var re = /[^\u0000-\u007F]/g;
return s.replace(re,function($0) {return "&#" + $0.charCodeAt(0).toString() + ";";});
}
function convertUnicodeToUTF8(s)
{
// return convertUnicodeToFileFormat to allow plugin migration
return convertUnicodeToFileFormat(s);
}
function manualConvertUnicodeToUTF8(s)
{
return unescape(encodeURIComponent(s));
}
function mozConvertUnicodeToUTF8(s)
{
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
} catch(ex) {
return manualConvertUnicodeToUTF8(s);
} // fallback
var u = converter.ConvertFromUnicode(s);
var fin = converter.Finish();
return fin.length > 0 ? u + fin : u;
}
function convertUriToUTF8(uri,charSet)
{
if(window.netscape == undefined || charSet == undefined || charSet == "")
return uri;
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var converter = Components.classes["@mozilla.org/intl/utf8converterservice;1"].getService(Components.interfaces.nsIUTF8ConverterService);
} catch(ex) {
return uri;
}
return converter.convertURISpecToUTF8(uri,charSet);
}
//--
//-- Server adaptor base class
//--
function AdaptorBase()
{
this.host = null;
this.store = null;
return this;
}
AdaptorBase.prototype.close = function()
{
return true;
};
AdaptorBase.prototype.fullHostName = function(host)
{
if(!host)
return '';
host = host.trim();
if(!host.match(/:\/\//))
host = 'http://' + host;
if(host.substr(host.length-1) == '/')
host = host.substr(0,host.length-1);
return host;
};
AdaptorBase.minHostName = function(host)
{
return host;
};
AdaptorBase.prototype.setContext = function(context,userParams,callback)
{
if(!context) context = {};
context.userParams = userParams;
if(callback) context.callback = callback;
context.adaptor = this;
if(!context.host)
context.host = this.host;
context.host = this.fullHostName(context.host);
if(!context.workspace)
context.workspace = this.workspace;
return context;
};
// Open the specified host
AdaptorBase.prototype.openHost = function(host,context,userParams,callback)
{
this.host = host;
context = this.setContext(context,userParams,callback);
context.status = true;
if(callback)
window.setTimeout(function() {context.callback(context,userParams);},10);
return true;
};
// Open the specified workspace
AdaptorBase.prototype.openWorkspace = function(workspace,context,userParams,callback)
{
this.workspace = workspace;
context = this.setContext(context,userParams,callback);
context.status = true;
if(callback)
window.setTimeout(function() {callback(context,userParams);},10);
return true;
};
//--
//-- Server adaptor for talking to static TiddlyWiki files
//--
function FileAdaptor()
{
}
FileAdaptor.prototype = new AdaptorBase();
FileAdaptor.serverType = 'file';
FileAdaptor.serverLabel = 'TiddlyWiki';
FileAdaptor.loadTiddlyWikiSuccess = function(context,jqXHR)
{
context.status = true;
context.adaptor.store = new TiddlyWiki();
if(!context.adaptor.store.importTiddlyWiki(jqXHR.responseText)) {
context.statusText = config.messages.invalidFileError.format([context.host]);
context.status = false;
}
context.complete(context,context.userParams);
};
FileAdaptor.loadTiddlyWikiError = function(context,jqXHR)
{
context.status = false;
context.statusText = jqXHR.message;
context.complete(context,context.userParams);
};
// Get the list of workspaces on a given server
FileAdaptor.prototype.getWorkspaceList = function(context,userParams,callback)
{
context = this.setContext(context,userParams,callback);
context.workspaces = [{title:"(default)"}];
context.status = true;
if(callback)
window.setTimeout(function() {callback(context,userParams);},10);
return true;
};
// Gets the list of tiddlers within a given workspace
FileAdaptor.prototype.getTiddlerList = function(context,userParams,callback,filter)
{
context = this.setContext(context,userParams,callback);
if(!context.filter)
context.filter = filter;
context.complete = FileAdaptor.getTiddlerListComplete;
if(this.store) {
return context.complete(context,context.userParams);
}
var options = {
type:"GET",
url:context.host,
file:context.file, // for HTML5 FileReader
processData:false,
success:function(data,textStatus,jqXHR) {
FileAdaptor.loadTiddlyWikiSuccess(context,jqXHR);
},
error:function(jqXHR,textStatus,errorThrown) {
context.xhr = jqXHR;
FileAdaptor.loadTiddlyWikiError(context,jqXHR);
}
};
return ajaxReq(options);
};
FileAdaptor.getTiddlerListComplete = function(context,userParams)
{
if(context.status) {
if(context.filter) {
context.tiddlers = context.adaptor.store.filterTiddlers(context.filter);
} else {
context.tiddlers = [];
context.adaptor.store.forEachTiddler(function(title,tiddler) {context.tiddlers.push(tiddler);});
}
var i;
for(i=0; i<context.tiddlers.length; i++) {
context.tiddlers[i].fields['server.type'] = FileAdaptor.serverType;
context.tiddlers[i].fields['server.host'] = AdaptorBase.minHostName(context.host);
context.tiddlers[i].fields['server.page.revision'] = context.tiddlers[i].modified.convertToYYYYMMDDHHMM();
}
context.status = true;
}
if(context.callback) {
window.setTimeout(function() {context.callback(context,userParams);},10);
}
return true;
};
FileAdaptor.prototype.generateTiddlerInfo = function(tiddler)
{
var info = {};
info.uri = tiddler.fields['server.host'] + "#" + tiddler.title;
return info;
};
// Retrieve a tiddler from a given workspace on a given server
FileAdaptor.prototype.getTiddler = function(title,context,userParams,callback)
{
context = this.setContext(context,userParams,callback);
context.title = title;
context.complete = FileAdaptor.getTiddlerComplete;
if(context.adaptor.store) {
return context.complete(context,context.userParams);
}
var options = {
type:"GET",
url:context.host,
processData:false,
success:function(data,textStatus,jqXHR) {
FileAdaptor.loadTiddlyWikiSuccess(context,jqXHR);
},
error:function(jqXHR,textStatus,errorThrown) {
FileAdaptor.loadTiddlyWikiError(context,jqXHR);
}
};
return ajaxReq(options);
};
FileAdaptor.getTiddlerComplete = function(context,userParams)
{
var t = context.adaptor.store.fetchTiddler(context.title);
if(t) {
t.fields['server.type'] = FileAdaptor.serverType;
t.fields['server.host'] = AdaptorBase.minHostName(context.host);
t.fields['server.page.revision'] = t.modified.convertToYYYYMMDDHHMM();
context.tiddler = t;
context.status = true;
} else { //# tiddler does not exist in document
context.status = false;
}
if(context.allowSynchronous) {
context.isSynchronous = true;
context.callback(context,userParams);
} else {
window.setTimeout(function() {context.callback(context,userParams);},10);
}
return true;
};
FileAdaptor.prototype.close = function()
{
this.store = null;
};
config.adaptors[FileAdaptor.serverType] = FileAdaptor;
config.defaultAdaptor = FileAdaptor.serverType;
//--
//-- HTTP request code
//--
function ajaxReq(args)
{
if (args.file || args.url.startsWith("file")) // LOCAL FILE
return localAjax(args);
return jQuery.ajax(args);
}
function localAjax(args)
{
var success=function(data)
{ args.success(data,"success",{ responseText:data }); }
var failure=function(who)
{ args.error({ message:who+": cannot read local file" },"error",0); }
if (args.file) try { // HTML5 FileReader (Chrome, FF20+, Safari, etc.)
var reader=new FileReader();
reader.onload=function(e) { success(e.target.result); }
reader.onerror=function(e) { failure("FileReader"); }
reader.readAsText(args.file);
return true;
} catch (ex) { ; }
try { // local file I/O (IE, FF with TiddlyFox, Chrome/Safari with TiddlySaver, etc.)
var data=loadFile(getLocalPath(args.url));
if (data) success(data);
else failure("loadFile");
return true;
} catch (ex) { ; }
return true;
}
function httpReq(type,url,callback,params,headers,data,contentType,username,password,allowCache)
{
var httpSuccess = function(xhr) {
try {
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
return (!xhr.status && location.protocol === "file:") ||
(xhr.status >= 200 && xhr.status < 300) ||
xhr.status === 304 || xhr.status === 1223;
} catch(e) {}
return false;
};
var options = {
type:type,
url:url,
processData:false,
data:data,
cache:!!allowCache,
beforeSend: function(xhr) {
var i;
for(i in headers)
xhr.setRequestHeader(i,headers[i]);
}
};
if(callback) {
options.complete = function(xhr,textStatus) {
if(httpSuccess(xhr))
callback(true,params,xhr.responseText,url,xhr);
else
callback(false,params,null,url,xhr);
};
}
if(contentType)
options.contentType = contentType;
if(username)
options.username = username;
if(password)
options.password = password;
try {
if(window.Components && window.netscape && window.netscape.security && document.location.protocol.indexOf("http") == -1)
window.netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (ex) {
}
return jQuery.ajax(options);
}
//--
//-- TiddlyWiki-specific utility functions
//--
// Returns TiddlyWiki version string
function formatVersion(v)
{
v = v || version;
return v.major + "." + v.minor + "." + v.revision +
(v.alpha ? " (alpha " + v.alpha + ")" : "") +
(v.beta ? " (beta " + v.beta + ")" : "");
}
function compareVersions(v1,v2)
{
var x1,x2,i,a = ["major","minor","revision"];
for(i = 0; i<a.length; i++) {
x1 = v1[a[i]] || 0;
x2 = v2[a[i]] || 0;
if(x1<x2)
return 1;
if(x1>x2)
return -1;
}
x1 = v1.beta || 9999;
x2 = v2.beta || 9999;
if(x1<x2)
return 1;
return x1 > x2 ? -1 : 0;
}
function merge(dst,src,preserveExisting)
{
var i;
for(i in src) {
if(!preserveExisting || dst[i] === undefined)
dst[i] = src[i];
}
return dst;
}
// Resolve the target object of an event
function resolveTarget(e)
{
var obj;
if(e.target)
obj = e.target;
else if(e.srcElement)
obj = e.srcElement;
if(obj.nodeType == 3) // defeat Safari bug
obj = obj.parentNode;
return obj;
}
// Returns a string containing the description of an exception, optionally prepended by a message
function exceptionText(e,message)
{
var s = e.description || e.toString();
return message ? "%0:\n%1".format([message,s]) : s;
}
// Displays an alert of an exception description with optional message
function showException(e,message)
{
alert(exceptionText(e,message));
}
function alertAndThrow(m)
{
alert(m);
throw(m);
}
function glyph(name)
{
var g = config.glyphs;
var b = g.currBrowser;
if(b == null) {
b = 0;
while(b < g.browsers.length-1 && !g.browsers[b]())
b++;
g.currBrowser = b;
}
if(!g.codes[name])
return "";
return g.codes[name][b];
}
function createTiddlyText(parent,text)
{
return parent.appendChild(document.createTextNode(text));
}
function createTiddlyCheckbox(parent,caption,checked,onChange)
{
var cb = document.createElement("input");
cb.setAttribute("type","checkbox");
cb.onclick = onChange;
parent.appendChild(cb);
cb.checked = checked;
cb.className = "chkOptionInput";
if(caption)
wikify(caption,parent);
return cb;
}
function createTiddlyElement(parent,element,id,className,text,attribs)
{
var n,e = document.createElement(element);
if(className != null)
e.className = className;
if(id != null)
e.setAttribute("id",id);
if(text != null)
e.appendChild(document.createTextNode(text));
if(attribs) {
for(n in attribs) {
e.setAttribute(n,attribs[n]);
}
}
if(parent != null)
parent.appendChild(e);
return e;
}
function createTiddlyButton(parent,text,tooltip,action,className,id,accessKey,attribs)
{
var i,btn = document.createElement("a");
btn.setAttribute("href","javascript:;");
if(action) {
btn.onclick = action;
}
if(tooltip)
btn.setAttribute("title",tooltip);
if(text)
btn.appendChild(document.createTextNode(text));
btn.className = className || "button";
if(id)
btn.id = id;
if(attribs) {
for(i in attribs) {
btn.setAttribute(i,attribs[i]);
}
}
if(parent)
parent.appendChild(btn);
if(accessKey)
btn.setAttribute("accessKey",accessKey);
return btn;
}
function createExternalLink(place,url,label)
{
var link = document.createElement("a");
link.className = "externalLink";
link.href = url;
var f = config.messages.externalLinkTooltip;
link.title = f ? f.format([url]) : url;
if(config.options.chkOpenInNewWindow)
link.target = "_blank";
place.appendChild(link);
if(label)
createTiddlyText(link, label);
return link;
}
function getTiddlyLinkInfo(title,currClasses)
{
var classes = currClasses ? currClasses.split(" ") : [];
classes.pushUnique("tiddlyLink");
var tiddler = store.fetchTiddler(title);
var subTitle;
if(tiddler) {
subTitle = tiddler.getSubtitle();
classes.pushUnique("tiddlyLinkExisting");
classes.remove("tiddlyLinkNonExisting");
classes.remove("shadow");
} else {
var f;
classes.remove("tiddlyLinkExisting");
classes.pushUnique("tiddlyLinkNonExisting");
if(store.isShadowTiddler(title)) {
f = config.messages.shadowedTiddlerToolTip;
classes.pushUnique("shadow");
} else {
f = config.messages.undefinedTiddlerToolTip;
classes.remove("shadow");
}
subTitle = f ? f.format([title]) : "";
}
if(typeof config.annotations[title]=="string")
subTitle = config.annotations[title];
return {classes: classes.join(" "),subTitle: subTitle};
}
// Event handler for clicking on a tiddly link
function onClickTiddlerLink(ev)
{
var e = ev || window.event;
var target = resolveTarget(e);
var link = target;
var title = null;
var fields = null;
var noToggle = null;
do {
title = link.getAttribute("tiddlyLink");
fields = link.getAttribute("tiddlyFields");
noToggle = link.getAttribute("noToggle");
link = link.parentNode;
} while(title == null && link != null);
if(!store.isShadowTiddler(title)) {
var f = fields ? fields.decodeHashMap() : {};
fields = String.encodeHashMap(merge(f,config.defaultCustomFields,true));
}
if(title) {
var toggling = e.metaKey || e.ctrlKey;
if(config.options.chkToggleLinks)
toggling = !toggling;
if(noToggle)
toggling = false;
if(store.getTiddler(title))
fields = null;
story.displayTiddler(target,title,null,true,null,fields,toggling);
}
clearMessage();
return false;
}
function createTiddlyLink(place,title,includeText,className,isStatic,linkedFromTiddler,noToggle)
{
var title = jQuery.trim(title);
var text = includeText ? title : null;
var i = getTiddlyLinkInfo(title,className);
var btn = isStatic ? createExternalLink(place,store.getTiddlerText("SiteUrl",null) + "#" + title) : createTiddlyButton(place,text,i.subTitle,onClickTiddlerLink,i.classes);
if(isStatic)
btn.className += ' ' + className;
btn.setAttribute("refresh","link");
btn.setAttribute("tiddlyLink",title);
if(noToggle)
btn.setAttribute("noToggle","true");
if(linkedFromTiddler) {
var fields = linkedFromTiddler.getInheritedFields();
if(fields)
btn.setAttribute("tiddlyFields",fields);
}
return btn;
}
function refreshTiddlyLink(e,title)
{
var i = getTiddlyLinkInfo(title,e.className);
e.className = i.classes;
e.title = i.subTitle;
}
function createTiddlyDropDown(place,onchange,options,defaultValue)
{
var sel = createTiddlyElement(place,"select");
sel.onchange = onchange;
var t;
for(t=0; t<options.length; t++) {
var e = createTiddlyElement(sel,"option",null,null,options[t].caption);
e.value = options[t].name;
if(options[t].name == defaultValue)
e.selected = true;
}
return sel;
}
//--
//-- TiddlyWiki-specific popup utility functions
//--
// Event handler for 'open all' on a tiddler popup
function onClickTagOpenAll(ev)
{
var tiddlers = store.getTaggedTiddlers(this.getAttribute("tag"));
var sortby = this.getAttribute("sortby");
if(sortby&&sortby.length) {
store.sortTiddlers(tiddlers,sortby);
}
story.displayTiddlers(this,tiddlers);
return false;
}
// Event handler for clicking on a tiddler tag
function onClickTag(ev)
{
var e = ev || window.event;
var popup = Popup.create(this);
jQuery(popup).addClass("taggedTiddlerList");
var tag = this.getAttribute("tag");
var title = this.getAttribute("tiddler");
if(popup && tag) {
var tagged = tag.indexOf("[")==-1 ? store.getTaggedTiddlers(tag) : store.filterTiddlers(tag);
var sortby = this.getAttribute("sortby");
if(sortby&&sortby.length) {
store.sortTiddlers(tagged,sortby);
}
var titles = [];
var r;
for(r=0;r<tagged.length;r++) {
if(tagged[r].title != title)
titles.push(tagged[r].title);
}
var lingo = config.views.wikified.tag;
if(titles.length > 0) {
var openAll = createTiddlyButton(createTiddlyElement(popup,"li"),lingo.openAllText.format([tag]),lingo.openAllTooltip,onClickTagOpenAll);
openAll.setAttribute("tag",tag);
openAll.setAttribute("sortby",sortby);
createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div");
for(r=0; r<titles.length; r++) {
createTiddlyLink(createTiddlyElement(popup,"li"),titles[r],true);
}
} else {
createTiddlyElement(popup,"li",null,"disabled",lingo.popupNone.format([tag]));
}
createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div");
var h = createTiddlyLink(createTiddlyElement(popup,"li"),tag,false);
createTiddlyText(h,lingo.openTag.format([tag]));
}
Popup.show();
e.cancelBubble = true;
if(e.stopPropagation) e.stopPropagation();
return false;
}
// Create a button for a tag with a popup listing all the tiddlers that it tags
function createTagButton(place,tag,excludeTiddler,title,tooltip)
{
var btn = createTiddlyButton(place,title||tag,(tooltip||config.views.wikified.tag.tooltip).format([tag]),onClickTag);
btn.setAttribute("tag",tag);
if(excludeTiddler)
btn.setAttribute("tiddler",excludeTiddler);
return btn;
}
function onClickTiddlyPopup(ev)
{
var e = ev || window.event;
var tiddler = this.tiddler;
if(tiddler.text) {
var popup = Popup.create(this,"div","popupTiddler");
wikify(tiddler.text,popup,null,tiddler);
Popup.show();
}
if(e) e.cancelBubble = true;
if(e && e.stopPropagation) e.stopPropagation();
return false;
}
function createTiddlyPopup(place,caption,tooltip,tiddler)
{
if(tiddler.text) {
createTiddlyLink(place,caption,true);
var btn = createTiddlyButton(place,glyph("downArrow"),tooltip,onClickTiddlyPopup,"tiddlerPopupButton");
btn.tiddler = tiddler;
} else {
createTiddlyText(place,caption);
}
}
function onClickError(ev)
{
var e = ev || window.event;
var popup = Popup.create(this);
var lines = this.getAttribute("errorText").split("\n");
var t;
for(t=0; t<lines.length; t++)
createTiddlyElement(popup,"li",null,null,lines[t]);
Popup.show();
e.cancelBubble = true;
if(e.stopPropagation) e.stopPropagation();
return false;
}
function createTiddlyError(place,title,text)
{
var btn = createTiddlyButton(place,title,null,onClickError,"errorButton");
if(text) btn.setAttribute("errorText",text);
}
//-
//- Animation engine
//-
function Animator()
{
this.running = 0; // Incremented at start of each animation, decremented afterwards. If zero, the interval timer is disabled
this.timerID = 0; // ID of the timer used for animating
this.animations = []; // List of animations in progress
return this;
}
// Start animation engine
Animator.prototype.startAnimating = function() //# Variable number of arguments
{
var t;
for(t=0; t<arguments.length; t++)
this.animations.push(arguments[t]);
if(this.running == 0) {
var me = this;
this.timerID = window.setInterval(function() {me.doAnimate(me);},10);
}
this.running += arguments.length;
};
// Perform an animation engine tick, calling each of the known animation modules
Animator.prototype.doAnimate = function(me)
{
var a = 0;
while(a < me.animations.length) {
var animation = me.animations[a];
if(animation.tick()) {
a++;
} else {
me.animations.splice(a,1);
if(--me.running == 0)
window.clearInterval(me.timerID);
}
}
};
Animator.slowInSlowOut = function(progress)
{
return(1-((Math.cos(progress * Math.PI)+1)/2));
};
//--
//-- Morpher animation
//--
// Animate a set of properties of an element
function Morpher(element,duration,properties,callback)
{
this.element = element;
this.duration = duration;
this.properties = properties;
this.startTime = new Date();
this.endTime = Number(this.startTime) + duration;
this.callback = callback;
this.tick();
return this;
}
Morpher.prototype.assignStyle = function(element,style,value)
{
switch(style) {
case "-tw-vertScroll":
window.scrollTo(findScrollX(),value);
break;
case "-tw-horizScroll":
window.scrollTo(value,findScrollY());
break;
default:
element.style[style] = value;
break;
}
};
Morpher.prototype.stop = function()
{
var t;
for(t=0; t<this.properties.length; t++) {
var p = this.properties[t];
if(p.atEnd !== undefined) {
this.assignStyle(this.element,p.style,p.atEnd);
}
}
if(this.callback)
this.callback(this.element,this.properties);
};
Morpher.prototype.tick = function()
{
var currTime = Number(new Date());
var t,progress = Animator.slowInSlowOut(Math.min(1,(currTime-this.startTime)/this.duration));
for(t=0; t<this.properties.length; t++) {
var p = this.properties[t];
if(p.start !== undefined && p.end !== undefined) {
var template = p.template || "%0";
switch(p.format) {
case undefined:
case "style":
var v = p.start + (p.end-p.start) * progress;
this.assignStyle(this.element,p.style,template.format([v]));
break;
case "color":
break;
}
}
}
if(currTime >= this.endTime) {
this.stop();
return false;
}
return true;
};
//--
//-- Zoomer animation
//--
function Zoomer(text,startElement,targetElement,unused)
{
var e = createTiddlyElement(document.body,"div",null,"zoomer");
createTiddlyElement(e,"div",null,null,text);
var winWidth = findWindowWidth();
var winHeight = findWindowHeight();
var p = [
{style: 'left', start: findPosX(startElement), end: findPosX(targetElement), template: '%0px'},
{style: 'top', start: findPosY(startElement), end: findPosY(targetElement), template: '%0px'},
{style: 'width', start: Math.min(startElement.scrollWidth,winWidth), end: Math.min(targetElement.scrollWidth,winWidth), template: '%0px', atEnd: 'auto'},
{style: 'height', start: Math.min(startElement.scrollHeight,winHeight), end: Math.min(targetElement.scrollHeight,winHeight), template: '%0px', atEnd: 'auto'},
{style: 'fontSize', start: 8, end: 24, template: '%0pt'}
];
var c = function(element,properties) {jQuery(element).remove();};
return new Morpher(e,config.animDuration,p,c);
}
//--
//-- Scroller animation
//--
function Scroller(targetElement)
{
var p = [{style: '-tw-vertScroll', start: findScrollY(), end: ensureVisible(targetElement)}];
return new Morpher(targetElement,config.animDuration,p);
}
//--
//-- Slider animation
//--
// deleteMode - "none", "all" [delete target element and it's children], [only] "children" [but not the target element]
function Slider(element,opening,unused,deleteMode)
{
element.style.overflow = 'hidden';
if(opening)
element.style.height = '0px'; // Resolves a Firefox flashing bug
element.style.display = 'block';
var height = element.scrollHeight;
var p = [];
var c = null;
if(opening) {
p.push({style: 'height', start: 0, end: height, template: '%0px', atEnd: 'auto'});
p.push({style: 'opacity', start: 0, end: 1, template: '%0'});
p.push({style: 'filter', start: 0, end: 100, template: 'alpha(opacity:%0)'});
} else {
p.push({style: 'height', start: height, end: 0, template: '%0px'});
p.push({style: 'display', atEnd: 'none'});
p.push({style: 'opacity', start: 1, end: 0, template: '%0'});
p.push({style: 'filter', start: 100, end: 0, template: 'alpha(opacity:%0)'});
switch(deleteMode) {
case "all":
c = function(element,properties) {jQuery(element).remove();};
break;
case "children":
c = function(element,properties) {jQuery(element).empty();};
break;
}
}
return new Morpher(element,config.animDuration,p,c);
}
//--
//-- Popup menu
//--
var Popup = {
stack: [] // Array of objects with members root: and popup:
};
Popup.create = function(root,elem,className)
{
var stackPosition = this.find(root,"popup");
Popup.remove(stackPosition+1);
var popup = createTiddlyElement(document.body,elem || "ol","popup",className || "popup");
popup.stackPosition = stackPosition;
Popup.stack.push({root: root, popup: popup});
return popup;
};
Popup.onDocumentClick = function(ev)
{
var e = ev || window.event;
if(e.eventPhase == undefined)
Popup.remove();
else if(e.eventPhase == Event.BUBBLING_PHASE || e.eventPhase == Event.AT_TARGET)
Popup.remove();
return true;
};
Popup.show = function(valign,halign,offset)
{
var curr = Popup.stack[Popup.stack.length-1];
this.place(curr.root,curr.popup,valign,halign,offset);
jQuery(curr.root).addClass("highlight");
if(config.options.chkAnimate && anim && typeof Scroller == "function")
anim.startAnimating(new Scroller(curr.popup));
else
window.scrollTo(0,ensureVisible(curr.popup));
};
Popup.place = function(root,popup,valign,halign,offset)
{
if(!offset)
offset = {x:0,y:0};
if(popup.stackPosition >= 0 && !valign && !halign) {
offset.x = offset.x + root.offsetWidth;
} else {
offset.x = (halign == "right") ? offset.x + root.offsetWidth : offset.x;
offset.y = (valign == "top") ? offset.y : offset.y + root.offsetHeight;
}
var rootLeft = findPosX(root);
var rootTop = findPosY(root);
var popupLeft = rootLeft + offset.x;
var popupTop = rootTop + offset.y;
var winWidth = findWindowWidth();
if(popup.offsetWidth > winWidth*0.75)
popup.style.width = winWidth*0.75 + "px";
var popupWidth = popup.offsetWidth;
var scrollWidth = winWidth - document.body.offsetWidth;
if(popupLeft + popupWidth > winWidth - scrollWidth - 1) {
if(halign == "right")
popupLeft = popupLeft - root.offsetWidth - popupWidth;
else
popupLeft = winWidth - popupWidth - scrollWidth - 1;
}
popup.style.left = popupLeft + "px";
popup.style.top = popupTop + "px";
popup.style.display = "block";
};
Popup.find = function(e)
{
var t,pos = -1;
for(t=this.stack.length-1; t>=0; t--) {
if(isDescendant(e,this.stack[t].popup))
pos = t;
}
return pos;
};
Popup.remove = function(pos)
{
if(!pos) pos = 0;
if(Popup.stack.length > pos) {
Popup.removeFrom(pos);
}
};
Popup.removeFrom = function(from)
{
var t;
for(t=Popup.stack.length-1; t>=from; t--) {
var p = Popup.stack[t];
jQuery(p.root).removeClass("highlight");
jQuery(p.popup).remove();
}
Popup.stack = Popup.stack.slice(0,from);
};
//--
//-- Wizard support
//--
function Wizard(elem)
{
if(elem) {
this.formElem = findRelated(elem,"wizard","className");
this.bodyElem = findRelated(this.formElem.firstChild,"wizardBody","className","nextSibling");
this.footElem = findRelated(this.formElem.firstChild,"wizardFooter","className","nextSibling");
} else {
this.formElem = null;
this.bodyElem = null;
this.footElem = null;
}
}
Wizard.prototype.setValue = function(name,value)
{
jQuery(this.formElem).data(name, value);
};
Wizard.prototype.getValue = function(name)
{
return this.formElem ? jQuery(this.formElem).data(name) : null;
};
Wizard.prototype.createWizard = function(place,title)
{
this.formElem = createTiddlyElement(place,"form",null,"wizard");
createTiddlyElement(this.formElem,"h1",null,null,title);
this.bodyElem = createTiddlyElement(this.formElem,"div",null,"wizardBody");
this.footElem = createTiddlyElement(this.formElem,"div",null,"wizardFooter");
return this.formElem;
};
Wizard.prototype.clear = function()
{
jQuery(this.bodyElem).empty();
};
Wizard.prototype.setButtons = function(buttonInfo,status)
{
jQuery(this.footElem).empty();
var t;
for(t=0; t<buttonInfo.length; t++) {
createTiddlyButton(this.footElem,buttonInfo[t].caption,buttonInfo[t].tooltip,buttonInfo[t].onClick);
insertSpacer(this.footElem);
}
if(typeof status == "string") {
createTiddlyElement(this.footElem,"span",null,"status",status);
}
};
Wizard.prototype.addStep = function(stepTitle,html)
{
jQuery(this.bodyElem).empty();
var w = createTiddlyElement(this.bodyElem,"div");
createTiddlyElement(w,"h2",null,null,stepTitle);
var step = createTiddlyElement(w,"div",null,"wizardStep");
step.innerHTML = html;
applyHtmlMacros(step,tiddler);
};
Wizard.prototype.getElement = function(name)
{
return this.formElem.elements[name];
};
//--
//-- ListView gadget
//--
var ListView = {};
// Create a listview
ListView.create = function(place,listObject,listTemplate,callback,className)
{
var table = createTiddlyElement(place,"table",null,className || "listView twtable");
var thead = createTiddlyElement(table,"thead");
var t,r = createTiddlyElement(thead,"tr");
for(t=0; t<listTemplate.columns.length; t++) {
var columnTemplate = listTemplate.columns[t];
var c = createTiddlyElement(r,"th");
var colType = ListView.columnTypes[columnTemplate.type];
if(colType && colType.createHeader) {
colType.createHeader(c,columnTemplate,t);
if(columnTemplate.className)
jQuery(c).addClass(columnTemplate.className);
}
}
var rc,tbody = createTiddlyElement(table,"tbody");
for(rc=0; rc<listObject.length; rc++) {
var rowObject = listObject[rc];
r = createTiddlyElement(tbody,"tr");
for(c=0; c<listTemplate.rowClasses.length; c++) {
if(rowObject[listTemplate.rowClasses[c].field])
jQuery(r).addClass(listTemplate.rowClasses[c].className);
}
rowObject.rowElement = r;
rowObject.colElements = {};
var cc;
for(cc=0; cc<listTemplate.columns.length; cc++) {
c = createTiddlyElement(r,"td");
columnTemplate = listTemplate.columns[cc];
var field = columnTemplate.field;
colType = ListView.columnTypes[columnTemplate.type];
if(colType && colType.createItem) {
colType.createItem(c,rowObject,field,columnTemplate,cc,rc);
if(columnTemplate.className)
jQuery(c).addClass(columnTemplate.className);
}
rowObject.colElements[field] = c;
}
}
if(callback && listTemplate.actions)
createTiddlyDropDown(place,ListView.getCommandHandler(callback),listTemplate.actions);
if(callback && listTemplate.buttons) {
for(t=0; t<listTemplate.buttons.length; t++) {
var a = listTemplate.buttons[t];
if(a && a.name != "")
createTiddlyButton(place,a.caption,null,ListView.getCommandHandler(callback,a.name,a.allowEmptySelection));
}
}
return table;
};
ListView.getCommandHandler = function(callback,name,allowEmptySelection)
{
return function(e) {
var view = findRelated(this,"TABLE",null,"previousSibling");
var tiddlers = [];
ListView.forEachSelector(view,function(e,rowName) {
if(e.checked)
tiddlers.push(rowName);
});
if(tiddlers.length == 0 && !allowEmptySelection) {
alert(config.messages.nothingSelected);
} else {
if(this.nodeName.toLowerCase() == "select") {
callback(view,this.value,tiddlers);
this.selectedIndex = 0;
} else {
callback(view,name,tiddlers);
}
}
};
};
// Invoke a callback for each selector checkbox in the listview
ListView.forEachSelector = function(view,callback)
{
var checkboxes = view.getElementsByTagName("input");
var t,hadOne = false;
for(t=0; t<checkboxes.length; t++) {
var cb = checkboxes[t];
if(cb.getAttribute("type") == "checkbox") {
var rn = cb.getAttribute("rowName");
if(rn) {
callback(cb,rn);
hadOne = true;
}
}
}
return hadOne;
};
ListView.getSelectedRows = function(view)
{
var rowNames = [];
ListView.forEachSelector(view,function(e,rowName) {
if(e.checked)
rowNames.push(rowName);
});
return rowNames;
};
ListView.columnTypes = {};
ListView.columnTypes.String = {
createHeader: function(place,columnTemplate,col)
{
createTiddlyText(place,columnTemplate.title);
},
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var v = listObject[field];
if(v != undefined)
createTiddlyText(place,v);
}
};
ListView.columnTypes.WikiText = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var v = listObject[field];
if(v != undefined)
wikify(v,place,null,null);
}
};
ListView.columnTypes.Tiddler = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var v = listObject[field];
if(v != undefined && v.title)
createTiddlyPopup(place,v.title,config.messages.listView.tiddlerTooltip,v);
}
};
ListView.columnTypes.Size = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var msg = config.messages.sizeTemplates;
var v = listObject[field];
if(v != undefined) {
var t = 0;
while(t<msg.length-1 && v<msg[t].unit)
t++;
createTiddlyText(place,msg[t].template.format([Math.round(v/msg[t].unit)]));
}
}
};
ListView.columnTypes.Link = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var v = listObject[field];
var c = columnTemplate.text;
if(v != undefined)
createExternalLink(place,v,c || v);
}
};
ListView.columnTypes.Date = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var v = listObject[field];
if(v != undefined)
createTiddlyText(place,v.formatString(columnTemplate.dateFormat));
}
};
ListView.columnTypes.StringList = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var v = listObject[field];
if(v != undefined) {
var t;
for(t=0; t<v.length; t++) {
createTiddlyText(place,v[t]);
createTiddlyElement(place,"br");
}
}
}
};
ListView.columnTypes.Selector = {
createHeader: function(place,columnTemplate,col)
{
createTiddlyCheckbox(place,null,false,this.onHeaderChange);
},
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var e = createTiddlyCheckbox(place,null,listObject[field],null);
e.setAttribute("rowName",listObject[columnTemplate.rowName]);
},
onHeaderChange: function(e)
{
var state = this.checked;
var view = findRelated(this,"TABLE");
if(!view)
return;
ListView.forEachSelector(view,function(e,rowName) {
e.checked = state;
});
}
};
ListView.columnTypes.Tags = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var tags = listObject[field];
createTiddlyText(place,String.encodeTiddlyLinkList(tags));
}
};
ListView.columnTypes.Boolean = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
if(listObject[field] == true)
createTiddlyText(place,columnTemplate.trueText);
if(listObject[field] == false)
createTiddlyText(place,columnTemplate.falseText);
}
};
ListView.columnTypes.TagCheckbox = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var e = createTiddlyCheckbox(place,null,listObject[field],this.onChange);
e.setAttribute("tiddler",listObject.title);
e.setAttribute("tag",columnTemplate.tag);
},
onChange : function(e)
{
var tag = this.getAttribute("tag");
var tiddler = this.getAttribute("tiddler");
store.setTiddlerTag(tiddler,this.checked,tag);
}
};
ListView.columnTypes.TiddlerLink = {
createHeader: ListView.columnTypes.String.createHeader,
createItem: function(place,listObject,field,columnTemplate,col,row)
{
var v = listObject[field];
if(v != undefined) {
var link = createTiddlyLink(place,listObject[columnTemplate.tiddlerLink],false,null);
createTiddlyText(link,listObject[field]);
}
}
};
//--
//-- Augmented methods for the JavaScript Array() object
//--
// Add indexOf function if browser does not support it
if(!Array.indexOf) {
Array.prototype.indexOf = function(item,from)
{
if(!from)
from = 0;
var i;
for(i=from; i<this.length; i++) {
if(this[i] === item)
return i;
}
return -1;
};}
// Find an entry in a given field of the members of an array
Array.prototype.findByField = function(field,value)
{
var t;
for(t=0; t<this.length; t++) {
if(this[t][field] === value)
return t;
}
return null;
};
// Return whether an entry exists in an array
Array.prototype.contains = function(item)
{
return this.indexOf(item) != -1;
};
// Adds, removes or toggles a particular value within an array
// value - value to add
// mode - +1 to add value, -1 to remove value, 0 to toggle it
Array.prototype.setItem = function(value,mode)
{
var p = this.indexOf(value);
if(mode == 0)
mode = (p == -1) ? +1 : -1;
if(mode == +1) {
if(p == -1)
this.push(value);
} else if(mode == -1) {
if(p != -1)
this.splice(p,1);
}
};
// Return whether one of a list of values exists in an array
Array.prototype.containsAny = function(items)
{
var i;
for(i=0; i<items.length; i++) {
if(this.indexOf(items[i]) != -1)
return true;
}
return false;
};
// Return whether all of a list of values exists in an array
Array.prototype.containsAll = function(items)
{
var i;
for(i = 0; i<items.length; i++) {
if(this.indexOf(items[i]) == -1)
return false;
}
return true;
};
// Push a new value into an array only if it is not already present in the array. If the optional unique parameter is false, it reverts to a normal push
Array.prototype.pushUnique = function(item,unique)
{
if(unique === false) {
this.push(item);
} else {
if(this.indexOf(item) == -1)
this.push(item);
}
};
Array.prototype.remove = function(item)
{
var p = this.indexOf(item);
if(p != -1)
this.splice(p,1);
};
if(!Array.prototype.map) {
Array.prototype.map = function(fn,thisObj)
{
var scope = thisObj || window;
var i,j,a = [];
for(i=0, j=this.length; i < j; ++i) {
a.push(fn.call(scope,this[i],i,this));
}
return a;
};}
//--
//-- Augmented methods for the JavaScript String() object
//--
// Get characters from the right end of a string
String.prototype.right = function(n)
{
return n < this.length ? this.slice(this.length-n) : this;
};
// Trim whitespace from both ends of a string
String.prototype.trim = function()
{
return this.replace(/^\s*|\s*$/g,"");
};
// Convert a string from a CSS style property name to a JavaScript style name ("background-color" -> "backgroundColor")
String.prototype.unDash = function()
{
var t,s = this.split("-");
if(s.length > 1) {
for(t=1; t<s.length; t++)
s[t] = s[t].substr(0,1).toUpperCase() + s[t].substr(1);
}
return s.join("");
};
// Substitute substrings from an array into a format string that includes '%1'-type specifiers
String.prototype.format = function(s)
{
var substrings = s && s.constructor == Array ? s : arguments;
var subRegExp = /(?:%(\d+))/mg;
var currPos = 0;
var match,r = [];
do {
match = subRegExp.exec(this);
if(match && match[1]) {
if(match.index > currPos)
r.push(this.substring(currPos,match.index));
r.push(substrings[parseInt(match[1],10)]);
currPos = subRegExp.lastIndex;
}
} while(match);
if(currPos < this.length)
r.push(this.substring(currPos,this.length));
return r.join("");
};
// Escape any special RegExp characters with that character preceded by a backslash
String.prototype.escapeRegExp = function()
{
var s = "\\^$*+?()=!|,{}[].";
var t,c = this;
for(t=0; t<s.length; t++)
c = c.replace(new RegExp("\\" + s.substr(t,1),"g"),"\\" + s.substr(t,1));
return c;
};
// Convert "\" to "\s", newlines to "\n" (and remove carriage returns)
String.prototype.escapeLineBreaks = function()
{
return this.replace(/\\/mg,"\\s").replace(/\n/mg,"\\n").replace(/\r/mg,"");
};
// Convert "\n" to newlines, "\b" to " ", "\s" to "\" (and remove carriage returns)
String.prototype.unescapeLineBreaks = function()
{
return this.replace(/\\n/mg,"\n").replace(/\\b/mg," ").replace(/\\s/mg,"\\").replace(/\r/mg,"");
};
// Convert & to "&", < to "<", > to ">" and " to """
String.prototype.htmlEncode = function()
{
return this.replace(/&/mg,"&").replace(/</mg,"<").replace(/>/mg,">").replace(/\"/mg,""");
};
// Convert "&" to &, "<" to <, ">" to > and """ to "
String.prototype.htmlDecode = function()
{
return this.replace(/</mg,"<").replace(/>/mg,">").replace(/"/mg,"\"").replace(/&/mg,"&");
};
// Parse a space-separated string of name:value parameters
// The result is an array of objects:
// result[0] = object with a member for each parameter name, value of that member being an array of values
// result[1..n] = one object for each parameter, with 'name' and 'value' members
String.prototype.parseParams = function(defaultName,defaultValue,allowEval,noNames,cascadeDefaults)
{
var parseToken = function(match,p) {
var n;
if(match[p]) // Double quoted
n = match[p];
else if(match[p+1]) // Single quoted
n = match[p+1];
else if(match[p+2]) // Double-square-bracket quoted
n = match[p+2];
else if(match[p+3]) // Double-brace quoted
try {
n = match[p+3];
if(allowEval && config.evaluateMacroParameters != "none") {
if(config.evaluateMacroParameters == "restricted") {
if(window.restrictedEval) {
n = window.restrictedEval(n);
}
} else {
n = window.eval(n);
}
}
} catch(ex) {
throw "Unable to evaluate {{" + match[p+3] + "}}: " + exceptionText(ex);
}
else if(match[p+4]) // Unquoted
n = match[p+4];
else if(match[p+5]) // empty quote
n = "";
return n;
};
var r = [{}];
var dblQuote = "(?:\"((?:(?:\\\\\")|[^\"])+)\")";
var sngQuote = "(?:'((?:(?:\\\\\')|[^'])+)')";
var dblSquare = "(?:\\[\\[((?:\\s|\\S)*?)\\]\\])";
var dblBrace = "(?:\\{\\{((?:\\s|\\S)*?)\\}\\})";
var unQuoted = noNames ? "([^\"'\\s]\\S*)" : "([^\"':\\s][^\\s:]*)";
var emptyQuote = "((?:\"\")|(?:''))";
var skipSpace = "(?:\\s*)";
var token = "(?:" + dblQuote + "|" + sngQuote + "|" + dblSquare + "|" + dblBrace + "|" + unQuoted + "|" + emptyQuote + ")";
var re = noNames ? new RegExp(token,"mg") : new RegExp(skipSpace + token + skipSpace + "(?:(\\:)" + skipSpace + token + ")?","mg");
var match;
do {
match = re.exec(this);
if(match) {
var n = parseToken(match,1);
if(noNames) {
r.push({name:"",value:n});
} else {
var v = parseToken(match,8);
if(v == null && defaultName) {
v = n;
n = defaultName;
} else if(v == null && defaultValue) {
v = defaultValue;
}
r.push({name:n,value:v});
if(cascadeDefaults) {
defaultName = n;
defaultValue = v;
}
}
}
} while(match);
// Summarise parameters into first element
var t;
for(t=1; t<r.length; t++) {
if(r[0][r[t].name])
r[0][r[t].name].push(r[t].value);
else
r[0][r[t].name] = [r[t].value];
}
return r;
};
// Process a string list of macro parameters into an array. Parameters can be quoted with "", '',
// [[]], {{ }} or left unquoted (and therefore space-separated). Double-braces {{}} results in
// an *evaluated* parameter: e.g. {{config.options.txtUserName}} results in the current user's name.
String.prototype.readMacroParams = function(notAllowEval)
{
var p = this.parseParams("list",null,!notAllowEval,true);
var t,n = [];
for(t=1; t<p.length; t++)
n.push(p[t].value);
return n;
};
// Process a string list of unique tiddler names into an array. Tiddler names that have spaces in them must be [[bracketed]]
String.prototype.readBracketedList = function(unique)
{
var p = this.parseParams("list",null,false,true);
var t,n = [];
for(t=1; t<p.length; t++) {
if(p[t].value)
n.pushUnique(p[t].value,unique);
}
return n;
};
// Returns array with start and end index of chunk between given start and end marker, or undefined.
String.prototype.getChunkRange = function(start,end)
{
var s = this.indexOf(start);
if(s != -1) {
s += start.length;
var e = this.indexOf(end,s);
if(e != -1)
return [s,e];
}
};
// Replace a chunk of a string given start and end markers
String.prototype.replaceChunk = function(start,end,sub)
{
var r = this.getChunkRange(start,end);
return r ? this.substring(0,r[0]) + sub + this.substring(r[1]) : this;
};
// Returns a chunk of a string between start and end markers, or undefined
String.prototype.getChunk = function(start,end)
{
var r = this.getChunkRange(start,end);
if(r)
return this.substring(r[0],r[1]);
};
// Static method to bracket a string with double square brackets if it contains a space
String.encodeTiddlyLink = function(title)
{
return title.indexOf(" ") == -1 ? title : "[[" + title + "]]";
};
// Static method to encodeTiddlyLink for every item in an array and join them with spaces
String.encodeTiddlyLinkList = function(list)
{
if(list) {
var t,results = [];
for(t=0; t<list.length; t++)
results.push(String.encodeTiddlyLink(list[t]));
return results.join(" ");
} else {
return "";
}
};
// Convert a string as a sequence of name:"value" pairs into a hashmap
String.prototype.decodeHashMap = function()
{
var fields = this.parseParams("anon","",false);
var t,r = {};
for(t=1; t<fields.length; t++)
r[fields[t].name] = fields[t].value;
return r;
};
// Static method to encode a hashmap into a name:"value"... string
String.encodeHashMap = function(hashmap)
{
var t,r = [];
for(t in hashmap)
r.push(t + ':"' + hashmap[t] + '"');
return r.join(" ");
};
// Static method to left-pad a string with 0s to a certain width
String.zeroPad = function(n,d)
{
var s = n.toString();
if(s.length < d)
s = "000000000000000000000000000".substr(0,d-s.length) + s;
return s;
};
String.prototype.startsWith = function(prefix)
{
return !prefix || this.substring(0,prefix.length) == prefix;
};
// Returns the first value of the given named parameter.
function getParam(params,name,defaultValue)
{
if(!params)
return defaultValue;
var p = params[0][name];
return p ? p[0] : defaultValue;
}
// Returns the first value of the given boolean named parameter.
function getFlag(params,name,defaultValue)
{
return !!getParam(params,name,defaultValue);
}
//--
//-- Augmented methods for the JavaScript Date() object
//--
// Substitute date components into a string
Date.prototype.formatString = function(template)
{
var t = template.replace(/0hh12/g,String.zeroPad(this.getHours12(),2));
t = t.replace(/hh12/g,this.getHours12());
t = t.replace(/0hh/g,String.zeroPad(this.getHours(),2));
t = t.replace(/hh/g,this.getHours());
t = t.replace(/mmm/g,config.messages.dates.shortMonths[this.getMonth()]);
t = t.replace(/0mm/g,String.zeroPad(this.getMinutes(),2));
t = t.replace(/mm/g,this.getMinutes());
t = t.replace(/0ss/g,String.zeroPad(this.getSeconds(),2));
t = t.replace(/ss/g,this.getSeconds());
t = t.replace(/[ap]m/g,this.getAmPm().toLowerCase());
t = t.replace(/[AP]M/g,this.getAmPm().toUpperCase());
t = t.replace(/wYYYY/g,this.getYearForWeekNo());
t = t.replace(/wYY/g,String.zeroPad(this.getYearForWeekNo()-2000,2));
t = t.replace(/YYYY/g,this.getFullYear());
t = t.replace(/YY/g,String.zeroPad(this.getFullYear()-2000,2));
t = t.replace(/MMM/g,config.messages.dates.months[this.getMonth()]);
t = t.replace(/0MM/g,String.zeroPad(this.getMonth()+1,2));
t = t.replace(/MM/g,this.getMonth()+1);
t = t.replace(/0WW/g,String.zeroPad(this.getWeek(),2));
t = t.replace(/WW/g,this.getWeek());
t = t.replace(/DDD/g,config.messages.dates.days[this.getDay()]);
t = t.replace(/ddd/g,config.messages.dates.shortDays[this.getDay()]);
t = t.replace(/0DD/g,String.zeroPad(this.getDate(),2));
t = t.replace(/DDth/g,this.getDate()+this.daySuffix());
t = t.replace(/DD/g,this.getDate());
var tz = this.getTimezoneOffset();
var atz = Math.abs(tz);
t = t.replace(/TZD/g,(tz < 0 ? '+' : '-') + String.zeroPad(Math.floor(atz / 60),2) + ':' + String.zeroPad(atz % 60,2));
t = t.replace(/\\/g,"");
return t;
};
Date.prototype.getWeek = function()
{
var dt = new Date(this.getTime());
var d = dt.getDay();
if(d==0) d=7;// JavaScript Sun=0, ISO Sun=7
dt.setTime(dt.getTime()+(4-d)*86400000);// shift day to Thurs of same week to calculate weekNo
var n = Math.floor((dt.getTime()-new Date(dt.getFullYear(),0,1)+3600000)/86400000);
return Math.floor(n/7)+1;
};
Date.prototype.getYearForWeekNo = function()
{
var dt = new Date(this.getTime());
var d = dt.getDay();
if(d==0) d=7;// JavaScript Sun=0, ISO Sun=7
dt.setTime(dt.getTime()+(4-d)*86400000);// shift day to Thurs of same week
return dt.getFullYear();
};
Date.prototype.getHours12 = function()
{
var h = this.getHours();
return h > 12 ? h-12 : ( h > 0 ? h : 12 );
};
Date.prototype.getAmPm = function()
{
return this.getHours() >= 12 ? config.messages.dates.pm : config.messages.dates.am;
};
Date.prototype.daySuffix = function()
{
return config.messages.dates.daySuffixes[this.getDate()-1];
};
// Convert a date to local YYYYMMDDHHMM string format
Date.prototype.convertToLocalYYYYMMDDHHMM = function()
{
return this.getFullYear() + String.zeroPad(this.getMonth()+1,2) + String.zeroPad(this.getDate(),2) + String.zeroPad(this.getHours(),2) + String.zeroPad(this.getMinutes(),2);
};
// Convert a date to UTC YYYYMMDDHHMM string format
Date.prototype.convertToYYYYMMDDHHMM = function()
{
return this.getUTCFullYear() + String.zeroPad(this.getUTCMonth()+1,2) + String.zeroPad(this.getUTCDate(),2) + String.zeroPad(this.getUTCHours(),2) + String.zeroPad(this.getUTCMinutes(),2);
};
// Convert a date to UTC YYYYMMDD.HHMMSSMMM string format
Date.prototype.convertToYYYYMMDDHHMMSSMMM = function()
{
return this.getUTCFullYear() + String.zeroPad(this.getUTCMonth()+1,2) + String.zeroPad(this.getUTCDate(),2) + "." + String.zeroPad(this.getUTCHours(),2) + String.zeroPad(this.getUTCMinutes(),2) + String.zeroPad(this.getUTCSeconds(),2) + String.zeroPad(this.getUTCMilliseconds(),3) +"0";
};
// Static method to create a date from a UTC YYYYMMDDHHMM format string
Date.convertFromYYYYMMDDHHMM = function(d)
{
d = d?d.replace(/[^0-9]/g, ""):"";
return Date.convertFromYYYYMMDDHHMMSSMMM(d.substr(0,12));
};
// Static method to create a date from a UTC YYYYMMDDHHMMSS format string
Date.convertFromYYYYMMDDHHMMSS = function(d)
{
d = d?d.replace(/[^0-9]/g, ""):"";
return Date.convertFromYYYYMMDDHHMMSSMMM(d.substr(0,14));
};
// Static method to create a date from a UTC YYYYMMDDHHMMSSMMM format string
Date.convertFromYYYYMMDDHHMMSSMMM = function(d)
{
d = d ? d.replace(/[^0-9]/g, "") : "";
return new Date(Date.UTC(parseInt(d.substr(0,4),10),
parseInt(d.substr(4,2),10)-1,
parseInt(d.substr(6,2),10),
parseInt(d.substr(8,2)||"00",10),
parseInt(d.substr(10,2)||"00",10),
parseInt(d.substr(12,2)||"00",10),
parseInt(d.substr(14,3)||"000",10)));
};
//--
//-- RGB colour object
//--
// Construct an RGB colour object from a '#rrggbb', '#rgb' or 'rgb(n,n,n)' string or from separate r,g,b values
function RGB(r,g,b)
{
this.r = 0;
this.g = 0;
this.b = 0;
if(typeof r == "string") {
if(r.substr(0,1) == "#") {
if(r.length == 7) {
this.r = parseInt(r.substr(1,2),16)/255;
this.g = parseInt(r.substr(3,2),16)/255;
this.b = parseInt(r.substr(5,2),16)/255;
} else {
this.r = parseInt(r.substr(1,1),16)/15;
this.g = parseInt(r.substr(2,1),16)/15;
this.b = parseInt(r.substr(3,1),16)/15;
}
} else {
var rgbPattern = /rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/;
var c = r.match(rgbPattern);
if(c) {
this.r = parseInt(c[1],10)/255;
this.g = parseInt(c[2],10)/255;
this.b = parseInt(c[3],10)/255;
}
}
} else {
this.r = r;
this.g = g;
this.b = b;
}
return this;
}
// Mixes this colour with another in a specified proportion
// c = other colour to mix
// f = 0..1 where 0 is this colour and 1 is the new colour
// Returns an RGB object
RGB.prototype.mix = function(c,f)
{
return new RGB(this.r + (c.r-this.r) * f,this.g + (c.g-this.g) * f,this.b + (c.b-this.b) * f);
};
// Return an rgb colour as a #rrggbb format hex string
RGB.prototype.toString = function()
{
var clamp = function(x,min,max) {
return x < min ? min : (x > max ? max : x);
};
return "#" +
("0" + Math.floor(clamp(this.r,0,1) * 255).toString(16)).right(2) +
("0" + Math.floor(clamp(this.g,0,1) * 255).toString(16)).right(2) +
("0" + Math.floor(clamp(this.b,0,1) * 255).toString(16)).right(2);
};
//--
//-- DOM utilities - many derived from www.quirksmode.org
//--
function drawGradient(place,horiz,locolors,hicolors)
{
if(!hicolors)
hicolors = locolors;
var t;
for(t=0; t<= 100; t+=2) {
var bar = document.createElement("div");
place.appendChild(bar);
bar.style.position = "absolute";
bar.style.left = horiz ? t + "%" : 0;
bar.style.top = horiz ? 0 : t + "%";
bar.style.width = horiz ? (101-t) + "%" : "100%";
bar.style.height = horiz ? "100%" : (101-t) + "%";
bar.style.zIndex = -1;
var p = t/100*(locolors.length-1);
var hc = hicolors[Math.floor(p)];
if(typeof hc == "string")
hc = new RGB(hc);
var lc = locolors[Math.ceil(p)];
if(typeof lc == "string")
lc = new RGB(lc);
bar.style.backgroundColor = hc.mix(lc,p-Math.floor(p)).toString();
}
}
function addEvent(obj,type,fn)
{
if(obj.attachEvent) {
obj["e"+type+fn] = fn;
obj[type+fn] = function(){obj["e"+type+fn](window.event);};
obj.attachEvent("on"+type,obj[type+fn]);
} else {
obj.addEventListener(type,fn,false);
}
}
function removeEvent(obj,type,fn)
{
if(obj.detachEvent) {
obj.detachEvent("on"+type,obj[type+fn]);
obj[type+fn] = null;
} else {
obj.removeEventListener(type,fn,false);
}
}
// Find the closest relative with a given property value (property defaults to tagName, relative defaults to parentNode)
function findRelated(e,value,name,relative)
{
name = name || "tagName";
relative = relative || "parentNode";
if(name == "className") {
while(e && !jQuery(e).hasClass(value)) {
e = e[relative];
}
} else {
while(e && e[name] != value) {
e = e[relative];
}
}
return e;
}
// Get the scroll position for window.scrollTo necessary to scroll a given element into view
function ensureVisible(e)
{
var posTop = findPosY(e);
var posBot = posTop + e.offsetHeight;
var winTop = findScrollY();
var winHeight = findWindowHeight();
var winBot = winTop + winHeight;
if(posTop < winTop) {
return posTop;
} else if(posBot > winBot) {
if(e.offsetHeight < winHeight)
return posTop - (winHeight - e.offsetHeight);
else
return posTop;
} else {
return winTop;
}
}
// Get the current width of the display window
function findWindowWidth()
{
return window.innerWidth || document.documentElement.clientWidth;
}
// Get the current height of the display window
function findWindowHeight()
{
return window.innerHeight || document.documentElement.clientHeight;
}
// Get the current height of the document
function findDocHeight() {
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight)
);
}
// Get the current horizontal page scroll position
function findScrollX()
{
return window.scrollX || document.documentElement.scrollLeft;
}
// Get the current vertical page scroll position
function findScrollY()
{
return window.scrollY || document.documentElement.scrollTop;
}
function findPosX(obj)
{
var curleft = 0;
while(obj.offsetParent) {
curleft += obj.offsetLeft;
obj = obj.offsetParent;
}
return curleft;
}
function findPosY(obj)
{
var curtop = 0;
while(obj.offsetParent) {
curtop += obj.offsetTop;
obj = obj.offsetParent;
}
return curtop;
}
// Blur a particular element
function blurElement(e)
{
if(e && e.focus && e.blur) {
e.focus();
e.blur();
}
}
// Create a non-breaking space
function insertSpacer(place)
{
var e = document.createTextNode(String.fromCharCode(160));
if(place)
place.appendChild(e);
return e;
}
// Replace the current selection of a textarea or text input and scroll it into view
function replaceSelection(e,text)
{
if(e.setSelectionRange) {
var oldpos = e.selectionStart;
var isRange = e.selectionEnd > e.selectionStart;
e.value = e.value.substr(0,e.selectionStart) + text + e.value.substr(e.selectionEnd);
e.setSelectionRange(isRange ? oldpos : oldpos + text.length,oldpos + text.length);
var linecount = e.value.split("\n").length;
var thisline = e.value.substr(0,e.selectionStart).split("\n").length-1;
e.scrollTop = Math.floor((thisline - e.rows / 2) * e.scrollHeight / linecount);
} else if(document.selection) {
var range = document.selection.createRange();
if(range.parentElement() == e) {
var isCollapsed = range.text == "";
range.text = text;
if(!isCollapsed) {
range.moveStart("character", -text.length);
range.select();
}
}
}
}
// Set the caret position in a text area
function setCaretPosition(e,pos)
{
if(e.selectionStart || e.selectionStart == '0') {
e.selectionStart = pos;
e.selectionEnd = pos;
e.focus();
} else if(document.selection) {
// IE support
e.focus ();
var sel = document.selection.createRange();
sel.moveStart('character', -e.value.length);
sel.moveStart('character',pos);
sel.moveEnd('character',0);
sel.select();
}
}
// Returns the text of the given (text) node, possibly merging subsequent text nodes
function getNodeText(e)
{
var t = "";
while(e && e.nodeName == "#text") {
t += e.nodeValue;
e = e.nextSibling;
}
return t;
}
// Returns true if the element e has a given ancestor element
function isDescendant(e,ancestor)
{
while(e) {
if(e === ancestor)
return true;
e = e.parentNode;
}
return false;
}
// deprecate the following...
// Prevent an event from bubbling
function stopEvent(e)
{
var ev = e || window.event;
ev.cancelBubble = true;
if(ev.stopPropagation) ev.stopPropagation();
return false;
}
// Remove any event handlers or non-primitve custom attributes
function scrubNode(e)
{
if(!config.browser.isIE)
return;
var att = e.attributes;
if(att) {
var t;
for(t=0; t<att.length; t++) {
var n = att[t].name;
if(n !== "style" && (typeof e[n] === "function" || (typeof e[n] === "object" && e[n] != null))) {
try {
e[n] = null;
} catch(ex) {
}
}
}
}
var c = e.firstChild;
while(c) {
scrubNode(c);
c = c.nextSibling;
}
}
function setStylesheet(s,id,doc)
{
jQuery.twStylesheet(s,{id:id,doc:doc});
}
function removeStyleSheet(id)
{
jQuery.twStylesheet.remove({id:id});
}
//--
//-- LoaderBase and SaverBase
//--
function LoaderBase() {}
LoaderBase.prototype.loadTiddler = function(store,node,tiddlers)
{
var title = this.getTitle(store,node);
if(safeMode && store.isShadowTiddler(title))
return;
if(title) {
var tiddler = store.createTiddler(title);
this.internalizeTiddler(store,tiddler,title,node);
tiddlers.push(tiddler);
}
};
LoaderBase.prototype.loadTiddlers = function(store,nodes)
{
var t,tiddlers = [];
for(t = 0; t < nodes.length; t++) {
try {
this.loadTiddler(store,nodes[t],tiddlers);
} catch(ex) {
showException(ex,config.messages.tiddlerLoadError.format([this.getTitle(store,nodes[t])]));
}
}
return tiddlers;
};
function SaverBase() {}
SaverBase.prototype.externalize = function(store)
{
var results = [];
var t,tiddlers = store.getTiddlers("title");
for(t = 0; t < tiddlers.length; t++) {
if(!tiddlers[t].doNotSave())
results.push(this.externalizeTiddler(store, tiddlers[t]));
}
return results.join("\n");
};
//--
//-- TW21Loader (inherits from LoaderBase)
//--
function TW21Loader() {}
TW21Loader.prototype = new LoaderBase();
TW21Loader.prototype.getTitle = function(store,node)
{
var title = null;
if(node.getAttribute) {
title = node.getAttribute("title");
if(!title)
title = node.getAttribute("tiddler");
}
if(!title && node.id) {
var lenPrefix = store.idPrefix.length;
if(node.id.substr(0,lenPrefix) == store.idPrefix)
title = node.id.substr(lenPrefix);
}
return title;
};
TW21Loader.prototype.internalizeTiddler = function(store,tiddler,title,node)
{
var e = node.firstChild;
var text = null;
if(node.getAttribute("tiddler")) {
text = getNodeText(e).unescapeLineBreaks();
} else {
while(e.nodeName!="PRE" && e.nodeName!="pre") {
e = e.nextSibling;
}
text = e.innerHTML.replace(/\r/mg,"").htmlDecode();
}
var creator = node.getAttribute("creator");
var modifier = node.getAttribute("modifier");
var c = node.getAttribute("created");
var m = node.getAttribute("modified");
var created = c ? Date.convertFromYYYYMMDDHHMMSS(c) : version.date;
var modified = m ? Date.convertFromYYYYMMDDHHMMSS(m) : created;
var tags = node.getAttribute("tags");
var fields = {};
var i,attrs = node.attributes;
for(i = attrs.length-1; i >= 0; i--) {
var name = attrs[i].name;
if(attrs[i].specified && !TiddlyWiki.isStandardField(name)) {
fields[name] = attrs[i].value.unescapeLineBreaks();
}
}
tiddler.assign(title,text,modifier,modified,tags,created,fields,creator);
return tiddler;
};
//--
//-- TW21Saver (inherits from SaverBase)
//--
function TW21Saver() {}
TW21Saver.prototype = new SaverBase();
TW21Saver.prototype.externalizeTiddler = function(store,tiddler)
{
try {
var extendedAttributes = "";
var usePre = config.options.chkUsePreForStorage;
store.forEachField(tiddler,
function(tiddler,fieldName,value) {
// don't store stuff from the temp namespace
if(typeof value != "string")
value = "";
if(!fieldName.match(/^temp\./))
extendedAttributes += ' %0="%1"'.format([fieldName,value.escapeLineBreaks().htmlEncode()]);
},true);
var created = tiddler.created;
var modified = tiddler.modified;
var attributes = tiddler.creator ? ' creator="' + tiddler.creator.htmlEncode() + '"' : "";
attributes += tiddler.modifier ? ' modifier="' + tiddler.modifier.htmlEncode() + '"' : "";
attributes += (usePre && created == version.date) ? "" :' created="' + created.convertToYYYYMMDDHHMM() + '"';
attributes += (usePre && modified == created) ? "" : ' modified="' + modified.convertToYYYYMMDDHHMM() +'"';
var tags = tiddler.getTags();
if(!usePre || tags)
attributes += ' tags="' + tags.htmlEncode() + '"';
return ('<div %0="%1"%2%3>%4</'+'div>').format([
usePre ? "title" : "tiddler",
tiddler.title.htmlEncode(),
attributes,
extendedAttributes,
usePre ? "\n<pre>" + tiddler.text.htmlEncode() + "</pre>\n" : tiddler.text.escapeLineBreaks().htmlEncode()
]);
} catch (ex) {
throw exceptionText(ex,config.messages.tiddlerSaveError.format([tiddler.title]));
}
};
//]]>
</script>
<script id="jsdeprecatedArea" type="text/javascript">
//<![CDATA[
//--
//-- Deprecated Crypto functions and associated conversion routines.
//-- Use the jQuery.encoding functions directly instead.
//--
// Crypto 'namespace'
function Crypto() {}
// Convert a string to an array of big-endian 32-bit words
Crypto.strToBe32s = function(str)
{
return jQuery.encoding.strToBe32s(str);
};
// Convert an array of big-endian 32-bit words to a string
Crypto.be32sToStr = function(be)
{
return jQuery.encoding.be32sToStr(be);
};
// Convert an array of big-endian 32-bit words to a hex string
Crypto.be32sToHex = function(be)
{
return jQuery.encoding.be32sToHex(be);
};
// Return, in hex, the SHA-1 hash of a string
Crypto.hexSha1Str = function(str)
{
return jQuery.encoding.digests.hexSha1Str(str);
};
// Return the SHA-1 hash of a string
Crypto.sha1Str = function(str)
{
return jQuery.encoding.digests.sha1Str(str);
};
// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
Crypto.sha1 = function(x,blen)
{
return jQuery.encoding.digests.sha1(x,blen);
};
//--
//-- Deprecated code
//--
// @Deprecated: Use createElementAndWikify and this.termRegExp instead
config.formatterHelpers.charFormatHelper = function(w)
{
w.subWikify(createTiddlyElement(w.output,this.element),this.terminator);
};
// @Deprecated: Use enclosedTextHelper and this.lookaheadRegExp instead
config.formatterHelpers.monospacedByLineHelper = function(w)
{
var lookaheadRegExp = new RegExp(this.lookahead,"mg");
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var text = lookaheadMatch[1];
if(config.browser.isIE)
text = text.replace(/\n/g,"\r");
createTiddlyElement(w.output,"pre",null,null,text);
w.nextMatch = lookaheadRegExp.lastIndex;
}
};
// @Deprecated: Use <br> or <br /> instead of <<br>>
config.macros.br = {};
config.macros.br.handler = function(place)
{
createTiddlyElement(place,"br");
};
// Find an entry in an array. Returns the array index or null
// @Deprecated: Use indexOf instead
Array.prototype.find = function(item)
{
var i = this.indexOf(item);
return i == -1 ? null : i;
};
// Load a tiddler from an HTML DIV. The caller should make sure to later call Tiddler.changed()
// @Deprecated: Use store.getLoader().internalizeTiddler instead
Tiddler.prototype.loadFromDiv = function(divRef,title)
{
return store.getLoader().internalizeTiddler(store,this,title,divRef);
};
// Format the text for storage in an HTML DIV
// @Deprecated Use store.getSaver().externalizeTiddler instead.
Tiddler.prototype.saveToDiv = function()
{
return store.getSaver().externalizeTiddler(store,this);
};
// @Deprecated: Use store.allTiddlersAsHtml() instead
function allTiddlersAsHtml()
{
return store.allTiddlersAsHtml();
}
// @Deprecated: Use refreshPageTemplate instead
function applyPageTemplate(title)
{
refreshPageTemplate(title);
}
// @Deprecated: Use story.displayTiddlers instead
function displayTiddlers(srcElement,titles,template,unused1,unused2,animate,unused3)
{
story.displayTiddlers(srcElement,titles,template,animate);
}
// @Deprecated: Use story.displayTiddler instead
function displayTiddler(srcElement,title,template,unused1,unused2,animate,unused3)
{
story.displayTiddler(srcElement,title,template,animate);
}
// @Deprecated: Use functions on right hand side directly instead
var createTiddlerPopup = Popup.create;
var scrollToTiddlerPopup = Popup.show;
var hideTiddlerPopup = Popup.remove;
// @Deprecated: Use right hand side directly instead
var regexpBackSlashEn = new RegExp("\\\\n","mg");
var regexpBackSlash = new RegExp("\\\\","mg");
var regexpBackSlashEss = new RegExp("\\\\s","mg");
var regexpNewLine = new RegExp("\n","mg");
var regexpCarriageReturn = new RegExp("\r","mg");
//--
//-- Deprecated FileAdaptor functions
//--
FileAdaptor.loadTiddlyWikiCallback = function(status,context,responseText,url,xhr)
{
context.status = status;
if(!status) {
context.statusText = "Error reading file";
} else {
context.adaptor.store = new TiddlyWiki();
if(!context.adaptor.store.importTiddlyWiki(responseText)) {
context.statusText = config.messages.invalidFileError.format([url]);
context.status = false;
}
}
context.complete(context,context.userParams);
};
//--
//-- Deprecated HTTP request code
//-- Use the jQuery ajax functions directly instead
//--
function loadRemoteFile(url,callback,params)
{
return httpReq("GET",url,callback,params);
}
function doHttp(type,url,data,contentType,username,password,callback,params,headers,allowCache)
{
return httpReq(type,url,callback,params,headers,data,contentType,username,password,allowCache);
}
//--
//-- Deprecated String functions
//--
// @Deprecated: no direct replacement, since not used in core code
String.prototype.toJSONString = function()
{
// Convert a string to it's JSON representation by encoding control characters, double quotes and backslash. See json.org
var m = {
'\b': '\\b',
'\f': '\\f',
'\n': '\\n',
'\r': '\\r',
'\t': '\\t',
'"' : '\\"',
'\\': '\\\\'
};
var replaceFn = function(a,b) {
var c = m[b];
if(c)
return c;
c = b.charCodeAt();
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
};
if(/["\\\x00-\x1f]/.test(this))
return '"' + this.replace(/([\x00-\x1f\\"])/g,replaceFn) + '"';
return '"' + this + '"';
};
//--
//-- Deprecated Tiddler code
//--
// @Deprecated: Use tiddlerToRssItem(tiddler,uri) instead
Tiddler.prototype.toRssItem = function(uri)
{
return tiddlerToRssItem(this,uri);
};
// @Deprecated: Use "<item>\n" + tiddlerToRssItem(tiddler,uri) + "\n</item>" instead
Tiddler.prototype.saveToRss = function(uri)
{
return "<item>\n" + tiddlerToRssItem(this,uri) + "\n</item>";
};
// @Deprecated: Use jQuery.encoding.digests.hexSha1Str instead
Tiddler.prototype.generateFingerprint = function()
{
return "0x" + Crypto.hexSha1Str(this.text);
};
//--
//-- Deprecated Number functions
//--
// @Deprecated: no direct replacement, since not used in core code
// Clamp a number to a range
Number.prototype.clamp = function(min,max)
{
var c = this;
if(c < min)
c = min;
if(c > max)
c = max;
return Number(c);
};
//--
//-- Deprecated utility functions
//-- Use the jQuery functions directly instead
//--
// Remove all children of a node
function removeChildren(e)
{
jQuery(e).empty();
}
// Remove a node and all it's children
function removeNode(e)
{
jQuery(e).remove();
}
// Return the content of an element as plain text with no formatting
function getPlainText(e)
{
return jQuery(e).text();
}
function addClass(e,className)
{
jQuery(e).addClass(className);
}
function removeClass(e,className)
{
jQuery(e).removeClass(className);
}
function hasClass(e,className)
{
return jQuery(e).hasClass(className);
}
//--
//-- Deprecated Wikifier code
//--
function wikifyPlain(title,theStore,limit)
{
if(!theStore)
theStore = store;
if(theStore.tiddlerExists(title) || theStore.isShadowTiddler(title)) {
return wikifyPlainText(theStore.getTiddlerText(title),limit,tiddler);
} else {
return "";
}
}
//]]>
</script>
<script id="jslibArea" type="text/javascript">
//<![CDATA[
/*! jQuery v1.8.3 jquery.com | jquery.org/license */
(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window);
//]]>
</script>
<script id="jqueryArea" type="text/javascript">
//<![CDATA[
/*
jQuery.encoding.digests.sha1.js
SHA-1 digest and associated utility functions
Copyright (c) UnaMesa Association 2009
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
*/
(function($) {
if(!$.encoding)
$.encoding = {};
$.extend($.encoding,{
strToBe32s: function(str) {
// Convert a string to an array of big-endian 32-bit words
var be=[];
var len=Math.floor(str.length/4);
var i, j;
for(i=0, j=0; i<len; i++, j+=4) {
be[i]=((str.charCodeAt(j)&0xff) << 24)|((str.charCodeAt(j+1)&0xff) << 16)|((str.charCodeAt(j+2)&0xff) << 8)|(str.charCodeAt(j+3)&0xff);
}
while(j<str.length) {
be[j>>2] |= (str.charCodeAt(j)&0xff)<<(24-(j*8)%32);
j++;
}
return be;
},
be32sToStr: function(be) {
// Convert an array of big-endian 32-bit words to a string
var str='';
for(var i=0;i<be.length*32;i+=8) {
str += String.fromCharCode((be[i>>5]>>>(24-i%32)) & 0xff);
}
return str;
},
be32sToHex: function(be) {
// Convert an array of big-endian 32-bit words to a hex string
var hex='0123456789ABCDEF';
var str='';
for(var i=0;i<be.length*4;i++) {
str += hex.charAt((be[i>>2]>>((3-i%4)*8+4))&0xF) + hex.charAt((be[i>>2]>>((3-i%4)*8))&0xF);
}
return str;
}
});
})(jQuery);
(function($) {
if(!$.encoding.digests)
$.encoding.digests = {};
$.extend($.encoding.digests,{
hexSha1Str: function(str) {
// Return, in hex, the SHA-1 hash of a string
return $.encoding.be32sToHex($.encoding.digests.sha1Str(str));
},
sha1Str: function(str) {
// Return the SHA-1 hash of a string
return sha1($.encoding.strToBe32s(str),str.length);
},
sha1: function(x,blen) {
// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
return sha1($.encoding.strToBe32s(str),str.length);
}
});
// Private functions.
function sha1(x,blen) {
// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
function add32(a,b) {
// Add 32-bit integers, wrapping at 32 bits
// Uses 16-bit operations internally to work around bugs in some JavaScript interpreters.
var lsw=(a&0xFFFF)+(b&0xFFFF);
var msw=(a>>16)+(b>>16)+(lsw>>16);
return (msw<<16)|(lsw&0xFFFF);
}
function AA(a,b,c,d,e) {
// Cryptographic round helper function. Add five 32-bit integers, wrapping at 32 bits, second parameter is rotated left 5 bits before the addition
// Uses 16-bit operations internally to work around bugs in some JavaScript interpreters.
b=(b>>>27)|(b<<5);
var lsw=(a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF);
var msw=(a>>16)+(b>>16)+(c>>16)+(d>>16)+(e>>16)+(lsw>>16);
return (msw<<16)|(lsw&0xFFFF);
}
function RR(w,j) {
// Cryptographic round helper function.
var n=w[j-3]^w[j-8]^w[j-14]^w[j-16];
return (n>>>31)|(n<<1);
}
var len=blen*8;
x[len>>5] |= 0x80 << (24-len%32);
x[((len+64>>9)<<4)+15]=len;
var w=new Array(80);
var k1=0x5A827999;
var k2=0x6ED9EBA1;
var k3=0x8F1BBCDC;
var k4=0xCA62C1D6;
var h0=0x67452301;
var h1=0xEFCDAB89;
var h2=0x98BADCFE;
var h3=0x10325476;
var h4=0xC3D2E1F0;
for(var i=0;i<x.length;i+=16) {
var j=0;
var t;
var a=h0;
var b=h1;
var c=h2;
var d=h3;
var e=h4;
while(j<16) {
w[j]=x[i+j];
t=AA(e,a,d^(b&(c^d)),w[j],k1);
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
}
while(j<20) {
w[j]=RR(w,j);
t=AA(e,a,d^(b&(c^d)),w[j],k1);
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
}
while(j<40) {
w[j]=RR(w,j);
t=AA(e,a,b^c^d,w[j],k2);
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
}
while(j<60) {
w[j]=RR(w,j);
t=AA(e,a,(b&c)|(d&(b|c)),w[j],k3);
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
}
while(j<80) {
w[j]=RR(w,j);
t=AA(e,a,b^c^d,w[j],k4);
e=d; d=c; c=(b>>>2)|(b<<30); b=a; a=t; j++;
}
h0=add32(h0,a);
h1=add32(h1,b);
h2=add32(h2,c);
h3=add32(h3,d);
h4=add32(h4,e);
}
return [h0,h1,h2,h3,h4];
}
})(jQuery);
/*
jQuery.twStylesheet.js
jQuery plugin to dynamically insert CSS rules into a document
Usage:
jQuery.twStylesheet applies style definitions
jQuery.twStylesheet.remove neutralizes style definitions
Copyright (c) UnaMesa Association 2009
Triple licensed under the BSD, MIT and GPL licenses:
http://www.opensource.org/licenses/bsd-license.php
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
*/
(function($) {
var defaultId = "customStyleSheet"; // XXX: rename to dynamicStyleSheet?
// Add or replace a style sheet
// css argument is a string of CSS rule sets
// options.id is an optional name identifying the style sheet
// options.doc is an optional document reference
// N.B.: Uses DOM methods instead of jQuery to ensure cross-browser comaptibility.
$.twStylesheet = function(css, options) {
options = options || {};
var id = options.id || defaultId;
var doc = options.doc || document;
var el = doc.getElementById(id);
if(doc.createStyleSheet) { // IE-specific handling
if(el) {
el.parentNode.removeChild(el);
}
doc.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd",
' <style id="' + id + '" type="text/css">' + css + '</style>'); // fails without
} else { // modern browsers
if(el) {
el.replaceChild(doc.createTextNode(css), el.firstChild);
} else {
el = doc.createElement("style");
el.type = "text/css";
el.id = id;
el.appendChild(doc.createTextNode(css));
doc.getElementsByTagName("head")[0].appendChild(el);
}
}
};
// Remove existing style sheet
// options.id is an optional name identifying the style sheet
// options.doc is an optional document reference
$.twStylesheet.remove = function(options) {
options = options || {};
var id = options.id || defaultId;
var doc = options.doc || document;
var el = doc.getElementById(id);
if(el) {
el.parentNode.removeChild(el);
}
};
})(jQuery);
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
if(useJavaSaver)
document.write("<applet style='position:absolute;left:-1px' name='TiddlySaver' code='TiddlySaver.class' archive='TiddlySaver.jar' width='1' height='1'></applet>");
//]]>
</script>
<!--POST-SCRIPT-START-->
<!--POST-SCRIPT-END-->
</body>
</html>
|