I want to make error message like this on JavaFX. How can I do it?
Use an Alert:
Alert errorAlert = new Alert(AlertType.ERROR);
errorAlert.setHeaderText("Input not valid");
errorAlert.setContentText("The size of First Name must be between 2 and 25 characters");
errorAlert.showAndWait();
~~>Default Way
Alert class and some more are already in JavaFX library a full tutorial here
How to costumize an Alert?Here
^^Using ControlsFX library^^
There is a ready JavaFX library that make messages like in your icon.I am talking about ControlsFX library
~~>More Costumizable
It contains a Class named NotificationPane which you can modify in the way you want to display messages like JavaFX Alert and more complicated.
~~>For your situation
I would use Notifications class which display messages in the bootom,top,right,left and combination of them in the screen.
Example Code:
Notifications.create() .title("Title Text") .text("Hello World 0!") .showWarning();
Image:
Look here Edit this cause for some reason isn't displayed in stackoverflow
~~>How to costumize Notifications:
Customize ControlsFX Notifications
Related
Some time ago in Apache Flex project we have started to port MDL library into FlexJS framework. [1]
When I was working on Toast component I have faced an issue where removing "mdl-snackbar__action" button from HTML cause an error. It seems that snackbar.js [2] throws an error if snackbar action doesn't exists.
if (!this.actionElement_) {
throw new Error('There must be an action element for a snackbar.');
}
My question is - Why this element is required in case of Toast ? Toast component do not need it.
[1] https://cwiki.apache.org/confluence/display/FLEX/Table+Of+Components
[2] https://github.com/google/material-design-lite/blob/release/src/snackbar/snackbar.js
Thanks,
Piotr
I think it's because the snackbar and toast are implemented as a single component in the HTML/CSS. That way, an app can throw either type by either including or omitting the action-related parts of the data object that gets passed to the showSnackbar method.
It's just to cut down on the number of components in the library by making the one more flexible.
I meet a stranger question,when I read the android GlobalAction source code,I find that it will start a dialog,but it add a judgement which will judge whether this dialog has been shown,if it was shown before,it will be dismissed and then show it.The stranger things is that it dismiss the dialog,than use Handler to send a message to create and show dialog again,I can't understand why it needs to send a handler message,I think it just calls dialog dismiss function.then calls show function,it no problem.The comment said:"Show delayed, so that the dismiss of the previous dialog completes",but I also can't understand the meaning,please someone help me explain it,Thanks a lot.
if (mDialog != null) {
mDialog.dismiss();
mDialog = null;
// Show delayed, so that the dismiss of the previous dialog completes
mHandler.sendEmptyMessage(MESSAGE_SHOW);
}
Many Android UI functions are themselves implemented using messages, and so do not complete immediately. When you call Dialog.dismiss(), Android queues a message that does the actual dismissing. The author of this code wants to ensure the dialog is actually dismissed before showing it again, and so she posts her own message, which will not run until after the one posted by Android.
Hello and thanks in advance for any suggestions.
I am using the grouping option in the Kendo UI and i wanted to change the default grouping message :Drag a column header and drop it here to ...
So i changed the text in 3 .js files called: kendo.all.min.js, kendo.web.min.js, and kendo.groupable.min.js, to the desired text and the text does not change.
I think i'm missing something because when i group and un-group i see my message for a sec but then the grid reloads again and i get the original message again. Is the message coming from the dll or just from java script? hope someone can help it is really important.
Thanks.
If you did it correctly and are loading the modified version of the JS it should work BUT that is not the way for localizing the message... KendoUI (in the latest versions) already has support for it. You should have done:
groupable: {
messages: {
empty: "Custom message text"
}
},
as it is shown in their documentation here
Remember that if you modify their code, next time they release a new version you will have to merge their version with yours for having the fixes and new features that KendoUI team developed plus your changes.
EDIT If you want to have it for every Grid in you document, put at the very beginning of the JavaScript code:
kendo.ui.Groupable.prototype.options.messages =
$.extend(kendo.ui.Groupable.prototype.options.messages,
{empty: "Custom message text!"}
);
I want to display my custom message (Say for Ex: some message needs to display when Page is save event is triggered) in SDL Tridion CME Message bar. How to do this?
From an event system you can only display ERROR messages.
If your Event code throws an error the "Message" will be displayed in the Message bar.
For other type of messages you need to use Javascript/CM Extensions. You can find an example of an event system that shows a message here.
Nuno covered your options pretty well.
If you want to show a message from your JavaScript code, this is usually my starting point:
$messages.registerNotification("Hello world");
If you put this in your JavaScript code (or just paste it into a JavaScript console), it will show a blue bar with "Hello World" in it.
There are many types of messages, each of which shows up slightly differently. What I usually do if I need more than a notification is:
type $messages. in a JavaScript console in a browser where the web GUI is loaded
go through the list of relevant methods to see what looks most promising (they all start with register)
perform a text search on the source code for the method that I am looking for
This leads me to an example of how that method is used in the GUI already and is a great starting point for my own code.
Update
Alexander Klock recently wrote a thorough explanation of the message types available on his blog.
Hi all i have created my code etc for the .h/.m that are all ready provided. But i would like to known how to add more because when i add a view controller to my storyboard. I can't have code in it i think what I'm looking for is called a second view controller .h/.m. I am creating a project in Xcode 4.2 and its a single view based application. I'm new to this but i think what i have said makes sense thanks for your time.
kind regards
open your project
press command+N to open the new file dialog
iOS > CocoaTouch
Class = YOUR_CLASS_NAME
Subclass of = SUBCLASS_TYPE (e.g. UIViewController)
etc.