Message Boards Message Boards

0
|
7593 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

BindEvent binding own function

Posted 11 years ago
I need to change the property of a window when a button gets pressed. There are enough examples on Wolfram's website, but all they bind the predefined function "Print[]" and I have no problems with binding Print function, but I can't bind something different.

I need call my own function and methods of Widgets.

This is a window whose property I want to change:
widget4 = Widget["TextPanel", {
"preferredSize" ->
Widget["Dimension", {"width" -> 800, "height" -> 660}],
"contentType" -> "text/html",
"editable" -> False, "path" -> html1path}, Name -> "MainOutput"]

functio[]:=(Print["fffff"]);

This is my button:
html2path="some text which I want to change";
butto = Widget["Button", {
"Text" -> "Update",
BindEvent["Action",
Script[    {SetPropertyValue[{"MainOutput", "path"}, html2path] ,
  Print["fdfdf"], ref@InvokeMethod[{"Frame", "getX"}], functio[] } ]]
}]

I launch it all together so:
ref = GUIRun[ Widget["Frame", {widget4, butto}, Name -> "Frame" ]];

As result out of all my tries only function Print["fdfdf"] was called.

Output window:



I asked already on stackexchange.   No one seems to know the answer. Someone says it's bug in Mathematica.

I got stuck with it... I only need to bind my own function.
POSTED BY: gekannt gekannt
2 Replies
Posted 11 years ago
Congratulations!  What was the trick/method/insight ?
POSTED BY: Bruce Miller
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract