I currently have a HList set up so -browsecmd calls a subroutine when ever an entry is selected. I would now like to have a subroutine run when the user unselects an entry.
I have tried to google for this, but I have had no luck so far.
It's -browsecmd, too. The callback is executed whenever a user browses the HList. This also happens when unselecting an entry.
Using my #selected_items = $hlist->info('selection'); you can then access the currently selected items.
There is a complete example here (last example): http://www.perltk.de/tk_widgets/wtk_hlist.html
Related
I am trying to create a Hierarchical block using the GNURadio Companion GUI. Answers I've found in other posts say to select the blocks you want to incorporate, then go to More -> Create Hier. Then a new screen is supposed to appear. However, doing "Create Hier" with any combinations of blocks selected seems to do nothing.
Am I doing something wrong, or is there a problem with my GRC?
It's very simple. You just start with a new flow graph in GRC, and use Pad Sources as input, and Pad Sinks as output.
If you want to let the user configure something, use a Parameter GRC block.
You must set the Generate Options in the Options block to Hier Block, and set a sensible ID there, too – don't stick with top_block, but use something (without spaces or -; it needs to work as a python name) that won't conflict with something else.
Here's an example:
You can then Generate button (or press [F5]), and then, after you've done a rescan of your block library with the refresh button you can find (and use) your new block in the Block Category you specified.
This is the first time I'm encountering GetLayoutObjectAttribute and I am having serious issues with it. My variable $web won't set. I think it's because PD_WebV isn't the right object name to refer to, but I don't know how to find the right object name. I can't find the objects name when I hit Edit Layout, so does anyone know how to find an layout objects name?
Loop
Pause/Resume Script [Duration (seconds): 1]
Set Variable[$Web; Value: GetLayoutObjectAttribute("PD_WebV";"content")]
If[$Web="done"]
#execute if statements
After Edit:
After some troubleshooting, I found out that PD_WebV is the right object name to refer and it's refered to correctly, so my new question is why doesn't the script go to the line If[$Web="done"] and how could I fix it? Ss my If statement not evaluating something it should be? Is my $web variable never set to done or is the issue something completely different? Would the problem possibly have to do with my WebDirect sharing settings? Any guidance would help. Thanks.
After, After Edit:
So now that my application is getting past Set Variable[$Web; Value: GetLayoutObjectAttribute("PD_WebV";"content")], the variable $web only equals <HTML></HTML>. Does anyone know a way, without using javascript, to test the inside of the html tags?
Also, I printed the bounds of the webViewer PD_WebV that I can't locate on the layout but am referring to in the script. The bounds that are printed are different each time I run the script. Is the usual or unusual? My source is also about:blank so it doesn't look like I'm sourcing from a URL
Is my $web variable never set to done or is the issue something
completely different?
If you're doing:
Set Variable[$Web; Value: GetLayoutObjectAttribute("PD_WebV";"content")]
then the only time
$Web="done"
will return true is when the web page loaded into your web viewer contains exactly the string "done" (in practical terms, that's never).
I have already suggested in a comment that you test for:
PatternCount ( $webpage ; "</html>" )
This is assuming you want the subsequent steps to execute only after the page has finished loading. The entire script would look something like this:
Loop
Pause/Resume Script [Duration (seconds): 1]
Set Variable[$Web; Value: GetLayoutObjectAttribute("PD_WebV";"content")]
Exit Loop If [ PatternCount ( $webpage ; "</html>" ) ]
End Loop
# execute statements
You might also want to add a counter to the loop and exit the script after n trials.
Ah, I reread your question.
To set the object name for your webviewer so that the GetLayoutObjectAttribute function works you need to set it in the Name field in the inspector when you have the webviewer selected.
e.g.:
After that your variable should populate.
Be aware
What it will populate with will be all of the html from the browser, i.e. not a boolean true/false liek your conditional suggests.
I'm not sure exactly what you're trying to accomplish, but to be able to determine a result from your web viewer you'll need to either parse the HTML to see if it's content contains what you're looking for or within the code you're setting the webviewer with, fire a javascript function that calls back to the FileMaker file using a FileMaker url.
I have a small form that my colleagues and I often fill out that can be seen here, with source code (view-only) here. The spreadsheet that this form posts to can be seen (view-only) here.
Basically, the apps script is solely for preventing my coworkers from having to scroll through thousands of rows of a spreadsheet (this is also used for our film collection) to check in/out inventory. It will also, soon, post detailed history of the checkout in an audit spreadsheet.
I have attempted, with no success, to clear the values of the text fields after the data has been posted to the spreadsheet. What I essentially want to do is restart the GUI so that the fields are once again blank.
I have tried accessing the text fields by id but the return type is a Generic widget, which I of course can't do anything with. And since control is passed to the handler functions, the text fields can't be accessed, or at least I can't figure out how (and I looked through the documentation and online solutions for hours last night).
So the question: how can I erase/clear the values of the text fields in the GUI after values have been posted to the spreadsheet? (return from handler function to access text fields again, or restart the GUI?
I can accomplish restarting the script runs on a spreadsheet, but I have not been able to do this when it is embedded in a Google site.
The getElementById('xxxxx').setText('') approach was the right way to do it. but the way you tried to test it doesn't work... the new value would only be available in the next handler call.
/*
This function only has the desired effect if it is called within the handler
function (not within a nested function in the handler function).
*/
function restartGUI() {
var gui = UiApp.getActiveApplication();
gui.getElementById('equipmentIDField1').setText('');
gui.getElementById('equipmentIDField2').setText('');
gui.getElementById('equipmentIDField3').setText('');
gui.getElementById('studentLastNameField').setText('');
gui.getElementById('labasstLastNameField').setText('');
return gui;
}
I'm using Watir WebDriver. I'm new to ruby.
The following dropdown list is always present. It fails unless I precede it by sleep(1). The developer said that the dropdown is not populated until the previous controls are set.
Which of the Wait commands do I need for this? I think in Selenium I waited until the hidden contents of the list contained the value that I wanted, then I selected that value.
def enterCompany(company)
#browser.select_list(:id, "ddlCompanyName").select(company)
end
A question was just asked of me offline on this one, so I wanted to provide an updated answer for the latest Watir versions that avoids the deprecated #when_present method:
browser.select_list(id: 'ddlCompanyName').wait_until { |el| el.include? company }.select
You can use the when_present to wait until the option is present before selecting it. Basically, Watir will wait up to 30 seconds for the option to appear. If it appears sooner than 30 seconds it will proceed with the action (ie select). Otherwise, a timeout exception is thrown.
#browser.select_list(:id, "ddlCompanyName").option(:text => company).when_present.select
Note that the above assumes that company is the text of the option.
Another option is to wait for anything to appear in the dropdown.
#browser.wait_until{ #browser.select_list(:id, "ddlCompanyName").options.length > 0 }
If I use console.log to log an object from inside a script, I can see that object in the console, and I can inspect it by clicking the little arrows. So I can see what methods it has (even in its prototype). But is it possible for me to run one of those methods from right there in the console?
In other words, is there some kind of magic variable (similar to $0) that I can type into the console, which will get me the last logged object?
You can actually use $_ to get the previously evaluated statement
$$ // Returns an array of elements that match the given CSS selector.
$0 // The currently-selected object in the inspector.
$_ // The previously evaluated statement
$1 // The previously-selected object in the inspector.
$n(index) // Access to an array of last 5 inspected elements.
For a complete list of everything there is that you can use for all parts of chrome check out the cheatsheet. http://anti-code.com/devtools-cheatsheet/
There is no such magic variable for objects logged via console.log at the moment. Please file a feature request if you need one: http://webkit.org/new-inspector-bug