Jump to content

Clear icon in TUnimEdit


RobYost

Recommended Posts

If you put a TUnimEdit on a form and then change the .Text field the x-clear-icon image disappears.  

 

If you make a change to the field with your phone it comes back.

 

But the problem is I want to put a value in the field at form show.  This makes the X disappear and the user can not easily clear the field.

 

I was able to reproduce this on your basic mobile demo.

procedure TMainmForm.UnimButton1Click(Sender: TObject);
begin
  UnimLabel1.Caption := 'Hello World!';
  edt1.Text          := '2000.00';
  edt1.JSInterface.JSConfig('clearicon', [True]);
end;

clicking on UnimLabel1 causes the text in edt1 to change to 2000.00 and the x-clear-icon to disappear.

 

I then added the JSConfig line, but I get the following error.

 

 >>> Do you know how to fix this problem? <<<

 

---------------------------
Debugger Exception Notification
---------------------------
Project basic.exe raised exception class Exception with message 'Config Option: O30->clearicon:true<br/>is refering a previous request,<br/>it's not allowed in AJAX request or JS handler.<br/>Use equivalent Public Property or Method instead.'.
---------------------------
Break   Continue   Help   
---------------------------
 
Link to comment
Share on other sites

Thank you, that works.

 

But I have to call a function every time I want to change the value in code.

 

Is there a way for you to add this to the code, or tell me how to add it to a component derived from TUnimEdit.

 

Here is what I use:

https://unigui.miraheze.org/wiki/TmUniRyEdit

 

 

I tried adding DoOnChange and DoOnEnter, but neither was ever called:

protected    procedure DoOnChange; override;
    procedure DoOnEnter; override;


...


procedure TmUniRyEdit.DoOnChange;
begin
  inherited;
  JSInterface.JSCall('setValue', ['1000.00']);
end;


procedure TmUniRyEdit.DoOnEnter;
begin
  inherited;
  JSInterface.JSCall('setValue', ['2000.00']);
end;

 

Link to comment
Share on other sites

  • 3 months later...
How can I hide the clean content icon from a unimedit.

For many times this further disturbs what helps.

On most devices there is already an option on keyboards to handle this.

And such an icon occupies too much space

 

Again the suggestion is that the components for mobile have more options. 

post-1670-0-93352900-1521164846_thumb.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...