#ifndef INCLUDES #include "../HNBridge.as" #endif screen 112, 640, 480 title "HSP .NET Bridge Demo Application - 12. Listを扱うサンプル" font "メイリオ", 16 objmode 2 pos 010, 010 : mes "HSP .NET Bridge Demo Application - 12. Listを扱うサンプル" color 0xCC, 0xCC, 0xCC line 10, 35, 630, 35 color font "メイリオ", 15 pos 020, 040 : mes "Sample.dll 内の Sample.Sample012 のIListを実装した変数にアクセスし、" pos 020, 060 : mes "要素の追加、削除、取り出しを行います。" pos 020, 080 : mes "Sample.dll及びデモのソースコードは、メインウインドウの「ソースコード」から" pos 020, 100 : mes "閲覧することができます。" objsize 350, 30 LoadAssembly "Sample.dll" CreateObjectFromClassName "Sample.Sample012" CreateInstanceWithZeroArgs a = GetField("ProgrammingLanguages") TakeDownFromCurrent "instance" ToInstance //Listの場合は System.Collections.Generic.List`1[T] とします CreateObjectFromClassName "System.Collections.Generic.List`1[System.String]" count = GetProperty("Count") TakeUpFromBuffer "instance" pos 020, 160 : mes "Sample012.ProgrammingLanguages の要素数:" pos 370, 160 : mes count pos 020, 190 : button gosub "ProgrammingLanguages[index] の値を取得", *sample012_001 pos 020, 230 : mes "index = " _index = 0 pos 080, 227 : input _index, 120 pos 020, 260 : mes "ProgrammingLanguages[" + _index + "] = " pos 250, 260 : mes "" pos 020, 310 : button gosub "target の値を追加", *sample012_002 pos 020, 350 : mes "target = " _target = "Hot Soup Processor" pos 090, 347 : input _target, 240 : _targetBox = stat pos 020, 400 : button gosub "ProgrammingLanguages[index] の値を削除", *sample012_003 objsize 80, 30 pos 540, 440 : button gosub "閉じる", *exit_012 #ifdef INCLUDES onexit gosub *exit return #else stop #endif *sample012_001 color 0xFF, 0xFF, 0xFF boxf 020, 260, 640, 290 color value = GetLField("ProgrammingLanguages", _index) if(GetHDNStatus() == HDN_STATUS_FAILED) { value = "Listの範囲外です。" } pos 020, 260 : mes "ProgrammingLanguages[" + _index + "] = " + value return *sample012_002 AddLField "ProgrammingLanguages", _target a = GetField("ProgrammingLanguages") TakeDownFromCurrent "instance" ToInstance //Listの場合は System.Collections.Generic.List`1[T] とします CreateObjectFromClassName "System.Collections.Generic.List`1[System.String]" count = GetProperty("Count") TakeUpFromBuffer "instance" color 0xFF, 0xFF, 0xFF boxf 370, 160, 640, 400 color pos 370, 160 : mes count objprm _targetBox, "" return *sample012_003 DelLField "ProgrammingLanguages", _index a = GetField("ProgrammingLanguages") TakeDownFromCurrent "instance" ToInstance //Listの場合は System.Collections.Generic.List`1[T] とします CreateObjectFromClassName "System.Collections.Generic.List`1[System.String]" count = GetProperty("Count") TakeUpFromBuffer "instance" color 0xFF, 0xFF, 0xFF boxf 370, 160, 640, 400 color pos 370, 160 : mes count return *exit_012 gsel 112, -1 return