Asynch GUI updates in Smalltalk - smalltalk

I wondered if anybody could help me with a technique to address the following problem in Smalltalk. Specifically Cincoms Visualworks.
I would like to code a simple GUI that has three fields and processes them as follows:
The first field inputs a number (5 say).
The second field simply displays twice the first field (so it displays 10 in this example)
Now, the interesting bit... the third field displays a value from a completely different class (let's call it class X). However, the value must be displayed on the GUI whenever that value in the class X changes - it mustn't wait for a key press from an update button. The value in class X could be sourced from (say) the workspace.
I though I could do this via aspect adaptors but I can’t seem to get the 'third field value' to update asynchronously.
Any techniques, hints or tips will be most warmly welcomed - (especially code snippets!!).
Thanks
Kevin

I've sorted this myself. After trying the dependency mechanism (works fine - but simply not needed), looking at announcements (thanks James at Cincom - personal communication) I found that all I needed to do was to simply create a method and send it a message with a parameter (my value) that method then simply updated the value holder (i.e. the aspect of the GUI field) with the "value:" message. The more I look into Smalltalk the more I like it!

Related

Intelij extract method keeps trying to replace duplicate method signatures - please stop

Intellij has a really neat feature, that lets me seamlessly extract a block of code into its own method. I can then give this method a nice, descriptive name and move on with life.
However, intellij also tries to find other blocks of code that are similar, and then tries to perusade me that I should also refactor them too, to use this new method its made. And then, when I hit the oddly-named "cancel" button (which implies the whole operation is cancelled, but it's not, it just stops asking about any remaining blocks), it leaves me looking at whatever the block of code it last asked me about.
I really don't like this feature. Here's why: If I'm say comparing two ints - the naming of the code block will depend on the context of those two ints, but intellij will find any comparison between two ints anywhere in that file, and then insist that this is also a candidate for extraction.
Most times it is not, and to make it worse, when I ask intellij to stop it, in a fit of pique, leaves me wherever the last comparison was, so now I have to navigate back to where I was working.
How do I tell intellij just to extract exactly what I selected, and do nothing else?
Please follow/vote/comment the issue created for this usability problem at YouTrack:
https://youtrack.jetbrains.com/issue/IDEA-233201

Resetting integer (DS) to 0 in Ladder Logic for PLC (Koyo's Click PLC)

I'm not sure if this is the good website for ladder logic programming questions but I will it a try.
I'm using a Click PLC C0-01 DR-D by Koyo (Desc page: http://www.automationdirect.com/adc/Overview/Catalog/Software_Products/Programmable_Controller_Software/CLICK_PLC_Programming_Software) with it's free software. I'm trying to make a program in Ladder Logic to executes multiples operations by the PLC. To keep track of the current operation, I use an integer value I'm incrementing as the current operation ID. However, I'm not able to reset this value to 0.
First I tried with the COPY but there's a radio button to ignore zeros. This radio button is checked and disabled (can't change it). . The documentation of the software says "Option: This Option is available when the Source is a Data Memory Register Address and the Destination is a TXT Address." But since I just want an ID and I need to compare this ID with = everywhere in my program and increment it, I don't want to put a string.
Then, I can use math to assign a formula to a variable. I tried put zero and it's working half the time. Note that the "One shot" checkbox isn't selected even if it may to be acting like so.
About this option, the documentation says "One Shot: Select One Shot to solve the formula only once after each OFF-to-ON transition of the enabling rung."
However, to be able to set the value to 0 again, I need to restart the PLC. When I first execute the program everything is fine because the value is already 0. When I restart it, the value didn't reset so it's still 7 and it skips all my operations. Then it resets to 0 (it's doing so at the end) and when I restart the PLC, I'm able to run it normally for one time.
Here an example of the current passing but the value not set:
Is it a bug from the PLC ? Is there a workaround ?
In short, I'm looking for a reliable way to set a value to 0.
Thanks in advance for the answers. Sorry If I violated 40 rules, I'm new and happy to join this community.
I though I resolved my problem but I just pushed it further. Thanks to Garry Shortt with his youtube channel dedicated to PLC programming for helping me out with my problem.
His explanation to the problem is "Changed the math to a copy command and placed it in the main program where you had it before. The program seems to work well.
The only thing that I can think of is when you use subroutines, and they are not being scanned. The items within the routine is the same unless you them changed in another part of your program."
Hope it will be helpful for someone someday.

Labview 2012 Passing Dynamic data into/out of a while loop

I'm trying to pass data which is continuously changed from the inside of one While loop to the inside of another While loop of a sub-vi. The main program on the left is constantly reading new data and the program on the right is adding 1 to the new value. My issue is that I cannot input new values to a While loop which is already running and thus my sub-vi is never updated. I've tried a global variable ("write" from the main program control and then "read" into the sub-vi) but that doesn't work either (same result as if the main were just passing data into the sub).
I apparently don't have enough reputation to post a picture of my program but I'm basically trying to run parallel loops (almost inside each other). Can anyone lend me an experienced hand?
The most common problem with while loops are based on lack of knowledge how exactly does the while loop work in LabVIEW.
First of all the information will be given outside the loop only if the condition terminal (right down corner of the loop) will be flagged as true.
If you want to pass the data earlier (while the loop is running) you have to choose easiest option:
Use queue (is the most common and well working). I can elaborate how this one work in practise if you want, or just try to run an example from LabVIEW help.
local/shared variables - you can define in your own library variables and pass the data by READ/WRITE option.
Please try to upload some documentation to an external server (as you are blocked here), and post a link, and then I could help you with a specific example.
Help»Find Examples. Search for "queue". Pick out an example with parallel loops.
You might want to look into Queues or Notifiers as means of passing data between running loops.

'Watcher' program for messageboxes

I am trying to brainstorm how to go about creating a program that will be actively running alongside my application and will watch for messageboxes to be shown in the application and take all the information(text, buttons, parameters) included with that messagebox and house them as an object in a global variable available throughout my application.
Is there anyway to tell programatically in my application that a messagebox is about to appear and to take any information related to it and place it in an object? Aside from having to scan the code, which isn't what I'm looking for especially since there's many places messageboxes will appear, this would give incorrect information.
Or is there a better way to go about this? All I'm looking for is information associated with the messagebox that is about to appear(and not show the messagebox then)
Any tips or websites I could reference is greatly appreciated!!!
Create your own class that takes in the same parameters as the standard messagebox.show and then calls the messagebox.show passing the parameters on. When you are ready, you can then put some code before the standard call that will capture the information.
I always create my own messagebox.show so I can control it. It's nice to have a standard title and there maybe time that you need to do special stuff with it, like log the messages.
BTW, because of scoping, if your class is in the same project, yours will be used instead of the standard, unless you fully qualified it: system.windows.forms.messagebox.show().

Field labels on repeated grids - Orbeon night-build

I'm new to both Orbeon and XForms and please forgive me for asking help on a version not yet released.
I am building an application that requires repeated blocks with multiple fields. The client wants to be able to use the form builder in the future to update the forms so manual xforms programming is out of question. At the moment I am using the night-built version of orbeon which supports repeatable grid, hoping that it will be included in the next release soon.
A problem I ran into is the lack of support of labels inside the grid. The forms builder does not allow input of lables to the fields. When I manually edit the source and put in the labels in the resources section, the labels are not visible except the first row of fields.
My first question is whether this is the intended behavior for the eventual release version? If so would it be possible to make it overridable by using a runner property?
Now the client is willing to accept some minor editing in the source code. Is there a simple way to make the (mnually input) labels visible? Some CSS code perhaps?
All information would be much appreciated.
regards,
Jeff
This is not the intended behavior. As you have noted the new builder is not yet in a stable version and the code is very much in flux at this time.
The idea is that if each repeated group of rows contains only one row, then the labels of the fields will appear as table headers. This is the behavior of the current Form Runner repeater. See for example:
Now if a repeated group contains more than one row, then the labels of the controls should probably be within the grid cells themselves, as it doesn't make sense to put the labels in table headers in this case. But note that this scenario is not implemented yet.