FLTK logo

STR #2751

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | SVN ⇄ GIT ]

STR #2751

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:Limit input field characters in fl_ask, fl_input and friends.
Version:1.4-feature
Created By:dfatfl
Assigned To:AlbrechtS
Fix Version:1.4.0
Fix Commit:130f864d1d3f02f854a5f4085a49318a03a8eea0
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 dfatfl
01:22 Oct 29, 2011
input-max.patch
5k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 dfatfl
01:22 Oct 29, 2011
Patch file fixing existing maximum_size() usage and adding new fl_password_n and fl_input_n to support limiting input on prompts.  
 
#2 AlbrechtS
05:10 Jul 21, 2015
Thanks for the request and the patch. This is a useful extension.

I'm currently working on this STR. Lots have changed meanwhile, so the patch was taken as a starting point, but the implementation will be different.

I'm not sure if we can (and want to) get this into FLTK 1.3.4, but this should definitely go into FLTK 1.4.0. Hopefully.

See /also/ STR #334 "technical change : remove statics in fl_ask" which is related. My planned solution will include both issues.
http://www.fltk.org/str.php?L334
 
 
#3 AlbrechtS
05:19 Jul 21, 2015
Note: AFAICT the Fl_Input widget used in fl_input() and fl_password() allows and honors the maximum_size() attribute. Hence the part related to Fl_Input_.cxx and Fl_Input_.H might be obsolete. This needs further tests.

FYI: My current patch (not yet ready to be posted here) does not add new methods fl_input_n() and fl_password_n(), but instead overloads the existing methods:

FL_EXPORT const char *fl_input(int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__ (__printf__, 2, 4)));
FL_EXPORT const char *fl_password(int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__ (__printf__, 2, 4)));

This is subject to further discussion.
 
 
#4 AlbrechtS
06:31 Jul 21, 2015
Okay, I tested input size limitation in my patched version(s) of fl_input() and fl_password(), and they honored the size limit w/o further hacks in Fl_Input*. I didn't check the source though, but I believe it should be okay.

The tests I did:

 - edit text (append or insert)
 - insert a longer (too long) string with ctrl/v
 - insert a longer (too long) string with DND

All cases worked well: inserted and/or appended text was truncated as expected.
 
 
#5 AlbrechtS
06:58 Jul 21, 2015
I committed your documentation updates in svn r 10807, as far as possible, and with some minor changes. Thanks for the patch again.

The rest of your patch will be addressed later.
 
 
#6 AlbrechtS
05:43 Jan 30, 2016
Sorry, this patch will not make it into FLTK 1.3.4, but will definitely be addressed in 1.4.0.

I changed the title to contain "fl_ask" and "fl_input" (can be used as search keywords in the STR list).

Moved to 1.4-feature.
 
 
#7 AlbrechtS
06:05 Dec 04, 2021
Fixed in Git repository.

Commit b6de09cff2465db3c0a6e6a013b825462bc9a0e7 fixes three STR's and one open issue:

- STR   334: technical change : remove statics in fl_ask
- STR  3242: Re-enable nested (aka "recursive") common dialogs
- STR  2751: Limit input field characters in fl_ask, fl_input and friends
- Issue 282: fl_choice() doesn't tell you if the dialog was closed
 
 
#8 AlbrechtS
09:43 Dec 04, 2021
Correction: fixed finally in commit 130f864d1d3f02f854a5f4085a49318a03a8eea0
because of a name clash on macOS and Windows.
 
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.