How can I get the 'read-only' property of a win32 edit box? - win32gui

How can I get the 'read-only' property of a win32 edit box ?
And I know how to set the property. code like this.
SendDlgItemMessage(g_hwnd, IDC_EDIT_1, EM_SETREADONLY, 1, 0);
But how can I know this edit control has the 'read-only' property ?
I mean not MFC\CWND or some how, just win32 method, like SendMessage api.
Thanks in advance~

According to MSDN:
EM_SETREADONLY message
Sets or removes the read-only style (ES_READONLY) of an edit control.
So just read that style from your control using GetWindowLongPtr() with GWL_STYLE.
Here is the Win API call:
bool bRO = ::GetWindowLongPtr(::GetDlgItem(g_hwnd, IDC_EDIT_1), GWL_STYLE) & ES_READONLY;

Related

How to write an XPath or CSS expression?

<span class="left-menu-title selectorgadget_selected" data-xpal="xpath-verify-selected" style="">Admin</span>
How can I write an XPath or CSS expression? I tried the plug-ins does not work.
If anyone knows how to click an item from the left-side bar after log-in to the site will be a great help. it does not click, the script fails.
#FindBy(xpath = "//SPAN[#class='left-menu-title'][text()='Admin']")
WebElement clickOnAdmin;
public WebElement adminClick() {
return clickOnAdmin;
}
There are multiple classes but you are checking left-menu-title only.
The case of a SPAN tag name may also be a problem depending on a driver.
Fixed version, using contains() (note that it is not an ideal class XPath check - you need the concat and normalize-space, strictly speaking):
//span[contains(#class, 'left-menu-title')][text()='Admin']
what #alecxe wrote is a very good pointer.
Usually when a website has a strong front-end code embedded with data+JS, you should use functionalities. Especially when absolute xpath does not work such as your case with data var on the front-end. "data-xpal="xpath-verify-selected"
Guru99 xpath fonctionalities
also please verify if your application or website is not embedded with iFrames.
if so please change iframe window.
if you can provide the stackTrace Error. I assume you are talking about NullPointerException or NotFindElementException.
As per the HTML you have shared, the following code block must work :
#FindBy(xpath = "//span[#class='left-menu-title selectorgadget_selected' and contains(.,'Admin')]")
WebElement clickOnAdmin;
public WebElement adminClick() {
clickOnAdmin.click();
}
Note : As you named the function as adminClick(), assuming you want to invoke click() method on the WebElement clickOnAdmin, click() method won't return anything. hence you have to discard the return clickOnAdmin; statement as well.
I would suggest trying writing your XPATH as //span[contains(#class,'left-menu-title') and .='Admin']
And instead of just element.click(); use javascript executor click. Like how it's below:
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", driver.findElement(By.xpath("//span[contains(#class,'left-menu-title') and .='Admin']")));
Hope this works for you! Let me know.

Why my DevExpress v14.1 doesn't have the GridViewEdittingMode component?

According to the official document of DevExpress : https://documentation.devexpress.com/#AspNet/DevExpressWebGridViewEditingModeEnumtopic , the assembly which contains GridViewEditingMode component should be DevExpress.Web.v14.1.dll. However, I tried to add it to my reference, it still said GridViewEditingMode does not exist. The hash code of my DevExpress.Web.v14.1.dll is SHA256 CFDE95612BA9D4A771DD0236D95A8A1881BE983DC72985205E36134CA37D1075. Worse still, I don't have the project converter in my computer, nor does DevExpress provide v14.1 trial anymore.
Is there any one who knows how to make GridViewEditingMode component be available in a DevExpress v14.1 based project?
Looks like you faced this breaking change (Some classes related to DevExpress ASP.NET controls have been moved to the DevExpress.Web namespace). So, the namespace where the GridViewEditingMode enumeration is implemented was changed from DevExpress.Web.ASPxGridView to DevExpress.Web. The following code should work for you.
var grid = Html.DevExpress().GridView(settings =>
{
settings.Name = "GridView";
// code
settings.SettingsEditing.Mode = DevExpress.Web.ASPxGridView.GridViewEditingMode.EditFormAndDisplayRow;
// code
});

SAPUI5 / OpenUI5 Databinding for Custom Controls

I'm working with SAPUI5 and OpenUI5. I'ved developed some custom controls for now but never used the 2-Way Databinding for this controls...I've tried it with
oMyControl.bindProperty("someValue", "oModel>/testBindingValue")
What I've seen is: When watching the Model in the debugger the field aBindings have one entry:
sPath: "/testBindingValue"
sInternalType: "int"
and the correct sInternalType of my Controls property type (in this case "int").
But when I'm watching the array oModel.oData it is empty and oModel.getProperty("/testBindingValue")
is also returning undefined...but my control definitely has a value for "someValue"...So, does anyone have an idea?
Thanks,
Alex
UPDATE:
Here you see my workflow:
first creating the model:
var oModel = new sap.ui.model.json.JSONModel();
sap.ui.getCore().setModel(oModel, 'oModel');
then initializing my control:
var oMyControl = new MyControl({
someValue: "Test Value of the Control"
});
oMyControl.bindProperty("someValue", "oModel>/testValue");
Now, when I'm doing:
alert(oModel.getProperty("/testValue"));
I will get "undefined".
So, for normal controls this is working, for "value", "text", "visible" or "enabled" and so on..
I'm guessing there is something in your custom control that is making this not work correctly. I have created an example of what I understand you are doing (http://jsbin.com/kiwoza/2/edit?html,console,output) and it seems to work as I'd expect. If this example is somehow different from what you're trying to accomplish please update the question with details about why it's not quite right.

QML ButtonRow checkedButton not responding

When I call this:
buttonrow1.checkedButton = _button1
then I get no errors and nothing happens, I can also not change the property using states, no matter what I do it just remains at the default setting. Any idea how I can change this value?
buttonrow is not a built in type. So please add your definition and tell us what you need to do with:
buttonrow1.checkedButton = _button1

How to create a password field in xcode

I am trying to make an iPhone App in which i will make user to login into their account.
For this i want userID and Password from the user. My question is how i can make a password
field in which whatever I enter will be shown as "*".
Sounds like you are looking for "setSecureTextEntry" on a "UITextField" object.
Also known as the "secureTextEntry" property in the "UITextInputTraits" protocol.
You can call this programatically via calling ".secureTextEntry = YES" on the "UITextField" object you want to be set for passwords.
You can also set it in Interface Builder (look for "Secure" checkbox in your text field Attributes inspector). It looks like this:
And in newer version of Xcode:
Update for Xcode 12.2+
My opinion is programmatic declaration of properties are easier to toggle back and forth.
Programmatically in Swift 5:
myPasswordTextField.isSecureTextEntry = true

Resources