I'm trying to make a simple app, which loads some data via TextFields and then does something with that, but ...
Needs["GUIKit`"]
okt1 == PropertyValue[{"O1", "text"}]
mask1 == PropertyValue[{"M1", "text"}]
Of course O1 and M1 are simply names of TextFields. Then I want to use BitAnd with those two numbers which user should enter.
SetPropertyValue[{"siec1", "text"}, BitAnd[okt1, mask1]]
All these actions are performed by an inside script which starts to work when an user clicks a button.
My problem is why in TextField named siec1 I see this:
BitAnd[GUIKit`Private`Script83`mask1, GUIKit`Private`Script83`okt1]
Instead of some value that I expect to see. Of course when I use
SetPropertyValue[{"siec1", "text"}, 2]
Number 2 appears in TextField siec1.
How should I approach this problem ?
Whole code:
Needs["GUIKit`"];
ref = GUIRun[
Widget["Panel",
{
Widget["Label", {"text" -> "Wprowadź adres IP:"}],
{
Widget["TextField", {"columns" -> 3}, Name -> "O1"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3}, Name -> "O2"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3}, Name -> "O3"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3}, Name -> "O4"]
},
Widget["Label", {"text" -> "Wprowadź maskę"}],
{
Widget["TextField", {"columns" -> 3}, Name -> "M1"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3}, Name -> "M2"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3}, Name -> "M3"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3}, Name -> "M4"]
},
Widget["Label", {"text" -> " "}],
(***************************************************)
(***************************************************)
(***************************************************)
Widget["Button", {"text" -> "Oblicz!",
BindEvent["action",
Script[Przelicz[]]
],
Script[
Przelicz[] := (
(*Pobranie wartosc z pol na formularzu*)
ref @okt1 == PropertyValue[{"O1", "text"}]
ref @okt2 == PropertyValue[{"O2", "text"}]
ref @okt3 == PropertyValue[{"O3", "text"}]
ref @okt4 == PropertyValue[{"O4", "text"}]
ref @mask1 == PropertyValue[{"M1", "text"}]
ref @mask2 == PropertyValue[{"M2", "text"}]
ref @mask3 == PropertyValue[{"M3", "text"}]
ref @mask4 == PropertyValue[{"M4", "text"}]
SetPropertyValue[{"siec1", "text"}, BitAnd[okt1, mask1]]
SetPropertyValue[{"siec2", "text"}, 2]
)
]
}
],
(***************************************************)
(***************************************************)
(***************************************************)
Widget["Label", {"text" -> " "}],
Widget["Label", {"text" -> " "}],
Widget["Label", {"text" -> "Adres sieci:"}],
{
Widget["TextField", {"columns" -> 3, "enabled" -> True},
Name -> "siec1"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "siec2"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "siec3"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "siec4"]
},
Widget["Label", {"text" -> " "}],
Widget["Label", {"text" -> "Adres pierwszego hosta:"}],
{
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "phost1"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "phost2"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "phost3"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "phost4"]
},
Widget["Label", {"text" -> " "}],
Widget["Label", {"text" -> "Adres ostatniego hosta:"}],
{
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "lhost1"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "lhost2"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "lhost3"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "lhost4"]
},
Widget["Label", {"text" -> " "}],
Widget["Label", {"text" -> "Adres rozgłoszeniowy:"}],
{
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "brd1"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "brd2"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "brd3"],
Widget["Label", {"text" -> "."}],
Widget["TextField", {"columns" -> 3, "enabled" -> False},
Name -> "brd4"]
},
Widget["Label", {"text" -> " "}],
Widget["Label", {"text" -> " "}],
(***************************************************)
(***************************************************)
Widget["Button", {"text" -> "Zapisz do pliku!",
BindEvent["action",
Script[ZapiszDoPliku[]]
],
Script[
ZapiszDoPliku[] := (
lol123 = 1
)
]
}
],
(***************************************************)
(***************************************************)
}, Name -> "Okno"]
];
PropertyValueneeds more arguments: According to the documentation,PropertyValue[{obj,item},name]. Also, do you really mean==in those equations? $\endgroup$PropertyValue[{"M1", "text"}]has red color, but I can't see any error. I'm using it like in this example . And if I use=I get errorSet::write: Tag Times in 255 mask1 is Protected. $\endgroup$O1, O2, O3, O4, M1, M2, M3, M4, do some work with them and paste result in other TextFields. Is there any way to do that? $\endgroup$