I have a very simple form with a text box to enter the year wanted, and a "GO" button. However, the textbox will only display the textbox name ("GETYEAR"). I cannot change it in either the properties nor when I run the project. If I reference GETYEAR.TEXT I get an error that it doesn't exist. I thought it should work the same way as in VB. Can anyone help me with why the textbox is/seems locked ?
Thank you.
In vfp textbox.text property is readonly you cannot change it. Use thisform.getyear.value property instead. I think it will work
Related
I am creating a MFC application based on example: https://github.com/microsoft/VCSamples/tree/master/VC2010Samples/MFC/Visual%20C%2B%2B%202008%20Feature%20Pack/WordPad
now i want to change the way to expand font name drop list in toolbar from DOWN key to F4. It seems i need to get the combobox and call SetExtenedUI(FALSE) on it, but i dont know where to do it.
To change the extended UI flag on a CComboBox, you call its CComboBox::SetExtendedUI member. When you have a CMFCToolBarFontComboBox you need to get to its combo box first. Since it inherits from CMFCToolBarComboBoxButton you can use its CMFCToolBarComboBoxButton::GetComboBox member to get a CComboBox*.
CMFCToolBarFontComboBox* pFontButton = ...;
CComboBox* pComboBox = pFontButton->GetComboBox();
pComboBox->SetExtendedUI(FALSE);
finally i switched to CComboBoxEx which works fine
How to Auotmate Combo box for makemytrip as I am able to insert the value but once the focus is moved value is erased from the combobox
Try use Click first on that WebEdit (or maybe WebElement) object. Then, use SendKeys method to insert desired value. One potential issue here is that the value may still disappear even you use SendKeys, if so, try to send the string one by one. Google has lots of sample codes about SendKeys and sending string one character by one character.
If it's a WebEdit object, you might find it works best if you use the WebEdit("whateveritscalled").Type myDestinationString operation rather than Set or SendKeys.
Try the following, I am setting the values using the Elementid,it should work-
Browser("MakeMyTrip, India's No").Page("MakeMyTrip, India's No").Object.getElementById("from_typeahead1").value = "New Delhi, India (DEL)"
Browser("MakeMyTrip, India's No").Page("MakeMyTrip, India's No").Object.getElementById("to_typeahead1").value = "Mumbai, India (BOM)"
I've been working on a custom field, which contains a list.
I have to be able to edit the selected item on the list in a richtext editor. (this is the only missing part).
I've read the topic on opening from c# code Opening Rich Text Editor in custom field of Sitecore Content Editor .
This works nice for the "add" button, since i have to open the RTE empty(with default text...), but not for the Edit button.
My aproaches are:
Somehow in the Edit button's message field list:edit(id=$Target) pass the selected index (like list:edit(id=$Target,index=$SelectedIndex), but i don't know how to populate $SelectedIndex
Somehow in the overridden HandleMessage method get the list's selected index. I'm able to get the selected value Sitecore.Context.ClientPage.ClientRequest.Form[ID of list], but thats alone not much of a help, since i won't be able to decide which one to edit if two listitem equals.
Do the richtext editor opening and handling fully in javascript. As i saw at some script in content editor, i tried to do that, but i can't understand it clearly:
richtext editor url:
var page = "/sitecore/shell/Controls/Rich Text Editor/EditorPage.aspx";
some params :
var params = "?da=core&id&ed=" + id + "&vs=1&la=en&fld=" + id + "&so&di=0&hdl=H14074466&us=sitecore%5cadmin&mo";
and the part where i'm not sure:
var result = scForm.browser.showModalDialog(page + params, new Array(window), "dialogHeight:650px; dialogWidth:900px;");
This way the RTE opens as expected (i guess i could get the selected index from javascript and pass it as a parameter later). However when i click ok, i get exception from EditorPage.js saveRichText function: Cannot read property 'ownerDocument' of null. Am i missing some parameter?
Either of the three aproaches is fine for me(also i'm open for new better ones) as soon as i'm able to do it.
Thanks in advance!
Tamas
I was able to enter some javascript into the message:
list:Edit(id=$Target,index='+document.getElementById(ID of the select using $Target ).selectedIndex+')
this way i got the index in HandleMessage.
I'm waiting for better solutions now.
I am using VB6 (yes, I know it's 10 years old :), but it works). VB.NET answers may work as well, so if you know the answer, please answer too!
I am "manually" setting a dropdown box in a form, yet the 'webbrowser' doesn't seem to update.
Here's an example
If you notice in the form, it has a place where it asks you to fill in a state. (I.e., california, etc). It looks like a javascript/DHTML popup box in MSIE (firefox doesn't do the same, so you need to use MSIE, since that is what the webbrowser control relies on). If I 'click' on the "state" field, a popup box appears. I then can say select "CA" for california, and it updates it. (It now says "CA").
If I progrmatically do it, I would do something like:
WebBrowser1.forms(2).elements(13).value = "CA" ' (sets it to 'california')
WebBrowser1.forms(2).elements(13).item(9).selected = true (makes sure it is 'selected')
However -- within the webbrowser control -- it still appears as if nothing has changed. (In reality it has, i.e., if I submit the form it will submit the correct info), but it just doesn't "update" it.
Do you have any idea how I can do a "forced" refresh (either progrmatically or through some javascript/dhtml refresh), that will correctly then 'update' the field to show that "CA" has been selected?
Thanks very much!
The last VB version I used was VB3 so forgive my VB grammar :)
If the change event has a handler that you want to simulate
WebBrowser1.forms(2).elements(13).item(9).fireEvent ("onchange",WebBrowser1.Document.createEventObject())
I have this input of type "Submit" that Watir cannot see. I can identify it by ID, but it doesn't turn up in browser.text_fields, or by any other idenfication method. The ID is dynamically generated so I cannot use it for testing. Any ideas on how to make this readable? I'm willing to change the WATiR source code if necessary.
<INPUT id=t8CPm value=Submit type=submit>
I have obviously tried text_field(:value, 'Submit') and text_field(:type, 'Submit'), and I get an "Unable to locate element" error.
Did you try treating it as a button element? Inputs of type submit are generally considered to be a button because the browser generally renders them that way.
try
browser.button(:value, 'Submit').flash
and see if it works for you
I changed INPUT_TYPES to ["text", "password", "textarea", "submit"] in the TextField class of input_elements.rb and there it was.
I should also probably edit the collections to read the type too.
Edit: I am an idiot and I didn't need to do this, but I'm leaving it here in case anyone else needs to identify a real dynamic-id custom-type text field, not a fake dynamic-id custom-type text field otherwise known in my particular case as a "button".