...ing logging 4.0

はてなブログに移行しました。D言語の話とかいろいろ。

DFL rev80 + dmd 2.031でリストボックスの選択済みアイテムが取得できない(3)

複数行選択モードのときだけうまく動かないようだが・・・?

import dfl.all;
import std.stdio;
import core.thread;

class Th : Thread
{
	ListBox l;
	this(ListBox l)
	{
		this.l = l;
		super(&run);
	}
	private void run()
	{
		for(;;)
		{
			writeln("sub-thread\t", l.items.length, " ", l.selectedIndices.length);
			for(int i=0; i<100000000; ++i){}//delay
		}
	}
}

void main()
{
	auto f = new Form;
	auto l = new ListBox;
	l.parent = f;
	l.selectionMode = SelectionMode.MULTI_EXTENDED;// or MULTI_SIMPLE
	l.click ~= (Object, EventArgs )
	{
		l.items.add("sample");
		writeln("main-thread\t", l.items.length, " ", l.selectedIndices.length);
	};
	
	auto th = new Th(l);
	th.start();
	
	Application.run(f);
}

sub-threadとmain-threadの2つ目の数値は同じ値にならないといけないはずだが・・・.

sub-thread      0 0
sub-thread      0 0
sub-thread      0 0
sub-thread      0 0
sub-thread      0 0
sub-thread      0 0
main-thread     1 0
sub-thread      1 0
sub-thread      1 0
main-thread     2 1
sub-thread      2 0
main-thread     3 1
sub-thread      3 0
sub-thread      3 0
sub-thread      3 0
sub-thread      3 0
main-thread     4 2
sub-thread      4 0
sub-thread      4 0
sub-thread      4 0

ん?

static class SelectedIndexCollection
...
static class SelectedObjectCollection

static・・・.
・・・.
・・・これかあああああああ!?