WPCubed Product Support

How to create a fixed width InputEditField field

Is it possible to create a fixed width InputEditField field without using the Courrier font ?

I am creating a question/answer form and I want to be able to have the answer region as a fixed width using the Arial font with a grey background. This has to work even if the keyboard is in insert mode. Currently, the closest to be able to do this is by using a Courrier font and pressing the insert key on the keyboard to disable the insert mode of the keyboard.

For example, I want the region between the [...] characters to be of a fixed width with a grey background (I have put _ characters so that it displays properly but in reality, I want spaces):

What is your first name: [ _____________________ ]

Can you please tell me how to do this.

Thanks,

#1 ♥ 0
7.8k Views 3 users read 2 min
support

Hi,

It is not so easy since it requires the dynamic adaption of the width of the end marker.

The OnEditFieldGetSize event has to be used.

procedure TWPEdTest.DataEditEditFieldGetSize(Sender: TObject;
const InspName: String; var EndmarkWidthTW: Integer;
var Option: TWPEditFieldAlignOpt; CurrentTextWidthTW,
CurrentTextCharCount: Integer; par: TParagraph; posinpar: Integer;
FieldObject: TWPTextObj);
begin
EndmarkWidthTW := (50 * 100) - CurrentTextWidthTW;
if EndmarkWidthTW<0 then EndmarkWidthTW := 0;
end;

Of course this only works if the insert points are visible.

Julian

#2 ♥ 0

Your code works properly when the input edit field is initially created but when I start typing text into it, the end marker position gets positionned back to the end of the input text.

Do you have another solution for this ?

I think this feature is really important. It will allow the creation of electronic forms with fixed width input fields (just like paper forms). For example in Delphi, when I create a TEdit field I can set it's width and when I type text into the TEdit, the width doesn't get resized as you enter text.

#3 ♥ 0
support

Hi,

No, sorry, I have no solution for this. This may be something to be fully implemented in version 6.

Julian

#4 ♥ 0

I have the same problem, so I reactivate this old thread.
Is there a new possibility to do the job now ?

#5 ♥ 0
This category is archived. No new posts are possible.