In Javafx 2.X used Choice Box
ChoiceBox cb = new ChoiceBox();
cb.setItems(FXCollections.observableArrayList(
"New Document", "Open ",
new Separator(), "Save", "Save as")
);
In Table view used for FXCollection.observableArraylist.
why used for observableArraylist?
It returns an ArrayList which can be observed for changes (new items added/ removed).
Related
In the end of the document, I want to show a checkbox with a prepopulated text, something like:
[ ] By checking, I've read the whole document and agree to sign.
Use a 'text' (old documentation, new documentation, expand the text menu at the bottom) to display your text.
In C#, it would look like this :
Text myText = new Text
{
Value = "By checking, I\'ve read the whole document and agree to sign.",
DocumentId = "123",
PageNumber = "1"
};
I need to create a button in Lotus Notes mail stationary which will insert a text and then the button is deleted from the message.
In the button I have:
res := #Prompt([OkCancelList]; "Is it OK?"; "Select result"; " ";"OK":"Failed":"");
#If(res ="OK";
#Command([EditGotoField]; "Body") + #Command([EditInsertText]; "Everything is fine);
#Command([EditGotoField]; "Body") + #Command([EditInsertText]; "Not so good mate"));
This part works fine, but I am not sure how to delete the button after click. Usually works #Command([EditClear]) but not in this case when I use #Command([EditGoToField]) in the formula.
I suppose i need to use GoToField again with the correct button identifier and then run EditClear, but I do not know where to find it, or if there is another way to do it... Ideas?
Thank you.
Assuming you have the button in field Body and nothing else that have to remain
then change your code to:
#Command([EditGotoField]; "Body");
#Command([EditSelectAll]);
res := #Prompt([OkCancelList]; "Is it OK?"; "Select result"; " ";"OK":"Failed":"");
#If(res ="OK";
#Command([EditInsertText]; "Everything is fine");
#Command([EditInsertText]; "Not so good mate"));
It selects the content of Body (including button) and replaces it by the new text.
Assuming your document is (or could be put into) edit mode, you could still have the button, but have the button in it's own paragraph (or table cell) with a hide-when formula of of MySpecialButtonPressed!="", and then include the line
FIELD MySpecialButtonPressed := #Now;
in the button code.
(Edit: changed test from =1 to !="", then changed the set value from 1 to #Now because Notes doesn't store Boolean values. Unless you're sending out millions of these, the cost of using dates instead of numbers less than the benefit of having more specific information in case you need it.)
I have one form with two fields called "Field 1" and "Field 2" and one action button called "check". On click of that action button, i want to open dialog box with three fields which should get auto populate based on Field 2 value. How to achieve it?
Appreciate if anyone helps me.
Yes, it is possible. There's a document parameter for NotesUIWorkspace.DialogBox(). Use this document to pass parameters to your dialog.
UPDATE
Assume you have a form with name "MyDialogForm" to represent your dialog.
It looks like that and contains 3 fields:
And you have a form with two fields and "Check" button:
Put the following code to the "Click" event handler of your "Check" button:
Sub Click(Source As Button)
Const DIALOG_FORM_NAME = "MyDialogForm"
Dim ws As New NotesUIWorkspace
Dim dialogBoxAccepted As Boolean
Dim dialogParamDoc As NotesDocument
Dim currentDocument As NotesDocument
Dim field2Value As String
Set currentDocument = ws.CurrentDocument.Document
field2Value = currentDocument.GetItemValue("Field2")(0)
'document created in-memory, but should not be saved
Set dialogParamDoc = New NotesDocument(currentDocument.ParentDatabase)
'populating dialog box fields
Call dialogParamDoc.ReplaceItemValue("DialogField1", "dialogField1 with: " + field2Value)
Call dialogParamDoc.ReplaceItemValue("DialogField2", "dialogField2 with: " + field2Value)
Call dialogParamDoc.ReplaceItemValue("DialogField3", "dialogField3 with: " + field2Value)
dialogBoxAccepted = ws.DialogBox(DIALOG_FORM_NAME,True , True, False, False , False , False, "My Dialog Title", dialogParamDoc, True)
If dialogBoxAccepted Then
'displaying values, entered/changed in dialog box
Msgbox dialogParamDoc.getItemValue("DialogField1")(0),,"DialogField1"
Msgbox dialogParamDoc.getItemValue("DialogField2")(0),,"DialogField2"
Msgbox dialogParamDoc.getItemValue("DialogField3")(0),,"DialogField3"
End If
End Sub
This code reads "Field2" and populates dialog fields based on its value. Then it shows the dialog where you can change these values.
If you pressed OK in your dialog (dialog accepted), the code will show the values you have altered in dialog box.
At first, there's a rich text field in the form that has a text inputted already (for this scenario - "hello world"). I have placed the cursor just after the letter "o" from "hello". I have a button that will open up a dialog box with one text field and I was wondering how would you be able to insert the text from that field from the dialog box at the current position of the cursor in the rich text field.
So far the code I have is:
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Set db = s.currentdatabase
Dim docFill As New notesdocument(db)
Call workspace.DialogBox _
( "Test", True, True, False, False, _
False, False, "Test Insert text at current position in rich text field", docFill, True, False, True )
Dim string1 As String
string1 = docFill.sampleText1(0)
Dim rts As NotesRichTextStyle
Set rts = s.CreateRichTextStyle
End Subs
End Sub
Let's say I entered "stackoverflow" in sampleText1 text field. After clicking ok then it will be inserted at the position of the cursor in the rich text field. So the result will be "hellostackoverflow world".
Also just an additional question. Let's say I also wanted the text to be in color red or a different font so I would be using notesrichtextstyle class etc to design it. How would you be able to insert the rich text at the position of the cursor in the rich text fiel if that would be the case?
You can insert text at current cursor position with the help of the clipboard. Just let the user insert text in a dialog box, select the text after clicking "OK", copy it and then paste it at the current cursor position in RichText field back in your form.
To accomplish that, create an action "Insert text" in your form's action bar with the LotusScript code
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
If workspace.DialogBox _
("Dlg", True, True, False, True, _
True, False, "Test insert text", doc, True, False, True ) Then
uidoc.Paste
End If
End Sub
Actions in action bars have the advantage that they don't change the cursor position in document on click event. So, the cursor still remains on current position e.g in RichText field clicking on an action button.
Then, create a form "Dlg" for DialogBox with a Text or RichText field "Text". Add the following formula code to form's Postrecalc event (it's executed on "OK" button click):
#Command([EditGotoField]; "Text");
#Command([EditSelectAll]);
#Command([EditCopy])
You have a lot of options with the copy-paste-approach to put content into clipboard:
Create a text in backend and put it direct into clipboard
Create a RichText item in a temp document with all content and style options you can think of, open the document in UI, copy the RichText item content to clipboard and close document without saving
Let users create their text snippet in documents. Let them choose one of it clicking on "Insert text" button - just open the selected document, copy the content to clipboard and close it.
The first problem is that when you click the action button, you will lose focus of the rich text field, and therefor there is no way to know where the cursor was.
I would also suggest that you don't use the extended notation like this:
string1 = docFill.sampleText1(0)
Use the GetItemValue method of the NotesDocument class instead (for several reasons, including performance and future-proofing your code.
If you just want to have the user enter some text, why not use the InputBox function?
Finally, there is not an easy way to insert text in the middle of a rich text. It is much easier to perform a replace of a specific text string in a rich text field. I once created a Lotusscript class to perform mailmerge (create letters based on a template and a form letter with field names and commands), you can find it here: http://blog.texasswede.com/code-mail-mergeform-letters-in-lotuscript/
Perhaps that can help you some. But it has to be done in the backend, you can't do much rich text work in the frontend, unless you use Midas LSX frpn Ben Langhinrichs (http://www.geniisoft.com). I think he got some UI functionality.
But your biggest issue will be the first problem, how to trigger the code without losing focus of the rich text field. I don't see a good solution there. You may want to rethink your design/approach.
If you use a button in the Action Bar then the focus will remain with the rich text field. You can then use uidoc.InsertText("") to insert the text at the current position of the cursor.
You could use...
call uidoc.InsertText( docFill.sampleText1(0) )
Using Visual Studio 2010 with Server Management Studio 2008 I have made a feature through which a teacher can see the results of all students from all years:
By drop down selection it shows data in grid view, with a button for the teacher to see the selection in an Excel sheet. For some selections there is a lot of data so it takes time.
Now my client does not want display of grid view in the page but direct export into Excel based on the selection on drop down.
Can any one help me to do this.. and would it make my page load a little faster?
first write stored procedure in ssms to retrieve the data.
It should be like
CREATE PROCEDURE [Retrieveresult] (#selectedfield nvarchar(50))
AS
BEGIN
select * from students where condition=#selectfield
END
then in visualstudio
oConn = new SqlConnection();
oConn.ConnectionString = "your connection string"
SqlCommand command = new SqlCommand("Retrieveresult");
command.CommandType = System.Data.CommandType.StoredProcedure;
oConn.Open();
command.Parameters.Add(new SqlParameter("#selectfield", System.Data.SqlDbType.nvarchar(50)));
command.Parameters["#selectfield"].Value="selected value from gridview"
IDataReader oDr;
oDr=command.executereader();
while(oDr.read())
{
Get the corresponding values in the objects
}