It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want a button to change a label's text in a set series. For example, that one box app on the app store where theres a button and every time you press it, it says the next thing. I want, let's say, one button and one label. The first time you press the button, it says, "hi", you press it again and it says, "how", then, "are", "you?". How would I go about doing this? Any help would be good.
Add an integer property like currentWordIndex to your view controller to remember which is the current word.
Create a label. Connect it to an outlet in your view controller with a name like wordLabel.
Create a button. Hook it up to an action that changes the label to whatever text you want, like this:
- (IBAction)changeTheLabel:(id)sender
{
NSArray *words = #[#"hi", #"how", #"are", #"you?];
self.currentWordIndex = (self.currentWordIndex + 1) % [words count];
self.wordLabel.text = [words objectAtIndex:self.currentWordCount];
}
That is all.
Related
This question already has answers here:
Adding a small picture on the right side of textField with CSS
(3 answers)
Closed 9 years ago.
I have a large number of textfields in tabs on screen - each of them must be validated. If there is an error in the input, I want some indication that a specific field has an input error.
Not every culture understands that red border means error, so I need to have the text 'error' somewhere near, over or across. For instance, to have a titled border over the text field in red saying 'error' like Java Swing has. So in the base class of the tab controllers - TabController, I have methods like
validateNumber(TextField field, String validRangeRegex);
validateIpaddress(TextField field, String validRangeRegex);
This question asks the same but the solution involves subclassing from StackPane.
GroupBox / TitledBorder in JavaFX 2?
How do I implement titled border without subclassing from TextField?
If it isn't possible in raw JavaFX, I was wondering if a JavaScript handler can write "error" over the text field?
http://docs.oracle.com/javafx/2/api/javafx/fxml/doc-files/introduction_to_fxml.html#script_event_handlers
Can't you just give the textbox an error style class with a red background-color? And install a tooltip on the textbox where the error occurred?
I know this might not be a direct answer but I don't think it is possible without subclassing.
Installing tooltip:
TextBox t = (TextBox) o;
t.setTooltip(new Tooltip("Please enter a value"));
t.getStyleClass().add("error");
CSS:
.error {
-fx-background-color: #FBE3E4;
-fx-text-fill:#8a1f11;
}
I found this question - I shall use an image icon that says "error".
Adding a small picture on the right side of textField with CSS
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to show warning message in jsf downloading excel file.
I want to show warning message in jsf when downloading excel which is having records more than 10000 as well as user has able to download
It's not possible to send multiple responses to one request. You can send only one response back per request. So, in order to be able to send a warning message and a file for download, the client basically needs to send 2 requests.
Easiest would be if the first requests checks the size of the file and then sets the message accordingly.
public void submit() {
excelFile = prepareExcelFile();
if (excelFile.getRecordCount() > 10000) {
addGlobalWarn("It's more than 1000 records! It can take quite some time.");
}
}
And have the form submit conditionally render a JS window.location call on the exact URL of the excel file.
<h:outputScript rendered="#{not empty bean.excelFile}">
window.location = '#{excelFile.url}';
</h:outputScript>
I have many subcategories and displaying them all at the same time is not user friendly.
I was thinking of putting only 10 in the navigation and hide all the others.
But is there a way to add a "View All" in the bottom of the dropdown for each category?
Something like:
L1 -> L2 -> 10 L3 Items / "View All"
I would prefer to avoid an extension as I have the design already incorporated.
Thank you :)
I just participated in another question that happened to use the Chosen widget for dropdowns. I'm really impressed with Chosen and it's ease of skinning. It would improve user-friendliness.
This question already has answers here:
Forcing a save as dialogue from any web browser from JSF application [duplicate]
(3 answers)
Closed 9 years ago.
I have a modal that will be shown and then I have an export button which should bring up the save dialog, if I have use h:commandButton, the validation checks are bypassed , but works well. If I use a4j:commandButton, validations are done perfectly but I dont see the save file dialog.
Can somebody help me.
thanks
I don't do RichFaces, so I can't tell from top of head, but Google learns me that a4j:htmlCommandLink may help. If it does and you'd rather like to have a button, then just throw some CSS in to make the link look like a button.
I am doing a survey in Sharepoint, using the built in survey tool.
I want to add a comment box next to my "ratings" questions. e.g.
Q1. Do you like fish?
Not at all
They're alright
I love fish!
Comment:
How can I do this all within one question? I can obviously add a new text question, but this will become Q2, and I want it to be part of the same question.
Any idea how I can do this?
Ta,
Ben
I had a similar requirement once. There is no starightforward way for doing this. But here is a work around which I used.
1.Add a Question, with Text box, below the question under which you need this comment box.
2.Edit the Newform.aspx page and insert a content editor webpart in the below of existing survey webpart
3.Copy and paste the below code in the content editor webpart
<script>
var tables
tables = (document.getElementById('ctl00_m_g_c7647c31_a9f9_4f27_aa53_e0728c485b2c_ctl00_ctl01_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField').offsetParent).offsetParent;
var i
var str
for(i=0;i<tables.rows.length;i++)
{
str = tables.rows[i].cells[0].innerHTML;
str = str.substring(0,7)
//alert(str);
if(str == 'Comment')
{
tables.rows[i].cells[0].innerHTML = '<table width=400px border=0><tr><td><font color=blue size=3></font></td></tr></table>';
}
}
</script>
In the above code ctl00_m_g_c7647c31_a9f9_4f27_aa53_e0728c485b2c_ctl00_ctl01_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField is the ID of the Comment textbox control (You can get it by viewing source)
We get the container of this control (table) and then hide the question. Hope this helps. Let me know if you need more help.
There is a easy solution for this sort of requirements.
while creating a new question have a look into the Additional Question Settings. There is option for "Allow 'Fill-in' choices:"
Just tick the yes radio button. This will allow you an additional text field for commenting purpose for drop down list type.