cancel
Showing results for 
Search instead for 
Did you mean: 

Input field UI properties customization.

Former Member
0 Kudos

Can anybody tell me how to customize the dimensions of input field UI element. With my requirement I cannot go for TextEdit element as it cannot support the requestFocus() method to bring the cursor when user clicks on the button. The height and width properties are not editable. How else can I customize the dimensions.

Kind Regards

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

abhijeet_mukkawar
Active Contributor
0 Kudos

hi,

oops this is strange but if you write the same code of requestFocus() in wdDoInot(), it will give you cursor in textedit,

so if you can go ahead with wdinit(), then it will solve the problem,

regards

Former Member
0 Kudos

That nice!

How you get access to UI control in wdDoInit???

The better option is to use


IWDViewController.requestFocus(
  IWDNodeElement nodeElement, 
  IWDAttributeInfo attribute
) 

where element and attribute correspond to element and attribute displayed IWDInputField and IWDViewController is in fact wdControllerAPI of view. Worth to mention that this method may be called from any controller code like wdDoInit or button action handler.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Answers (8)

Answers (8)

former_member189631
Active Contributor
0 Kudos

Hi Sirinvas,

Have a Look at Size,Height,width properties of your Input Field.

Regards,

'Ramganesan K.

Former Member
0 Kudos

Hai,

you can create a context variable of type iwdtextedit,

in wdDomodify(){

wdContext.currentContextElement().setteUI((IWDTextEdit)view.getElement("textedit"));

}

in button action

wdContext.currentContextElement().getGg().requestFocus();

but this will also highlight the text edit not cursor placed in.

regards,

Naga

Former Member
0 Kudos

Could you be more clear here

"in button action

wdContext.currentContextElement().getGg().requestFocus();

but this will also highlight the text edit not cursor placed in."

Thanks for the reply

abhijeet_mukkawar
Active Contributor
0 Kudos

hi,

yeah shrinu, if code is standing outside the init() then it will just highlight the UI element, but if it is in init() then it will put curosr in it,

cant help it

regards

Former Member
0 Kudos

So you mean that I need to write the requestFocus() in the init method instead of the action handler?

abhijeet_mukkawar
Active Contributor
0 Kudos

yeah Srinu, if you write same code in init() and if it confronts to your need , it wil solve your purpose.

check it out

regards

Message was edited by:

Abhijeet

Former Member
0 Kudos

Thanks for the patience. But the problem still persists. I <b>can't</b> make the cursor to be in the text edit area on user action.

Maybe I need to open a note.

Former Member
0 Kudos

Sorry for the bad advice ..

Former Member
0 Kudos

Hi Srinivas,

Follow the steps below to get focus to TextEdit.

1. Declare static variable and initialize to false.

2. On click of button, make it true

3. In modify view, check if variable is true, use requestFocus() method.

Note: TextEdit control gets focus but cursor will not be placed in the control and thus user needs to click on the control to enter text. Therefore this approach still fails.

Best Regards,

Shiva

Former Member
0 Kudos

Hi,

Sorry for this advice.

Former Member
0 Kudos

Hi Srinivas,

You can do the following:

1. Define a static variable of type IWDTextEdit at end of the View Implementation.

//@@begin others
static IWDTextEdit l_TE;
//@@end

2. In wdDoModifyview write this.

if(firstTime)

{
	l_TE = (IWDTextEdit)view.getElement("<ID of Text Edit UI element>");
		
}

3.In your action for the button, write this.

wdContext.currentContextElement().setText_edit("<Add Your Notes Here>");
l_TE.requestFocus();

Text_edit : Context bind to value property of TextEdit UI Element.

Hope it helps.

Regards,

Alka.

Former Member
0 Kudos

Alka,

Ok, you win the prise for the worst advise.

NEVER EVER SHARE VARIABLES BETWEEN wdDoModifyView AND OTHER VIEW CONTROLLER METHODS VIA STATIC VARIABLES!

This causes errors in multiuser environment.

VS

abhijeet_mukkawar
Active Contributor
0 Kudos

yeah and even in production it may cause problem....

Valery,

it gives strange behaviour, putting same code in init() method set focus to the TextEdit but if same code gets executed in button action it just highlights the TextEdit UI element.

Shiva, TextEdit gets cursor placed in it , but if the code gets executed in init(), otherwise we need to click it.

regards

Message was edited by:

Abhijeet

Former Member
0 Kudos

Hello Valery,

I agree it is a bad advice.

I am sorry for that.

Regards,

Alka.

Former Member
0 Kudos

Abhijeet,

If it works from wdDoInit but not from action handler then it's definetly WD bug.

Check SAP Service Marketplace for available pathes to your NW version and if they didn't solve this issue then submit a bug to CSN.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Ough!

Just noticed that this advise should be addressed to Srinivas rather to you

VS

Former Member
0 Kudos

Hai ,

You can resize the input field by using size property,

but yu can't change the height of the input field.

regards,

Naga

Former Member
0 Kudos

Bad advise.

"size" property of IWDInputField is deprecated, also it affects only height of letters previously, not width of control.

So in brief it is impossible to change height of input field, but it's possible to change it width -- either via "width" property in percents or pixels or via "length" property in characters (default is 20 characters). "width" always overwrites "length".

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hai ,

Sorry,

Its not Size , width (in the element properties)

regards,

Naga

Former Member
0 Kudos

Hi Valery,

Thanks for your reply. How do I make the request focus on the textedit UI element when user clicks a button.

I have tried the following code in the doModify method:

TextEdit addNotes = (TextEdit)view.getElement("txe_activity_notes");

addNotes.requestFocus();

But still I cannot get the cursor in the textedit area on clicking button.

Thanks and Regards.

Srinivas

Former Member
0 Kudos

Srinivas,

Say you are displaying "MyAttribute" attribute from "MyNode" node.

Then put the following in <b>button action handler</b>:


final IWDNode myNode = wdContext.node<MyNode>();
wdControllerAPI.requestFocus(
  myNode.getCurrentElement(), 
  myNode.getNodeInfo().getAttribute("MyAttribute")
);

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Message was edited by:

Valery Silaev

Former Member
0 Kudos

Hi Srinivas,

As far I know, TextEdit do support requestFocus() method. You can use as follows in doModifyView() method.

TextEdit te = (TextEdit) view.getElement("name");

te.requestFocus();

For Input field, you can directly change width property but not height property.

Thanks.

Best Regards,

Shiva

Former Member
0 Kudos

Hi Shiva Kumar,

Thanks for your reply. I tried your code:

TextEdit te = (TextEdit) view.getElement("name");

te.requestFocus();

It doesn't have any effect when I click the button. I still wonder, how should I relate the user action with the doModify method. Because the cursor has to be placed in the textedit area upon user action.

Thanks and Regards

Srinivas

abhijeet_mukkawar
Active Contributor
0 Kudos

hi Shrinivas,

try putting width property of 100% or 50%, it will alter the width of input field.

same way you can adjust that in matrix layout by setting matrillayout propery's width in terms of %

sure it will work

regards