Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] Limit amount to 8 decimal digits #977

Closed
wants to merge 1 commit into from

Conversation

pythcoiner
Copy link
Collaborator

fixes #798

@jp1ac4
Copy link
Collaborator

jp1ac4 commented Feb 26, 2024

I'm wondering if this should rather be done at the form level, similarly to how we trim whitespaces:

pub fn new_trimmed<F>(placeholder: &str, value: &Value<String>, on_change: F) -> Self

E.g. we could add new_amount_btc() that trims any excess decimals before passing the value to the on_change function.

@pythcoiner
Copy link
Collaborator Author

I'm wondering if this should rather be done at the form level, similarly to how we trim whitespaces:

pub fn new_trimmed<F>(placeholder: &str, value: &Value<String>, on_change: F) -> Self

E.g. we could add new_amount_btc() that trims any excess decimals before passing the value to the on_change function.

i'll look into this, also i think we can filter out char other then "0123456789." and maybe automaticaly replace , by . ?

@pythcoiner
Copy link
Collaborator Author

deprecated in favor of #992, following @jp1ac4 advice

@pythcoiner pythcoiner closed this Mar 3, 2024
edouardparis added a commit that referenced this pull request Mar 20, 2024
9415dc9 new_amount_btc (pythcoiner)

Pull request description:

  This PR replace #977 and fixes #798
  I've followed jp1ac4 advice and create a `Form::new_amount_btc()` method that act like `Form::new_trimmed()` ~w/ few more (filtering) features:~
  ~- allow only input of "0123456789,." characters~
  ~- "," is replaced by "."~
  ~- only one "." separator~
  ~- maximum 8 digit after separator~

  ~these features works for keyboard input or paste~

  ~i've tryied to add a "0" in case the String start with a "." but this make the cursor have a bad location and i do not find a way to control the cursor location w/ iced, so i revert this feature~

ACKs for top commit:
  jp1ac4:
    ACK 9415dc9.
  edouardparis:
    ACK 9415dc9

Tree-SHA512: c8387e5fd9c3c030a71d0ba4a7aa3cd7f834215000f04e4e4d6b689c6bc9bf9dcecbf8b0799882f00f92d5bb8a656714f5149479e7f25e608a0ce96326a6e630
@pythcoiner pythcoiner deleted the issue_798 branch March 26, 2024 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit the send amout value field to 8 decimals
2 participants