For a text box dedicated for numbers (using NSD_CreateNumber), if the user happens to type non-numeric characters, an error message pops-up in the form.
The problem is that this error message is displayed with OS language and not with the language configured for the wizard.
Is there a way to customize this message or its idiom?
This message appears in standard edit boxes with the ES_NUMBER style on WinXP+ and NSIS does not really have anything to do with the popup.
The only way to display a different message would be to write your own NSIS plugin that subclasses the edit box and displays it's own popup...
Related
I am writing a sample app to understand the behavior of slack dialog box.
For a specific text field, how I can show the warning/error message on dialog box itself on the top, after clicking the Ok button.
for example,
a Name field accept no special character, If user enters special character and press OK, how the dialog box remain open with error, "No special characer allowed" at the top. [Red box]
Any help would be appreciated.
I am using nodejs for the development purposes..
I'm afraid that it is not possible! Slack currently allow validation message below the input element as documented here.
But, we can have a workaround by updating or pushing view modal with the help of API. You need to update/push a modal view similar to this. Hope this work's for your use case.
Is there a way to use custom icons with applescript display dialog and notifications?
In the AppleScript documentation it says about the display dialog:
with icon (text | integer)
The resource name or ID of the icon to
display.
with icon (stop | note | caution) The type of icon to show.
You may specify one of the following constants:
stop (or 0): Shows a stop icon
note (or 1): Shows the application icon
caution (or 2): Shows a warning icon, badged with the application icon
with icon (alias | file) An alias or file specifier that specifies a .icns file.
So it seams like you can use your own icons, but I cannot get the following code to work.
display dialog "Text" with icon "/Users/user/Desktop/asd.icns"
It gets me the following error: "Resource not found."
The goal is to not even use a display dialog, but a display notification instead.
First of all you can't display a custom icon with display notification. The reason is that notifications are strongly related to a target application. As AppleScript scripts and applets aren't applications in terms of the Notification framework, the notification is related to the current application, the AppleScript Runner.
But you can display a custom icon with display dialog
The line
with icon (alias | file) An alias or file specifier that specifies a .icns file.
means what it says: The parameter must be an alias or file specifier rather than a POSIX or HFS string path.
Either
display dialog "Text" with icon alias ((path to desktop as text) & "asd.icns")
or
display dialog "Text" with icon file ((path to desktop as text) & "asd.icns")
path to desktop as text represents the HFS path to the desktop of the current user:
"Macintosh HD:Users:user:Desktop:"
Noted this question was three years ago, but I stumbled across this looking for a solution to a similar problem. Mine needs display alert rather than ... notification but the problem is the same because display alert doesn't have a custom icon option.
As noted in the other answer here, AppleScript has at least three interactive message type commands: display dialog, display alert, display notification, and probably others. It seems odd that only the first has the option to add a custom icon. I don't really understand why that is when it would be simple to make them consistent.
Needless to say, this question and #vadian's answer, inspired my solution - a "duh" moment for me once I realized it. It may or may not be a solution to this question. Posting it in case it is...
If the icon in question belongs to an app, you can tell that app to display the notification, regardless of whatever else your script is doing.
Your script can do whatever it needs to do to whatever other apps, or System Events, or itself (if your script is saved as its own application), or whatever else. In the middle of all of that you can have a single line that says:
tell application "MyApp" to display notification ...
The notification will have My App's icon, the result of the notification if any will be returned to the rest of the script and then your script will continue on inside whatever other tell statement or context its in.
If your icon isn't the icon for an app, then I believe there are ways to create an empty app with whatever icon you like, which can behave this way. Admittedly that's a bit of a kludge, but depending on how badly you want this, it's an option - though not one I'll expand on here.
My specific case in detail if interested (but doesn't particularly add to the solution above, just covers how I got there):
I'm writing a script that quits and re-opens another application after confirmation from the user. However, let's say I just wanted to provide a notification as per this question.
Options:
1. display dialog - has the option to provide a custom icon but lacks features of the other two options.
2. display alert - no custom icon but has other desired features, in my case the message parameter which adds extra smaller explanatory text below the primary text.
3. display notification - no custom icon but has other features as desired by this question's poster.
In my case I want alert because I want that extra message parameter (but this works for notification as well).
In my case, ideally the icon of the alert would be the icon of the app I'm restarting, but I can't tell the app itself to display the alert and then restart because the script loses connection with the app when it quits and it kills the running of the script.
If I tell System Events or the script itself to do all that then it can quit and reopen the app independently of the app, but the alert has the generic icon of itself or the System Events icon.
However, if I do what I described above - have my script do all its stuff, but have it tell the app in question to display the alert (and only that as described above), then the alert has the icon of the app in question, but the script still does its stuff independently of the app outside of that alert.
Solved my problem. May or may not solve this question.
#DavidT's answer is a perfect solution when your script is controlled by another application. However, things have changed a bit on Mac OS since.
Notably, if you run your script with tell application "MyApp" to display alert ... you will be promoting the user to give your app permissions to control itself, at least starting since Catalina. Not only this annoys the user with a new permission request, but it also looks kinda dumb since the dialogue is asking the user to allow "MyApp" to control "MyApp" and if the user denies it, your script will fail.
To avoid the permission request, just use tell me to display alert ... this will work just fine.
Another issue you might run into is that osascript may throw an exception if your script is launched as root. I found a nice workaround for that here.
This is a small example of how to launch the dialogue with the right user:
uid=determineUserIdFunction(...)
launchctl asuser $uid /usr/bin/osascript <<-EOS
tell me to display dialog "Now you see me" buttons {"OK"} default button 1 with title "WARNING!"
EOS
You have your path specification wrong. If you have a posix path to your icns file, use the POSIX file class coercion:
display dialog "Text" with icon POSIX file "/Users/user/Desktop/asd.icns"
This coerces the string path into a file reference the system understands, and works just fine.
We have a Basic MSI installer project. On a certain dialog, we do validations of data provided by user and then throw appropriate message using the MessageBox().
Now when the MessageBox comes up, it comes up with the message we want and an OK button.
We have an issue w.r.t the locale of this OK button. When tested on English, French windows 2008 machine we can get the OK button, where OK is in English. When we use the same installer on a Spanish windows machine then the same OK button comes up with OK in Spanish.
I'm not able to figure out what's the cause of this behaviour. Any hint/help would be of great help.
/Avadhut.
It's unclear from your question exactly what API you call, and in exactly what scenario. Note that for almost everyone, displaying the OK button in the "native" language of the machine will not be confusing, so only causes problems during the QA process.
The MessageBox API of Windows is localized to the same locale as Windows itself. By contrast, MessageBoxEx is documented to take a language parameter, although when I looked, a commenter said it doesn't always change the default localization. (My guess would be that the requested language was not available on the commenter's machine.)
If you're showing a message from within a MSI DLL custom action, it's better to use MsiProcessMessage than MessageBox as MsiProcessMessage will parent its window correctly. I suspect you're using a ControlEvent, which is implicitly avoided in a silent installation, but MsiProcessMessage will also not show its message during silent installations without requiring any extra work; if using MessageBox in an execute sequence action, you would have to check UILevel manually. However it's unclear from the documentation whether the buttons on an MsiProcessMessage message box will be localized.
I've got a Visual Studio extension that I am working on. I have implemented some error tagging, which works just fine. However, some of the errors reference other locations in the code. I would like that the user can click on these locations and be taken there. The definition for ErrorTag permits an Object as the tooltip, which is not terrifically helpful, and the documentation seemed quite resistant as to what this should actually be. So far I have only been able to use a String as a tooltip.
In addition, the error popup is destroyed when the user leaves the error text span. I would need it to remain whilst the user is still on the text span or the popup content. I have discovered a PopupStyles enumeration which can control this behaviour, but I am unsure how to apply it. I would need to use the DismissOnMouseLeaveTextOrContent member to set the appropriate behaviour.
How can I implement an interactive error tooltip?
Edit: I discovered that a UIElement is a valid argument here- I replaced the String with a Label, for example. Some formatting issues aside, I still need to know how to change the popup style.
The error popup is intended to be a static tooltip and nothing more. It's not supposed to be interactive.
The PopupStyles enumeration appears to be used for the ISpaceReservationManager and IToolTipProvider -- there's no real connection to the tagging API at all. What you might be able to do is listen for the IWpfTextView.MouseHover event, and then use one of these APIs to trigger the tooltip that can be interacted with.
How to have numeric keyboard popup to input in TextBox on Windows Mobile 6.53? (C++ vs2008)
When one clicks in a text box, the numeric keypad should popup - not the full keyboard.
I searched for other threads, but a solution does not seem to exist. (http://msdn.microsoft.com/en-us/library/dd183783(v=vs.90).aspx)
This code fails - it does not bring up the numeric keypad, but the full qwerty keyboard:
hwndCtl = GetDlgItem(hwndDlg, IDC_PASSWORD);
SHSetImeMode(hwndCtl, SHIME_MODE_NUMBERS);
This does not compile - it does not recognize Microsoft.WindowsCE.Forms (I am unable to find the header file to include for this, if it exists):
Microsoft.WindowsCE.Forms::InputModeEditor.SetInputMode(hwndCtl,Microsoft.WindowsCE.Forms.InputMode.Numeric);
error C2065: 'Microsoft' : undeclared identifier
Is there a way to do this without writing my own dialog?
You have the right idea, you're just missing the right import statement.
According to the documentation for InputModeEditor.SetInputMode:
Specifies the input mode on a Smartphone.
...
You can set the input mode only on a TextBox.
Its example, however, is too terse. However, according to the documentation for InputModeEditor, here's what you need to do:
using Microsoft.WindowsCE.Forms;
...
hwndCtl = GetDlgItem(hwndDlg, IDC_PASSWORD);
InputModeEditor.SetInputMode(hwndCtl,InputMode.Numeric);
To access members from the namespace you desire, you have to use it.
This documentation may also help you.
I ended up creating my own numeric keypad since I did not receive any replies for a long time.