As a REBOL newbie, I'm really finding the HELP command useful, and I've found a lot of great documentation online. That's really not so true for REBOL/View, though. The REBOL/View VID Developer's Guide is good, but not easy to find answers in.
For example: It took a while, but I figured out how to put information in a text-list by setting its DATA to a block. Now, when the user selects something from the text-list, I'd like to know what was selected. My best estimate is that it will take me one or two hours to figure that out.
Is there any correlate of HELP for REBOL/View? Or just anyplace I can find a list of the values I can get or set for each style?
All the documentation is on http://www.rebol.com/docs/docs.html page, see "Graphical Programming" section for View. Unfortunately View documentation is not that complete.
I usually use this method:
view layout [t: text-list data ["a" "b" "c"] [? t]]
When you click on the text-list, all its properties will be printed out on console. So you can easily find what you need.
In this example, you can see there is a "picked" property,
view layout [t: text-list data ["a" "b" "c"] [? t/picked]]
>> T/PICKED is a block of value: ["b"]
>> T/PICKED is a block of value: ["b" "c"] ;multiple select using ctrl
So you need to pick the first item in the list:
view layout [t: text-list data ["a" "b" "c"] [print first t/picked]]
You also check the document http://www.rebol.com/how-to/fields.html
view layout [
text-list "Red" "Forest" "Blue" "Gold" "Teal" [
f-color/text: copy value
f-color/font/color: get load value
show f-color
]
f-color: field "Pick a color"
]
The doc on View is correct for basics (see http://reboltutorial.com/bookmarks/rebolvidtutorial). But it's very difficult to go beyond that because there are no ADVANCED documentation with samples. So I rarely use VID though I'd like to.
the main page for the view system is: http://www.rebol.com/docs/view-system.html
it links to all the other reference guides related to vid/view.
it took me a while to find it so I bookmarked it.
Related
I'm very new to Ruby, Selenium, and UI automation, and have a quick question on how to get a count of visible items in a drop down menu.
Example: I have a drop down menu of 10 currency values (USD, EUR, JPN, etc.). They're coded as:
<div class="list_item">Currency Symbol</div>
The drop down menu is searchable, and if I type in "USD", then the only visible item would be that particular currency value. All other div of that class get a style="display: none;" attribute. How do I verify that that USD indeed is the only item in the menu? An example of such a situation can be seen here: https://www.oanda.com/currency/converter/
Conceptually, I was thinking of doing this:
Iterate through each div tag with class=List_item, and if I find one that has a display, count it. Then verify if it equals to '1'.
I tried using find_elements but can't seem to find attribute within each element in the array (is it because they aren't webdriver objects?).
If there's another better approach, it'd be really good to know and learn more as well. Appreciate any responses.
So, in this particular example, you could do
#driver.find_elements(:xpath, "//div[#class='currency_dropdown']/div[#id='scroll-innerBox-1']/div[not(#style='display: none;')]").size
This should return 1 when USD is typed into the search field.
Edit: I recommend getting ChroPath for your preferred browser (FF or Chrome). It helps significantly when testing xpath.
I am working on my first Windows 8 Metro app. I have worked a LOT with Silverlight and I am familiar with the Metro concepts. My challenge is, I know I want to create a "Section" page as defined here: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh761500.aspx. Or, to put it another way, like the sample "Finance" app where "TODAY", "INDICES", "NEWS", etc. represent sections. But, I can't figure out how a "Section" page is defined in XAML.
I was expecting it to be similar to a tab control where each section is defined as a child of the parent control in the "Items" collection. However, I can't seem to find a solid example. Does anyone know an example they can point me to? Or a walkthrough online?
Thank you!
Try using a frame in your "master" page, and then adding other pages to that frame. A section in this paradigm is just a normal page. Most of the samples here in MSDN uses this type of design, with a master page displaying different sections, based on a selected item in a listview.
By clicking search button in toolbar, advanced search window is opened.
In first row it contains combobox with selections AND and OR
How to replace those words with words in other language in this window ?
The problem with localization is the bug in the lines where jqFilter method will be called by searchGrid method. The method jqFilter supports groupOps option which are already set in many localization files grid.locale-XX.js, but the jqFilter method will be called without setting of the option.
To fix the problem one should just add
groupOps: p.groupOps,
to the list of options used in the call of jqFilter method. You can search for the text ).jqFilter({ in the jquery.jqGrid.src.js or in the jquery.jqGrid.min.js to find the corresponding place. In jquery.jqGrid.min.js of jqGrid 4.3.1 the p is renamed to f so one have to use groupOps:f.groupOps.
How you can see on the demo the grouping operation in the Advanced Searching dialog will be localized after applying the fix:
If your localized version of grid.locale-XX.js don't contains the texts for AND and OR operation you can set there manually
$.jgrid.search.groupOps = [
{op: "My And", text: "my AND operation"},
{op: "My Or", text: "my OR operation"}
];
see the next demo:
Without the described bug fix you can follow my suggestion from the answer on the close question.
UPDATED: I posted the corresponding bug report to trirand. I hope that the fix will be included in the main code of jqGrid.
UPDATED 2: The bug fix is already included in the main code of the jqgrid (see here).
I'm using watir-WebDriver to automate a website test automation. I have to get to the Sibling link.
looks like this
Something > Something 2 > current page title
(link1) (link2) (text1)
I have the class id of the text1, and I have to go back to the Something 2 by clicking on the link2.
How do I get this.
I think you can get the sibling link with elements_by_xpath.
example
HTML source:
bar<p class="baz">text</p>
watir-webdriver script:
p(:class,'baz').elements_by_xpath('preceding-sibling::*')[-1]
If you can find a common parent for the two siblings, you can go to that parent, then select the element from that point using something like this:
source html:
<tr>
<th>No. of films</th>
<td>7</th>
</tr>
scrape (#b is the browser object)
#b.th(:text => "No. of films").parent.tds.first.text
#=> 7
If (text1) is a child of (link2) you might try:
(text1).parent
If I understand right you have some kind of container element like a like a div, and inside it are two links and some text. What is not clear is if the text belongs to the outer container, or is inside a container of its own. Given you say you have the 'classid' (is that the class? or the id?) of the text, I'm going to presume that it is in it's own container element.
In that case
browser.element(:class, 'value').parent.link(:index, 2).click
That's the best I can do without an actual sample of HTML, a clearer model of the DOM
As all the previous answer says, you gotta have a reference point above this hierarchy. Then browser.p(:id, 'known').parent.links[1].click would do the job. But if you really really don't, try this hopelessly simple approach:
browser.link(:text => 'Something 2').click
I am trying to show a module, but the article I want to show the module on is not linked to a menu item. Is this possible? Seems like a module can only show when it is a menu item. But I have a ton of articles that are not menu items - so what is easiest way to show the module? Any help would be greatly appreciated.
The way to do this is as follows.
Let's suppose you have a group of articles that you wish to all display the same modules on.
Create a new category using the "category manager" option from the content menu
Ensure all the articles are published into this same category.
Create a new menu which you won't actually ever display anywhere (I like to publish the menu into a module position which is not present in the template)
Add a category blog layout option to this new menu
Now go through each of the modules that you wish to display for the group and add them to the new menu item you have created.
Hope this helps!
This will be my first answer after getting so many help through stackoverflow without being a member.
I will just add something to buzzki's answer. Because i was almost loosing my mind until i figure out how to solve.
If you used an article in a module with an extension like mod_articleasmodule; it adds the aliases of articles on URL of Read More.
Simply change the line;
$link = "index.php?option=com_content&view=article&id=".$item->id.":".$item->alias."&catid=".$item->catid.":".$item->catalias;
to
$link = "index.php?option=com_content&view=article&id=".$item->id."&catid=".$item->catid;
to get the pure URL Link and your menu assigned by MetaMod will work. Also great thanks to buzzki for help.
While the {loadposition xxx} technique is very handy, what it won't do is to put the module into any of the "standard" module positions (e.g. left, right, banner, or whatever your template has).
If you want your module in one of those positions, a great method is to use MetaMod. MetaMod is a placeholder module, that includes other modules inside of itself according to rules that you set up.
So you can set it up with a rule that says, in effect, "if we are on article A, B, C, D or E, display the module".
if ($content_genius->check("article_id = 50, 51, 52, 53, 54")) return XXX;
// replace XXX with the module id to show on those articles
Now, if the number of articles is going to change regularly, you don't want to have to edit the MetaMod to change the list of ids. So another way is to use the Meta Keywords field in the articles to determine whether the module will appear. Then all you have to do is include that keyword on any article you want the module to appear on. Let's say the keyword will be "SHOWMOD".
So in MetaMod you can simply use this:
if ($content_genius->check("article_metakeywords contains SHOWMOD")) return XXX;
// replace XXX with the module id to show on those articles
In that way, the module will appear on every article page where the article contains that meta keyword. And the module position can be any position on the page (wherever the MetaMod is assigned).
Step 1: On the front end of your website, click to the specific article that you want, highlight and copy the URL.
Step 2: Create a menu item, item type is URL and paste your article URL in there. (You can have the menu item be in an unpublished menu i think)
Step 3: Select it from the Menu Items list in the module.
You simply name your module position whatever you want, say 'monkey' where your module offers a 'select position'. You actually type it in. Then in the article you want to place it in, you add
{loadposition monkey}
to any location of your article you want the mod to work in the html editor.
Follow these steps in your joomla site Admin panel:
Go to the module manager, open the desired module and give a unique name in the position field. If you want to use it also at other common position such as left or right, then first create a copy of this module and then for the new copy, create a unique position name. Example: custom1.
Create a new article preferably uncategorized. Give it the name of your module.
In the body area of the article type {loadposition custom1} and save your article.
Create a Menu link to this article in the desired menu. You should select 'Article layout.'
Thats all, your module will now load from the menu link directly.
This has an added advantage of giving you SEO prominance based on the meta info you give for this article.