on 06-05-2007 4:35 AM
Dear Experts,
I am new to java and WebDynpro, I need your help ..
How to change programmatically <b>TextView</b> control Font color or BackGround Color, and where i can write that.
Because depend on textview value it should change color indicator
Regards
It's answered.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wrao,
Create a context variable(Say TextViewColour) and assign the type as com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor (Choose this type from ur Local Dictionary->uielementdefinitions)
Then bind this variable to SematicColor pty of TextView.
From ur program, u can change the color as critical by
wdContext.currentContextElement().setTextViewColour(WDTextViewSemanticColor.CRITICAL);
Regards
Fahad Hamsa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wrao,
You have to use WebDynPro themes to change colors.
But in WebDynPro some certain colors you can apply.
There is one property semanticcolor of TextView.You try with that property.
Hope this will help.
Thx & rgds
AW
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Using a context attribute depends on you requirement.
If their is only one textView in your view then you can very well use
context attribute method. But if their are more than one textview whose coclur has to be changed during runtime, then you cannot bind the same context attribute to all the text view. In turn you have to create context attributes of type com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor equal tono of textviews.
If their are more then one textview whose color has to be changed during runtime,then you can do this in wdDoModifyview method of your view.
suppose you have two textviews textview1 and textview2 then
public static void wdDoModifyView(IPrivateFile_Sample_View wdThis, IPrivateFile_Sample_View.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if(wdContext.currentContextElement().getTextView1Value.equals("<comparing value>"))
{
IWDTextView textView1 = (IWDTextView)view.getElement("textview1");
textView1.setSemanticColor(WDTextViewSemanticColor.<choose your color>);
}
if(wdContext.currentContextElement().getTextView2Value.equals("comparing value"))
{
IWDTextView textView2 = (IWDTextView)view.getElement("textview2");
textView2.setSemanticColor(WDTextViewSemanticColor.<choose your color>);
}
//@@end
}
Hi,
If you want to change the background of the textview UI element,
then this is possible if your Layout data for UI element is GridLayout or MatrixLayout.
You can change the cell background colour as follows
IWDTextView textView = (IWDTextView)view.getElement("<textview ID>");
IWDGridData gridData = (IWDGridData)textView.createLayoutData(IWDGridData.class);
gridData.setCellBackgroundDesign(WDCellBackgroundDesign.<choose your colour>);
OR
IWDTextView textView = (IWDTextView)view.getElement("<TextView ID>");
IWDGridData data = (IWDGridData)textView.getLayoutData();
data.setCellBackgroundDesign(WDCellBackgroundDesign.<choose the background>);
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.