Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Color Valuenator(tm) by Steve the Awesome(tm)(c)
#5
(12-07-2022, 06:25 PM)Spriggsy Wrote: I didn't see any _TRIM in there, Steve. Might be worth it to _TRIM the string so you can be a little lenient if they mistakenly have a leading or trailing space.

Good catch.  As a stand-alone routine, it should trim leading/trailing spaces off for us.  For my needs, I didn't need it to do so -- all my strings are already validated and trimmed before calling this routine.  Wink

What I'm cobbling together is an enhanced Config System manager, for my stuff, and this is one piece of that excessively complex puzzle.

What I'm shooting for is a multi-step process:

1) Declare your config variable name, type, low/high limit, default value, and set value.

2) Then we can write these settings to the config file.  Entries will look like:

Background Color AS COLOR (&H00000000 TO &HFFFFFFFF) DEFAULT &HFF000000 = SkyBlue
Window X Position AS INTEGER (-10000 TO 10000) DEFAULT 0 = 400
Cursor At End AS BOOLEAN DEFAULT TRUE = TRUE
Wiki Address AS QSTRING DEFAULT BLANK = "https://wiki.qb64phoenix.com"

3) With this much information, we have a limited range which we can set for values, with a default value that we can fall back on if the user's value is invalid, and a very flexible system for writing our values in a format we like.   

It's readable, very flexible, intuitive from an user's perspective, and tons more coding to implement than I'd want to admit.   LOL!   After all, just the ColorValue part of the process comes in at  432 lines of code so far.
Reply


Messages In This Thread
RE: Color Valuenator(tm) by Steve the Awesome(tm)(c) - by SMcNeill - 12-07-2022, 06:54 PM



Users browsing this thread: 19 Guest(s)