home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / FWINDOWS / Win95 / Macsrv12 / MACSRV12.LZH / DLGTEST.MAC next >
Text File  |  1995-09-05  |  7KB  |  239 lines

  1. // 秀まるおのマクロサーバ ダイアログサービスのテスト用のマクロです
  2. // (当然のことながら秀丸エディタ用です)
  3. //
  4.     run "macserv.exe";
  5.     ddeinitiate "HideMacroServer", "DlgService";
  6.     if( !result ) {
  7.         message "ddeinitiate failed";
  8.         endmacro;
  9.     }
  10.     
  11.     
  12.     
  13.     //***** チェックボックスのテスト *****
  14.     ddepoke "newdialog", "40,チェックボックスのテスト";
  15.     ddepoke "newcontrol", "check,MyCheck1,チェックボックス1";
  16.     ddepoke "newcontrol", "check,MyCheck2,チェックボックス2";
  17.     ddepoke "newcontrol", "check,MyCheck3,チェックボックス3";
  18.     ddepoke "newcontrol", "okcancel";
  19.     
  20.     call MakeDialog;
  21.     message "チェック1の状態 = " + dderequest("getstate MyCheck1") + "\n" +
  22.             "チェック2の状態 = " + dderequest("getstate MyCheck2") + "\n" +
  23.             "チェック3の状態 = " + dderequest("getstate MyCheck3");
  24.     
  25.     
  26.     
  27.     //***** リストボックスのテスト *****
  28.     ddepoke "newdialog", "40,リストボックスのテスト";
  29.     ddepoke "newcontrol", "list,MyListbox,";
  30.     ddepoke "item", "リストの項目1";
  31.     ddepoke "item", "リストの項目2";
  32.     ddepoke "item", "リストの項目3";
  33.     ddepoke "item", "リストの項目4";
  34.     ddepoke "newcontrol", "okcancel";
  35.     
  36.     call MakeDialog;
  37.     message dderequest("getstate MyListbox") + " 番目が選ばれました\n" +
  38.             "選ばれた項目の内容 = 「" + dderequest("getstring MyListBox") + "」";
  39.     
  40.     
  41.     
  42.     //***** ラジオボタンのテスト *****
  43.     ddepoke "newdialog", "40,ラジオボタンのテスト";
  44.     ddepoke "newcontrol", "radio,MyRadio,グループ";
  45.     ddepoke "item", "ラジオボタン1";
  46.     ddepoke "item", "ラジオボタン2";
  47.     ddepoke "item", "ラジオボタン3";
  48.     ddepoke "newcontrol", "okcancel";
  49.     
  50.     call MakeDialog;
  51.     message dderequest("getstate MyRadio") + " 番目のボタンが選ばれました";
  52.     
  53.     
  54.     
  55.     //***** エディットのテスト *****
  56.     ddepoke "newdialog", "40,エディットのテスト";
  57.     ddepoke "newcontrol", "edit,MyEdit,";
  58.     ddepoke "newcontrol", "okcancel";
  59.     
  60.     call MakeDialog;
  61.     message "数値が入力された場合 = " + dderequest("getstate MyEdit") + "\n" +
  62.             "数値か文字が入力された場合 = " + dderequest("getstring MyEdit");
  63.     
  64.     
  65.     
  66.     //***** プッシュボタンのテスト *****
  67.     ddepoke "newdialog", "40,プッシュボタンのテスト";
  68.     ddepoke "newcontrol", "button,,ボタン1";
  69.     ddepoke "notify", "123";
  70.     ddepoke "newcontrol", "button,,ボタン2";
  71.     ddepoke "notify", "456";
  72.     ddepoke "newcontrol", "okcancel";
  73.     
  74.     call MakeDialog;
  75.     
  76.     if( $$return == "0" ) {
  77.         message "キャンセルが押されました";
  78.     } else if( $$return == "1" ) {
  79.         message "OKが押されました";
  80.     } else if( $$return == "123" ) {
  81.         message "ボタン1が押されました";
  82.     } else if( $$return == "456" ) {
  83.         message "ボタン2が押されました";
  84.     }
  85.     
  86.     
  87.     
  88.     //***** デフォルト値の設定のテスト *****
  89.     ddepoke "newdialog", "40,デフォルト値の設定のテスト";
  90.     ddepoke "newcontrol", "check,MyCheck,チェックボックス";
  91.     ddepoke "default", "1";
  92.     ddepoke "newcontrol", "list,MyListbox,";
  93.     ddepoke "item", "リストの項目1";
  94.     ddepoke "item", "リストの項目2";
  95.     ddepoke "item", "リストの項目3";
  96.     ddepoke "default", "3";
  97.     ddepoke "newcontrol", "radio,MyRadio,グループ";
  98.     ddepoke "item", "ラジオボタン1";
  99.     ddepoke "item", "ラジオボタン2";
  100.     ddepoke "item", "ラジオボタン3";
  101.     ddepoke "default", "2";
  102.     ddepoke "newcontrol", "edit,MyEdit,初期化文字";
  103.     ddepoke "newcontrol", "okcancel";
  104.     
  105.     call MakeDialog;
  106.     
  107.     
  108.     
  109.     //***** ニーモニックのテスト *****
  110.     ddepoke "newdialog", "40,ニーモニックのテスト";
  111.     ddepoke "newcontrol", "check,MyCheck,チェックボックス(&C)";
  112.     ddepoke "newcontrol", "text,,リストボックス(&L)";
  113.     ddepoke "newcontrol", "list,MyListbox,";
  114.     ddepoke "item", "リストの項目1";
  115.     ddepoke "item", "リストの項目2";
  116.     ddepoke "item", "リストの項目3";
  117.     ddepoke "newcontrol", "radio,MyRadio1,グループ1(&G)";
  118.     ddepoke "item", "ラジオボタン1";
  119.     ddepoke "item", "ラジオボタン2";
  120.     ddepoke "item", "ラジオボタン3";
  121.     ddepoke "newcontrol", "radio,MyRadio2,グループ2";
  122.     ddepoke "item", "ラジオボタン1(&1)";
  123.     ddepoke "item", "ラジオボタン2(&2)";
  124.     ddepoke "item", "ラジオボタン3(&3)";
  125.     ddepoke "newcontrol", "text,,エディット(&E)";
  126.     ddepoke "newcontrol", "edit,MyEdit,";
  127.     ddepoke "newcontrol", "okcancel";
  128.     
  129.     call MakeDialog;
  130.     
  131.     
  132.     //***** heightのテスト *****
  133.     ddepoke "newdialog", "40,heightのテスト";
  134.     ddepoke "newcontrol", "text,,低いリストボックス";
  135.     ddepoke "newcontrol", "list,MyListbox1,";
  136.     ddepoke "item", "リストの項目1";
  137.     ddepoke "item", "リストの項目2";
  138.     ddepoke "item", "リストの項目3";
  139.     ddepoke "height", "2";
  140.     ddepoke "newcontrol", "text,,高いリストボックス";
  141.     ddepoke "newcontrol", "list,MyListbox2,";
  142.     ddepoke "item", "リストの項目1";
  143.     ddepoke "item", "リストの項目2";
  144.     ddepoke "item", "リストの項目3";
  145.     ddepoke "height", "8";
  146.     ddepoke "newcontrol", "okcancel";
  147.     
  148.     call MakeDialog;
  149.     
  150.     
  151.     
  152.     //***** partのテスト *****
  153.     ddepoke "newdialog", "40,partのテスト";
  154.     ddepoke "newcontrol", "text,,エディット(&E):";
  155.     ddepoke "part", "16";
  156.     ddepoke "newcontrol", "edit,MyEdit,";
  157.     ddepoke "part", "10";
  158.     ddepoke "newcontrol", "text,,";    //(ダミー)
  159.     ddepoke "newcontrol", "radio,MyRadio,グループ1(&G)";
  160.     ddepoke "item", "ラジオ1";
  161.     ddepoke "item", "ラジオ2";
  162.     ddepoke "item", "ラジオ3";
  163.     ddepoke "part", "30";
  164.     ddepoke "newcontrol", "text,,";    //(ダミー)
  165.     ddepoke "newcontrol", "button,,左";
  166.     ddepoke "part", "13";
  167.     ddepoke "newcontrol", "button,,中";
  168.     ddepoke "part", "13";
  169.     ddepoke "newcontrol", "button,,右";
  170.     ddepoke "newcontrol", "okcancel";
  171.     
  172.     call MakeDialog;
  173.     
  174.     
  175.     
  176.     //***** newcolumnのテスト *****
  177.     ddepoke "newdialog", "20,newcolumnのテスト";
  178.     ddepoke "newcontrol", "check,,チェック1(1行目)";
  179.     ddepoke "newcontrol", "check,,チェック2(1行目)";
  180.     ddepoke "newcontrol", "check,,チェック3(1行目)";
  181.     ddepoke "newcolumn", "30";
  182.     ddepoke "newcontrol", "button,,ボタン1(2行目)";
  183.     ddepoke "newcontrol", "button,,ボタン2(2行目)";
  184.     ddepoke "newcolumn", "30";
  185.     ddepoke "newcontrol", "radio,,3行目";
  186.     ddepoke "item", "ラジオ1";
  187.     ddepoke "item", "ラジオ2";
  188.     ddepoke "item", "ラジオ3";
  189.     ddepoke "item", "ラジオ4";
  190.     ddepoke "item", "ラジオ5";
  191.     ddepoke "newcontrol", "okcancel";
  192.     
  193.     call MakeDialog;
  194.     
  195.     
  196.     
  197.     //***** newpageのテスト *****
  198.     ddepoke "newdialog", "20,newpageのテスト";
  199.     ddepoke "newcontrol", "check,,チェック1(1行目)";
  200.     ddepoke "newcontrol", "check,,チェック2(1行目)";
  201.     ddepoke "newcontrol", "check,,チェック3(1行目)";
  202.     ddepoke "newcolumn", "30";
  203.     ddepoke "newcontrol", "button,,ボタン1(2行目)";
  204.     ddepoke "newcontrol", "button,,ボタン2(2行目)";
  205.     ddepoke "newcolumn", "30";
  206.     ddepoke "newcontrol", "radio,,3行目";
  207.     ddepoke "item", "ラジオ1";
  208.     ddepoke "item", "ラジオ2";
  209.     ddepoke "item", "ラジオ3";
  210.     ddepoke "item", "ラジオ4";
  211.     ddepoke "item", "ラジオ5";
  212.     
  213.     ddepoke "newpage", "40";
  214.     ddepoke "newcontrol", "text,,↓ここからnewpage";
  215.     ddepoke "newcontrol", "list,,";
  216.     ddepoke "newcolumn", "30";
  217.     ddepoke "newcontrol", "text,,↓newpageのあとnewcolumn";
  218.     ddepoke "newcontrol", "check,,チェック3(2段目の2行目)";
  219.     ddepoke "newcontrol", "check,,チェック4(2段目の2行目)";
  220.     ddepoke "newcontrol", "okcancel";
  221.     
  222.     call MakeDialog;
  223.     
  224.     
  225.     ddeexecute "exit";
  226.     endmacro;
  227.  
  228. MakeDialog:
  229.     #hwnd = hidemaruhandle(0);
  230.     ddeexecute "dialog " + str(#hwnd);
  231.     $$a = "";
  232.     ddestartadvice "dlgresult", $$a;
  233.     while( strlen($$a) == 0 ) {
  234.         ddewaitadvice $$a, 100;
  235.     }
  236.     ddestopadvice "dlgresult";
  237.     ddeexecute "enddialog";
  238.     return $$a;
  239.