MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmable GUI

Does anyone know if there exist a good documentation for the Programmable Graphical User Interface (PGUI). I am trying to create a window with text that is automatically updated during the simulation (i.e. no user input). I have done this using a MathScriptBlock in the Systembuild editor which is calling a function (*.msf-file). This function contains PGUI-commands that builds up the window. I have used the command 'uitext' to display the text and the text is then updated during simulation with the command 'uisetvalue'. However I haven't figured out how to automatically start a new line of text (linefeed). Is this possible or ...? The documentation on PGUI is really poor. Will this be improved in future releases?
0 Kudos
Message 1 of 7
(8,811 Views)
I did a little programming in PGUI. When I would need to figure stuff like that out I would look to some of the things that were built in Mx already like ifilter and ICDM.

I did not find the documentation on PGUI particularly illuminating beyond the very fundamental.

Not sure this is at all helpful. With plotting though you may want to take a look at qplot() which might have some examples embedded in the comments that could be of assistance.
Garrett Thurston
gthurston@foliage.com
Phone: 781.993.5540
0 Kudos
Message 2 of 7
(8,811 Views)
Thanks for your time Garret.

I have looked into qplot() but didn't find anything that I needed. Perhaps it isn't possible to format the text in uitext. To bad, because it would have been a nice solution with a window with updated text, where the textinfo depended on what happened during the simulation.

If anyone know of a solution to format the displayed text in uitext, please let me know (post in this forum).
0 Kudos
Message 3 of 7
(8,811 Views)
Torbjorn,
To insert a newline character into a string use "n. The " is an escape character in the string and the n is the newline. If you want to read more about it, further information can be found in the Xmath Basics manual (section 5.6.2 Special Characters in Strings).

Starting with the example from the uiLabel help:

Command twoline {fragname, widgetname, instance}

alias T "twoline"

If (exist(fragname))
goto *fragname;
else
void = uiToolCreate(T)
MainWin = uiWindow(T, {name = "MainWin", title = "Label Example",
type = "panel", visibility = 1,
height = 250, width = 500, xr = 250, yr = 50})

void = uiLabel(MainWin, {name = "LB1",
text = "Two line"nmessage", flags = "l",
height = 50, width = 500, xr = 0, yr = 25})

void = uiBut
ton(MainWin, {type = "button", name = "PBE",
text = "Exit", xmath = "DoExit",
height = 30, width = 50, xr = 225, yr = 200})

return;
endIf


void = uiDestroy(T);
return;

endCommand
0 Kudos
Message 4 of 7
(8,811 Views)
Dear Carl, I will try your example when I return from my summervacation. However, I already new that "n is used to format a newline in a textstring and I trust you that it can be used in uiLabel. But what I wanted to use was uiText. Since with uitext you get a scrollable window where all the text that has been displayed can be retrieved using the scrollbar. My tests using uitext and "n didn't work. If it worked it would be a nice solution for me.

Over and out ...
0 Kudos
Message 5 of 7
(8,810 Views)
Torbjorn,
Hope you enjoy your vacations. I looked into it and you are right the uiText does not respond to the linefeed character ("n). I found that it is necessary to have both a return and a linefeed. There isn't a special character for the return character instead you would use char(13). So a two line string would become:
"Line one"+char(13)+char(10)+"Line two"

Here is an example that you can try:

Command twoline {fragname, widgetname, instance}

alias T "twoline"

If (exist(fragname))
goto *fragname;
else
void = uiToolCreate(T)
MainWin = uiWindow(T, {name = "MainWin",
title = "PGUI Text Example", type = "panel", visibility = 1,
height = 250, width = 500, xr = 250, yr = 50})

void = uiText(MainWin, {name = "TF", flags = "m"
,
readonly = 0, height = 80, width = 450, xr = 25, yr = 50})

uisetvalue(T,"TF",{text="Two"+char(13)+char(10)+"line"});

void = uiButton(MainWin, {type = "button", name = "PBE",
text = "Exit", xmath = "DoExit",
height = 30, width = 50, xr = 225, yr = 190})
return;
endIf


void = uiDestroy(T);
return;

endCommand
0 Kudos
Message 6 of 7
(8,810 Views)
Thank you Carl!

I have now tried your example and it worked perfect. Perhaps you can add this solution to the list of things that can be improved in future releases.

Thanks once again!

/Torbjorn
0 Kudos
Message 7 of 7
(8,811 Views)