Dynamic Placeholder

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
dominique
Posts: 50
Joined: Mon May 29, 2017 4:16 pm
Location: St. Gallen, Switzerland

Dynamic Placeholder

Post by dominique »

We want to use the Placeholder property instead a fieldlabel for mobile view. Unfortunately we can't set the placeholder value during the rezisizing process. Does anyone have an idea to solve it?

Code: Select all

Define_Com Class(#prim_acol<#prim_EVEF>) Name(#pFldFields)

Evtroutine Handling(#Com_owner.CreateInstance)
For Each(#Member) In(#Com_owner.ComponentMembers) Operation(*Instance_Of #prim_EVEF)

#pFldFields.Insert( #Member )

Endfor
Endroutine

Code: Select all

Evtroutine Handling(#Com_owner.DesignChanged) Design(#Design)
* If no design instance supplied, it must be the default "desktop" size
If (#Design *Is *null)
#Com_owner.SizeForDesktop
Else
If (#Design.Name = Mobile)
#Com_owner.SizeForMobile
Endif
Endif
Endroutine

Mthroutine Name(SizeForMobile)
#pFldFields<>.LabelPosition := None
#pFldFields<>.Height := 30
#pFldFields<>.MarginLeft := 0
#pFldFields<>.MarginTop := 50

For Each(#oFld) In(#pFldFields)
#oFld.placeholder := #oFld.LabelText
Endfor
Endroutine

Mthroutine Name(SizeForDesktop)
#pFldFields<>.LabelPosition := Left
#pFldFields<>.Height := 25
#pFldFields<>.MarginLeft := 150
#pFldFields<>.MarginTop := 0

* remove placeholder
#pFldFields<>.placeholder := *blanks
Endroutine

It's only possible to set the Placeholder during createInstance but not dynamic

Code: Select all

Evtroutine Handling(#Com_owner.CreateInstance)
For Each(#Member) In(#Com_owner.ComponentMembers) Operation(*Instance_Of #prim_EVEF)

#pFldFields.Insert( #Member )
#Member.placeholder := #Member.LabelText

Endfor
Endroutine

dannyoorburg
Posts: 177
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: Dynamic Placeholder

Post by dannyoorburg »

Hi Domique,

I think you found a bug in Visual LANSA. Changing the place-holder doesn't trigger the Edit Box to update.

If you change another Edit Box related property, like AutoSelect, afterwards, the new place holder gets applied too.

Code: Select all

Evtroutine Handling(#Button1.Click)

#STD_TEXT.Placeholder := ""

* Dummy change to trigger update...
#STD_TEXT.AutoSelect := *Not #STD_TEXT.AutoSelect
#STD_TEXT.AutoSelect := *Not #STD_TEXT.AutoSelect

Endroutine
Cheers,
Danny
Post Reply