How to get data from custom properties in UITestPropertyProvider - coded-ui-tests

According to the code sample on MSDN (http://msdn.microsoft.com/en-us/library/hh552522.aspx) any custom property data that you need to get out of your control should be in a semicolon delimited string in the AccessibleObject's Description property. This does not seem right to me at all. This seems like just a quick and dirty trick to get it working. What is the correct way to get the value of properties from custom controls? And if this actually is how you're supposed to do it, then how are you supposed to set those properties using the SetPropertyValue method? The example in the link above just throws a NotImplementedException in SetPropertyValue.

Since the IAccessible interface has only a limited number of properties the best solution is to cram any extra information into the Description property (that's what they do at the company I work at, and our developers don't work quick and dirty :) ). To modify the return value of this property you have to implement the Iaccessible interface on your control. Or, since you only want to modify the Description property you only need to modify that property and leave the rest to the proxy (I'm not sure how this works exactly but there are tutorials for it on MSDN).
The SetPropertyValue method in the UITestPropertyProvider is for the UItestControls. By overwriting it you can modify the way CUIT interacts with the control during playback. For example, if you overwrite SetPropertyValue for the Text property you can change the way CUIT types strings into the control.

Related

Wayfinder IncludeDocs parameter in Modx is breaking the snippet

I'm quite stuck on an unexpected problem. I'm trying to use Wayfinder to generate a sitemap for a project. The output of the navigation items is as expected, but I need to include a number of documents in addition to the primary navigation elements.
To do this, I have used the includeDocs parameter.
[[Wayfinder? &startId=`0` &includeDocs=`17,18,19,20`]]
When I do this, I get no output at all. Remove includeDocs and I get the standard nav (expected). Use the param and the output is completely empty.
No idea what I'm doing wrong or what (if any) other setting must be defined in order to make this work.
The includeDocs parameter is very misleading. It should rather be named "onlyIncudeDocs" or "restrictTo", since that is what it does. It also requires the docs you include to be directly accessable from your startId, alternatively have the entire path "included".
I would suggest you create weblink resources directly under your startId, and link them to the resources you want to include. That way wayfinder will pick them up by default. (Note that you may need to handle this in your rowTpl for wayfinder, since a weblink stores the actual link in it's content field)
If you also want to include the children of the id's you specify, you would probably be better of slightly revising your resource structure.

Orchard Module Override a Field Driver

Hello fellow Orcharders!
I'm not sure if what I want to do is possible, but I want to override the Driver for a single Field in the Module I'm writing.
The Field I want more control over is the Content Picker field. Basically I want the Content Picker to load the shapes for their respective content items. I've looked at Sipke's Content Picker Widget for an example on how to load shapes, however I'm unsure of the best/recommended approach to implement something similar in my module.
I have the Content Picker Field attached to my Content Part, and the default Content Picker comma list of Content Item titles appears as expected. I have tried to define an Alternate in Placement.info, but I can't load the Content Item shapes from within the Alternate view.
Presumably, as per Sipke's example, these shapes need to be built in the Driver and passed along. If this is correct thing to do, how could I do this in the most Orchard-y way with minimal "hacks". Looking into the debugger, I could "hack" my way to the Field I need in my part's Driver; but the module I'm building will be reused in the future by people unfamiliar with it, and if they start adding/deleting Fields from the Content Part, I'd like everything to behave accordingly!
Of course, if I must take the "hacky" option, I'm willing to do so, but only after I've exhausted all other options. This is my first module, and I've learnt an incredible amount along the way, and I'm really trying to learn the "right" way to build an Orchard Module as best I can.
Thanks in advance!

full text searching in managed object context and core data

I am building a notes-like application. It has a NStableview displaying all notes' titles, and a NStextview displaying the plain text of the selected note. I am using bindings and core data. I want to have a search feature:
1. the tableview only shows the notes that contains the text you query
2. the textview displays the first note, and highlight the text you queried
I just started doing Cocoa development, and not sure how to implement this, and what classes and methods should I use. I googled around, and didn't find a good answer.
Can anyone please give me some ideas and resource to look at? Thanks.
If you have an NSSearchField in your xib, you can go to the bindings inspector and bind a predicate to it, instead of a value. Leave the model key path empty, and in Predicate Format (pretend your model is storing the text content with the attribute name "textContent") put this:
textContent contains[c] $value
The [c] tells it to search regardless of the case. It will automatically update your NSTableView if you're using bindings for that.
As far as highlighting your content, I'm not sure there's an easy way to do this with bindings (there might be).
Edit: Make sure you bind it to your NSArrayController, even though you leave the model key path blank

Any way in Expression Engine to simulate Wordpress' shortcode functionality?

I'm relatively new to Expression Engine, and as I'm learning it I am seeing some stuff missing that WordPress has had for a while. A big one for me is shortcodes, since I will use these to allow CMS users to place more complex content in place with their other content.
I'm not seeing any real equivalent to this in EE, apart from a forthcoming plugin that's in private beta.
As an initial test I'm attempting to fake shortcodes by using delimited strings (e.g. #foo#) in the content field, then using a regex to pull those out and pass them to a function that can retrieve the content out of EE's database.
This brings me to a second question, which is that in looking at EE's API docs, there doesn't appear to be a simple means of retrieving the channel entries programmatically (thinking of something akin to WP's built-in get_posts function).
So my questions are:
a) Can this be done?
b) If so, is my method of approaching it reasonable? Or is there something stupidly obvious I'm missing in my approach?
To reiterate, my main objective here is to have some means of allowing people managing content to drop a code in place in their content that will be replaced with channel content.
Thanks for any advice or help you can give me.
Here's a simple example of the functionality you're looking for.
1) Start by installing Low Replace.
2) Create two Global Variables called gv_hello and gv_goodbye with the values "Hello" and "Goodbye" respectively.
3) Put this text into the body of an entry:
[say_hello]
Nice to see you.
[say_goodbye]
4) Put this into your template, wrapping the Low Replace tag around your body field.
{exp:low_replace
find="[say_hello]|[say_goodbye]"
replace="{gv_hello}|{gv_goodbye}"
multiple="yes"
}
{body}
{/exp:low_replace}
5) It should output this into your browser:
Hello
Nice to see you.
Goodbye
Obviously, this is a really simple example. You can put full blown HTML into your global variable. For example, we've used that to render a complex, interactive graphic that isn't editable but can be easily dropped into a page by any editor.
Unfortunately, due to parse order issues, EE tags won't work inside Global Variables. If you need EE tags in your short code output, you'll need to use Low Variables addon instead of Global Variables.
Continued from the comment:
Do you have examples of the kind of shortcodes you want to support/include? Because i have doubts if controlling the page-layout from a text-field or wysiwyg-field is the way to go.
If you want editors to be able to adjust layout or show/hide extra parts on the page, giving them access to some extra fields in the channel, is (imo) much more manageable and future-proof. For instance some selectfields, a relationship (or playa) field, or a matrix, to let them choose which parts to include/exclude on a page, or which entry from another channel to pull content from.
As said in the comment: i totally understand if you want to replace some #foo# tags with images or data from another field (see other answers: nsm-transplant, low_replace). But, giving an editor access to shortcodes and picking them out, is like writing a template-engine to generate ee-template code for the ee-template-engine.
Using some custom fields to let editors pick and choose parts to embed is, i think, much more manageable.
That being said, you could make a plugin to parse the shortcodes from a textareas content, and then program a lot, to fetch data from other modules you want to support. For channel entries you could build out of the channel data library by objectiveHTML. https://github.com/objectivehtml/Channel-Data
I hear you, I too miss shortcodes from WP -- though the reason they work so easily there is the ubiquity of the_content(). With the great flexibility of EE comes fewer blanket solutions.
I'd suggest looking at NSM Transplant. It should fit the bill for you.
There is also a plugin called Shortcode, which you can find here at
Devot-ee
A quote from the page:
Shortcode aims to allow for more dynamic use of content by authors and
editors, allowing for injection of reusable bits of content or even
whole pieces of functionality into any field in EE

QMultilineElement not calling QEntryDidEndEditingElement: on delegate

I'm trying to use QuickDialog (github.com/escoz/QuickDialog) to make a tablew view showing some debug info, like the values of constants etc. Most of the values are long URLs so i can't use a QLabelElement. QMultilineElement seems to be perfect for this but i need to know when the user modify the text of the pushed text view and i can't figure out how to do it.
QMultilineElement has a delegate property but i can't get it to get called. Looking in the code it seems to me that that delegate only works with QLabelElement, is it true? what am i missing?
I believe I ended up implementing this one, no? Can you confirm?

Resources