on 02-04-2009 11:46 AM
Hi,
How to append Message Area?
Thanks,
RPN
Hi Jude,
As you have hardcoded the values thats why you are not getting the previous message.
below is the code written by you
IPrivateIDocClientView.IContextElement element = wdContext.currentContextElement();
IWDMessageManager msgMNG = wdComponentAPI.getMessageManager();
msgMNG.reportSuccess("Success");
msgMNG.raiseException("Failure");
below are my suggestions.
IPrivateIDocClientView.IContextElement element = wdContext.currentContextElement();
IWDMessageManager msgMNG = wdComponentAPI.getMessageManager();
String success = "Success";
String failure = "Failure";
//now you need to delclare one global variable between
//@@begin others
String result = success +failure;
//@@end
// I hope both these statements are in different methods.
msgMNG.reportSuccess("result ");
msgMNG.raiseException("result ");
Hope this will help.
Regards
Narendra Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Narendra,
Probably that solution will not work as this is going to print both Success & Failure together.
I suppose his requirement is different.
Please try this:
Use 2 Label / Text View in your application. Set text to them as Success & Failure.
Set there visibility as NONE in doInit method.
When you click 1st button, set the visibility of Success to VISIBILE.
do the same with Failure. Make sure you do not hide them again.
-
If you want that again on click of 1st button, Success should come. then do this also.
Take a flag =0 default
just set the flag = 1 if 2nd button is clicked.
on click of 1st button, check
if the flag==1
set visibility to Failure as NONE.
Hope this will solve your problem.
Regards
Chander Kararia
Am sending you my actual code
this is the code for button 1:
Display_Message("success", false);
this is the code for button 2:
Display_Message("Failure", true);
this is the code to print the values in message area:
private void Display_Message(String Message,boolean Error)
{
IPrivateIDocClientView.IContextElement element = wdContext.currentContextElement();
IWDMessageManager msgMNG = wdComponentAPI.getMessageManager();
if (Error==false)
msgMNG.reportSuccess(Message);
else
msgMNG.raiseException(Message, true);
}
Regards,
Jude
Edited by: Jude Silvester on Feb 4, 2009 2:09 PM
Hi,
As you mentioned in the below code, if you want to display all your previous messages
Follow these steps:
1.Create a global variable in the view say var1.
2. In the Display_Message method
var1 = var1+Message;
3.Add this code.
if (Error==false)
msgMNG.reportSuccess(var1);
else
msgMNG.raiseException(Message, true);
Regards,
Gayathri.
Hi Jude,
A very slight modification need to be done in your original code.
Follow this:
1. Initialise 1 global variable, say int Flag = 0;
2. private void Display_Message(String Message,boolean Error)
{
IPrivateIDocClientView.IContextElement element = wdContext.currentContextElement();
IWDMessageManager msgMNG = wdComponentAPI.getMessageManager();
if (Error==false)
{
msgMNG.reportSuccess(Message);
Flag = 1;
}
else
{
if (Flag==1)
{
String Combine = "Success \n"+Message;
msgMNG.raiseException(Combine, true);
}
else
msgMNG.raiseException(Message, true);
}
}
# New codes are in bold.
Hope this will work.
Regards
Chander Kararia
Edited by: Chander Kararia on Feb 5, 2009 11:02 AM
Hi,
Chander, I feel your code your code is not generic.
It will append message only in one scenario - First button (for success message) clicked & then second button (for failure message) clicked.
In other cases, the messages will not be appended. For example, click second button (for failure message) & then click first button (for success message)
Kind Regards,
Nitin
Nitin,
I know that & that is coded in that fashion only. If button 1 is not clicked, why u require "Success" after clicking button2. It should display only failure (that is what i presumed the requirement).
-
If not then the code will be more easier to write. There wont be requirement of any if inside else.
simply display the combination in else block.
regards
Chander Kararia
hi Jude,
1. create a global variable of type String which holds the previous message.
//@begin others
String prev_msg = null;
//@end others
2. adjust the method
private void Display_Message(String Message,boolean Error)
{
String temp = Message;
Message = prev_msg + Message;
prev_msg = temp;
IPrivateIDocClientView.IContextElement element = wdContext.currentContextElement();
IWDMessageManager msgMNG = wdComponentAPI.getMessageManager();
if (Error==false)
msgMNG.reportSuccess(Message);
else
msgMNG.raiseException(Message, true);
}
Plz close thread, if answered.
Thanks
nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Small correction required in last line of above code from Gayathri
msgMNG.raiseException(var1, true); // instead of argument 'Message'
Also, for better readability, you can put some space between the messages thru var = var + " " + Message;
Kind Regards,
Nitin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jude,
Hi Chander i think thats what he wanted (append both the messages so that he can print both)
Code which you need to declare global
//now you need to delclare one global variable between
//@@begin others
String success = "";
String failure = "";
String result = success +failure;
//@@end
Code for action of button one
String success = "Success";
Display_Message(result , false);
Code for action of button two
String failure= "failure";
Display_Message(result , false);
Else your other coding is fine.
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I got your problem but can you please tell me on click of a button from where are you getting success or failure message and how you are showing them.
Can you please paste the code which you are using as there are various ways you can append the messages but it all depends on your way of doing it.
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Narendra,
This is the code:
IPrivateIDocClientView.IContextElement element = wdContext.currentContextElement();
IWDMessageManager msgMNG = wdComponentAPI.getMessageManager();
msgMNG.reportSuccess("Success");
msgMNG.raiseException("Failure");
Jude.
Edited by: Jude Silvester on Feb 4, 2009 1:30 PM
Hi,
Can you please explain it clearly?
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
there are two buttons in my iview and a message area. On clicking Button one a message is displayed say "success", on clicking the second button message "failure" is displayed.
at runtime when i click button one the message "success" is displayed. when i click the second button the message "failure" is displayed, but the previous message "success" is erased.
My question is, Is there any way to append the messages, so i will not be able to lose the older ones..
thanks
Jude.
Edited by: Jude Silvester on Feb 4, 2009 1:00 PM
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.