f



Static text box in GUI won't refresh after string is changed unless mouse is moving

Hello, 

We're building a Matlab GUI for interacting with a Simulink model that is running in the background. The idea is to execute the Simulink model from the GUI, use uicontrols to modify certain parameters and display model results using both axes and text boxes, while the Simulink model is running in the background. To obtain the results from the Simulink model we are using event listeners. In the GUI file there is a localEventListener callback function that provides updated results at every timestep. Within this function, we update the data for the lines that are plotted in the axes and also update the strings displayed in static text boxes. For reference, here is an idea of how the localEventListener function looks like:

function localEventListener(block, eventdata)
....
% get the application data
hf = findall(0,'Tag','figure1');
handles = guidata(hf);
....
% Get the data currently being displayed on the axis
xdata = get(handles.ad.lineHandles,'XData');
ydata = get(handles.ad.lineHandles,'YData');
....
% Get the simulation data
newdata(1) = block.InputPort(1).Data(1);
newdata(2) = block.InputPort(1).Data(2);
....
newXData = [xdata newdata(1)];
newYData = [ydata newdata(2)];
....
% Display the new data set
set(handles.ad.lineHandles,'XData',newXData,'YData',newYData);
....
% Update the max value of the dataset
maxVal=max(newYData)
set(handles.edit1,'String', num2str(maxVal));

The problem we are facing is that while the lines are updated in the GUI just fine, the string in the static text box changes only if the mouse is moving. So I wonder if this is a known bug or if we are doing something wrong. For the record, we are using version 2008b on RHEL5.

Any help/suggestions will be greatly appreciated!

Thank you,
Aris
0
1/29/2010 7:19:07 PM
comp.soft-sys.matlab 211266 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
563 Views

Similar Articles

[PageSpeed] 24

Hi,

Try placing 

drawnow;

after the you update the text with 'set'

Cheers,
Lucas

"Aris " <ababajim_removethis@gmail.com> wrote in message <hjvcbb$o04$1@fred.mathworks.com>...
> Hello, 
> 
> We're building a Matlab GUI for interacting with a Simulink model that is running in the background. The idea is to execute the Simulink model from the GUI, use uicontrols to modify certain parameters and display model results using both axes and text boxes, while the Simulink model is running in the background. To obtain the results from the Simulink model we are using event listeners. In the GUI file there is a localEventListener callback function that provides updated results at every timestep. Within this function, we update the data for the lines that are plotted in the axes and also update the strings displayed in static text boxes. For reference, here is an idea of how the localEventListener function looks like:
> 
> function localEventListener(block, eventdata)
> ...
> % get the application data
> hf = findall(0,'Tag','figure1');
> handles = guidata(hf);
> ...
> % Get the data currently being displayed on the axis
> xdata = get(handles.ad.lineHandles,'XData');
> ydata = get(handles.ad.lineHandles,'YData');
> ...
> % Get the simulation data
> newdata(1) = block.InputPort(1).Data(1);
> newdata(2) = block.InputPort(1).Data(2);
> ...
> newXData = [xdata newdata(1)];
> newYData = [ydata newdata(2)];
> ...
> % Display the new data set
> set(handles.ad.lineHandles,'XData',newXData,'YData',newYData);
> ...
> % Update the max value of the dataset
> maxVal=max(newYData)
> set(handles.edit1,'String', num2str(maxVal));
> 
> The problem we are facing is that while the lines are updated in the GUI just fine, the string in the static text box changes only if the mouse is moving. So I wonder if this is a known bug or if we are doing something wrong. For the record, we are using version 2008b on RHEL5.
> 
> Any help/suggestions will be greatly appreciated!
> 
> Thank you,
> Aris
0
2/24/2010 10:29:19 PM
Reply:

Similar Artilces:

2008 r5 won't finish build unless mouse is moving
I have 4.2 and just updated to 5.0. When I run any program, the status bar gets to 100% (building 'My App') and won't continue unless I start moving the mouse. I also noticed that on one of my programs that sends/receives data over the net, that it also won't function unless the mouse is continually moving. Ver 4.2 works fine.......... In article <111220080058360787%nospam@dslextreme.com>, JB <nospam@dslextreme.com> wrote: > I have 4.2 and just updated to 5.0. When I run any program, the status > bar gets to 100% (building 'My App') and won...

Willie won't, Willie won't, won't go!
Ah yes, some 70s nostalgia tunes. ...

Mouse won't change (onmousedown="this.style.cursor='different'")
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting seems to be ignored completely, even when I try with window.setTimeout. So my two questions are: (1) Most important: Is there anything I can do so that I don't have to wait for the next mouse event before the cursor gets repainted. (2) Why is this not working for Opera at all? The page below can also be found at http://csaba.org/demos/revert.htm Things I have tried include window.setTimeout for the cursor change, putting in a <STYLE> section and trying to change the cursor by means of changing the class, faking a mouse event by putting in a fireEvent to simulate a mouseMove. Same behaviour as above for all attempts. This problem also happens on the other side. That is, in a situation where I have changed the mouse cursor on the down click (subsequently to moving the mouse) and then I want to revert it on a onmouseup, I should move the mouse before the cursor changes. That's not nice. Thanks for any tips, Csaba Gabor from New York <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <META http-equiv="content-type" content="text/html;charset=iso-8859-1"> <TITLE>Cursor changing demo</TITLE> </HEAD> <BODY bgcolor=gold style="margin-left:5%;margin-top:10%&...

Change the text of a 'Static Text'
Hello, I work now at a GUI in matlab. And I have the following code (function) for a Button Callback: function Button_Callback(hObject, eventdata, handles) set(handles.Status,'String','Busy!'); .... %.. some code that requires several seconds .... set(handles.Status,'String','Idle'); handles.Status is the handle for a StaticText control. What I want to do is to change the Text(Label) for the static text at the beginning (in "BUSY") and when everything is done to change it to "IDLE". My problem is that the Label/Text is changed only at t...

Files won't display, directory won't delete, drive won't format
After having a few slow-access problems, I ran a virus scan (McAfee) on my D: drive (second HDD, 15Gb). To my surprise, the scan listed a directory and files which I didn't recognise: I didn't note any full pathnames, but a typical one was something like D:\RECYCLER\S-1-5-21... Dd159.zip . I wondered if this was anything to do with the Recycle bin, despite the fact that I'd emptied it immediately before the scan. No viruses were detected, but when I ran an error check I got the message "the scan could not be completed". As a precaution I decided to ba...

Why doesn't the 'ButtonDownFcn' of my static text box get activated when it is located above a frame? (Solution Number: 1-19EAA)
from jrobinson@sara.com: Here is a work-around I used, for MATLAB 7.3: %Edit text with Max=2 causes problem in MATLAB Solution Number: 1-19EAA hEdit = uicontrol(hFig,'style','edit', 'Max', 1); set(hEdit, 'ButtonDownFcn','Soln_1_19EAA_CB'); function Soln_1_19EAA_CB hEdit = gco; set(hEdit, 'Max', 2); set(hEdit, 'Enable', 'on'); set(hEdit, 'ButtonDownFcn', ''); return ...

Text suddently moves tot he right margine, won't move back.
Sometimes text moves to the right side of a field. Running XP SP3, Eudora 7.1.0.9, and Agent 1.93. I have Hebrew, Arabic, and Russian alphabets enabled, the first two you know are written from right to left, but in an effort to stop this, I removed key sequences that were usable to change to those alphabets. (So now I don't know how to change to the right alphabet even when I want to.) (In Text Services and Input Languages, which comes from Regional and Language options, which comes from the Control Panel) This occurs mostly or entirely in two programs, i) ForteAgent ...

Text suddently moves tot he right margine, won't move back. #2
Sometimes text moves to the right side of a field. Running XP SP3, Eudora 7.1.0.9, and Agent 1.93. I have Hebrew, Arabic, and Russian alphabets enabled, the first two you know are written from right to left, but in an effort to stop this, I removed key sequences that were usable to change to those alphabets. (So now I don't know how to change to the right alphabet even when I want to.) (In Text Services and Input Languages, which comes from Regional and Language options, which comes from the Control Panel) This occurs mostly or entirely in two programs, i) ForteAgent ...

Karmic Krapware: "no sound...no video... lost the GUI... USB stick won't work...won't shutdown properly"
"All upgraded OK, but then noticed no sound, and no video. After following some online advice with hardware drivers tried to update Nvidia, and I then lost the GUI. Can get back by editing out Nvidia for Vesa in xorg.conf, but have to each time I start, and graphics too low to run much. Was going to back a few things up and re-install Jaunty, and now find USB memory stick will not work. Tried downloading and installing latest Nvidia driver, but got lots of error messages regarding kernels and headers that I can't resolve. Now will not even shutdown properly." #764 at http://ubuntuforums.org/showthread.php?t=1305924&highlight=Karmic+freeze&page=77 Linux is a never-ending litany of woes. You almost have to feel sorry for the hobby-slopware victims. Then again, it's just their playtime toy tinkering that's being ruined. "DFS" <nospam@dfs_.com> writes: > "All upgraded OK, but then noticed no sound, and no video. After > following So after the OK upgrade he "then" noticed no sound or video. Wow. What an astute guy! On Sun, 08 Nov 2009 15:07:12 +0100, Hadron wrote: > "DFS" <nospam@dfs_.com> writes: > >> "All upgraded OK, but then noticed no sound, and no video. After >> following > > So after the OK upgrade he "then" noticed no sound or video. > > Wow. > > What an astute guy! Maybe he is deaf and blind? They seem to be...

Vertical alinement of text in a GUI 'static text' object
Hi to all, I have problems to verticaly aline text in GUI's 'static text' objects. For example, if the height of the 'static text' is set to 25 pixels and the font size to 12 the text is not verticaly centerd. While there is a property for horizontal alinement, I found no such property for vertical one. Can someone help? Thanks, Utzli ...

Why can't I move text strings any more ?
in the original GUI it is possible to place an arbitrary numbers of text strings on top of the canvas graphics. This feature is used to place titles, and captions before printing/saving the image. Text strings are added by pressing <Shift><Button3> and can dragged and deleted as follows: *********************************************************************************************************************** bind $base.canvas_field <Shift-Button-3> {put_text %x %y} bind $base.canvas_field <Shift-B3-Motion> {nothing_moving %x %y} bind $base.canvas_field <Control-Button-3> {delete_text %x %y} bind $base.canvas_field <Button-3> {text_start_move %x %y} bind $base.canvas_field <B3-Motion> {text_move %x %y} proc put_text {scr_h scr_v} { global plot global text_info global yscaling set text_info(h) $scr_h # set text_info(v) $scr_v set text_info(v) [expr $scr_v/1.0] # HARMLESS DIVISON REPLACING A FAILED ATTEMPT if { $text_info(frame) == "" } { set text_info(frame) [toplevel .text_info_frame -bd 2] wm title $text_info(frame) "Text" text_info_ui $text_info(frame) } return } proc delete_text {scr_h scr_v} { global plot global text_info global yscaling set scr_v [expr $scr_v/1.0] # HARMLESS DIVISON REPLACING A FAILED ATTEMPT set res [$plot(canvas) find closest $scr_h $scr_v 1 txt] if { $res != "" } { for ...

I don't understand why this Swift 2 String() won't init
I have this code in an os x playground (XCode Version 7.2 (7C68)): let urlString = "https://news.google.com" let url = NSURL(string: urlString)! let listData = NSData(contentsOfURL: url)! var dataString = String(data: listData, encoding: NSUTF8StringEncoding) print(dataString) and what seems to me to be equilivent code in an OS X app I'm building: static func httpRequest(urlString: String) -> String { if let url = NSURL(string: urlString) { if let urlData = NSData(contentsOfURL: url) { return String(data: urlData, encoding: NSUTF8StringEncoding) ?? &quo...

windows.location won't refresh on change...
Hello, I am trying to do a function to force a redirect with new query string (depending on when a user clicks a radio button so it triggers on onClick). When I call the function I can see (in Firebug) it sets the new query string variable correctly but the page won't refresh or set the new URL. I set the query string with: var queryString = "?Dealer="+Trim(dealer)+"&seed="+Math.random(); I added the seed value to ensure this wasn't a cache problem. Anyhow, when I call: window.location.search = queryString; it ignores the command. You can see it hit the...

Matlab GUI: displaying a Transfer Function in a static text box
I want to display a tranfer function in a static text box. In my first attempt I coded everything and that worked fine but is sometimes difficult to read because everything is displayed, even the values that are zero. I now would like to use the tf-command. I wrote something like this to test: text=tf([1 1 1 1 1],[2 2 2 2 2 2 2]); set(handles.text1,'Value',text); but that doesn't work. I changed 'Value' to 'string' but that also doesn't work. anyone has any ideas? thanks in Advance "RobuLAB " <amaury.ampe@etu.u-bordeaux1.fr> wro...

my gui text won't update during the execution of the code
hi i have a piece of code like this in my gui mfile set(handles.text4,'String','Done!') when i debug the code step by step, it updates the text in my text box but when i run the whole mfile it won't update! help me! /M You need to repint the GUI. Try refresh or put in a small delay pause(0.25). Both should work Ed -- ------- Ed May pestMay@gmail.com pestMay wrote: > > > You need to repint the GUI. > > Try refresh or put in a small delay pause(0.25). Both should work > > Ed > > -- > ------- > Ed May > pestMay@gmail.com > draw...

'GUI-Edit text ui control'-Way to detect mouse click in the edit text
Hi I am designing a graphical user interface. I have an edit text box. I would like that when a user double clicks inside the text box a new window open up with the options of inserting the text, else user can himself enter the text from the keyboard. The problem is that I am struggling to find a way to detect the mouse click inside the text box. I know about 'keypressfcn' but I suppose that does not check the mouse click. Please help me in this regard. Thank you in advace. Sumit "Olivier " <sumit.iitkgp@gmail.com> wrote in message <hq6ca7$r79$1@fred.mathwork...

DVD Won't Enter, Won't Exit
Greetings, all. Long time no see. I have an iMac G5 c. Dec. 2004. A few minutes ago, I inserted a DVD, but it seems not to have mounted in the drive. The disk is just barely too far inside the machine to reach. It's not visible from the outside at all. I've gently tried to insert a second disk, hoping to push the first one all the way in, but it won't budge. I tried restarting the computer with the eject key depressed, and heard the drive trying to eject something, but, again, the disk didn't seem to move. Any ideas, short of reaching in there with a pair of tweez...

4000T won't boot won't POST
I've had this problem for a while. Repair guys (no longer servicing Amiga's) said it was a problem with the motherboard not posting. (I believe this is a PC term) Said he got it working somehow by by-passing SCSI and using only IDE. But when returned it still did not work. Even with a new Power supply, nothing seems to power up. Even the floppy doesn't 'flick' (that funny noise it makes upon power-up) Any help appreciated. thanks Phil "Phil Bastien" <pbastien@nnby.net> ha scritto nel messaggio news:c9qtlu0na3@enews1.newsguy.com... > I've had this problem for a while. Repair guys (no longer servicing Amiga's) > said it was a problem with the motherboard not posting. (I believe this is a > PC term) Said he got it working somehow by by-passing SCSI and using only > IDE. But when returned it still did not work. Are you using an X-Calibur accelerator? It is incompatible with the A4091 and, with my configuration, it hangs just after loading its software, when it resets the Amiga. I am curious about how to bypass the SCSI controller in the A4000T... -- ___ __ / __|___ Daniele Gratteri, Italian Commodore-Amiga user... /// | / |__/ Nickname: FIAT1100D - ICQ: 53943994 Ritmo S75 __ /// | \__|__\ Home page: http://www.gratteri.tk forever! \\\/// \___| E-MAIL: daniele@gratteri.tk ...since 1990 \/// ...

Report: Text box won't print or repeat in page header.
Hello all, I have a text box in the page header of my Access report that takes a dynamic string value from a named text box on an open form as its control source, written as follows: =Forms!frmExtractResInfo!txtSelectionCriteria Two problems/situations occur: 1) It previews OK, but it isn't present when printing to hardcopy or a ..pdf file. 2) The text box is in the "page header" portion of the report, yet only shows up on the first page. Everything else in this portion of the report displays/prints to each page just fine. I'm pulling my hair out trying to figure out...

korganizer icon won't 'stick' in sys. tray upon start-up.
Running new Kanotix, kde 3.4.x I open korganizer (calendar) and I get the blue icon (with bell) in system tray. I right click to start daemon at start-up. I have KDE session manager set to "restore previous session'. I logout and back in and no icon... no calendar. I also tried setting it it "restore manally saved" session but that didn't work either. Is there some setting I forgot? Is there something I need to do to make this 'stick' ???? It works on my Debian box, but not on this laptop. Thanks, Al ...

Access 2007 Special Effect Text Box Won't show Sunken with Windows XP
Hi All I am just getting to grips with Access 2007 and one of the quirks I have found is that when I design using Windows in XP Windows-Classic colors and set the text boxes on forms' special effect property to "sunken" They appear as sunken in the correct manner. However, when I change to the Windows XP color scheme the forms text boxes appear flat even though the special effect property has not changed. Any ideas or is it a new quirk we have to live with. I haven't tried it with Vista yet. That should be interesting Thanks Bob I am quite sure this is the same for acce...

changing tag in gui doesn't change callbacks
I changed the tag of a edit box on my gui (from 'edit_stim_phase' to 'edit_stim_start'). Contrary to what the Matlab help says, the associated callback functions were not renamed after running the gui. When I renamed them myself and ran the gui, Matlab generated an error message, saying that it could not find 'handles.edit_stim_start'. Setting a break point in the OpeningFcn and querying handles showed that it still contained a field called 'edit_stim_phase', instead of the new 'edit_stim_start'. Should I change something else? Jan Make sure...

NSPopUpButtonCell or it's view won't refresh
This problem is driving me nuts and I have yet to understand what's wrong with it. I've changed this problem up a bit to simplify it and it's strange. As soon as I create these header cells, I'm always getting one more header than I need, yet it's not a header, but appears to be one. It's like a ghost header/text only after the last column. It's just the text and not a control header cell than I can click on like the others. I've inspected my createHeaders: method (below) as I run the program and it's creating the proper number of headers and columns, yet it's always adding the appearance of one extra even though the NSTableView numberOfColumns returns the correct number of columns. It's like the NSTableHeaderView is not being refreshed. Another side affect of this problem is that when I make a selection on the NSPopUpButtonCell menu items, the new selection just overlays the old text (the old header title), so it's text on top of text and makes it unreadable. Here I've added all the code that creates my NSPopUpButtonCell's as headers of each column and adding columns to the tableview. I see nothing wrong with it. It all works fine with the exceptions above. Also in this problem, I've subclassed NSPopUpButtonCell and am wondering why drawInteriorWithFrame: is getting called 5 times, because that's how many titles headers I see in my view, although I have only created four. @interfac...

database layouts won't print, now database won't open
using Mac OS 10.3.4, filemaker pro 7. working with a database converted from filemaker 3. Everything seemed to be fine. Created a new table and imported data into that from another Filemaker 3 database (someone else created these). Layouts were created very easilly. I go to print a layout (label) and choose ALL and it will only print one record, no matter what I put in the print dialogue box. Open other databases and they all printed fine in similar layouts. Tried to "recover' it, thinking it was somehow corrupted (the woman was having a hard time printing it. I thought it was...

Web resources about - Static text box in GUI won't refresh after string is changed unless mouse is moving - comp.soft-sys.matlab

Resources last updated: 3/16/2016 2:41:30 AM