Board Logo
« TextBox interprets Tabs »

Welcome Guest. Please Login or Register.
Feb 25th, 2018, 7:58pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: TextBox interprets Tabs  (Read 69 times)
AltBas
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 464
xx TextBox interprets Tabs
« Thread started on: Feb 5th, 2018, 12:32pm »

I made a little programming error and made a little discovery, it took me several minutes to realize what was happening. I was grabbing data from the wrong place in a string and was getting data prepended with a chr$(9) TAB. Of course, it's Windows interpreting the data sent to the textbox, so it was doing what it's supposed to do.

Here's a little self-crashing program to show the behavior. When you get to 33, JustBASIC tries to interpret the string as a command, which it isn't, and so stops with an error.

Code:
  char = 8
  M$ = "Howdy!"

  textbox #test.tb 10, 10, 100, 30
  textbox #test.tbChr 120, 10, 40, 30
  button #test.bNext "Next", [AddChar], UL, 10, 50, 50, 30
  button #test.bCls "Close", [Done], UL, 10, 100, 50, 30
  statictext #test.st "", 10, 140, 250, 200

  open "Demo" for window as #test
  #test "trapclose [Done]"
  #test.st "Click the Next button to add the next " +_
    chr$(13) + "character to the head of the string and " +_
    chr$(13) + "see the behavior." +_
    chr$(13) + chr$(13) + "Of course, the program will crash when" +_
    chr$(13) + "it tries to prepend a chr$(33) - a '!' command char."

  wait

[Done]
  CLOSE #test
  END

[AddChar]
  #test.tbChr char
  T$ = chr$(char) + M$
  #test.tb T$
  char = char + 1
  wait
 

If you happen to prepend a chr$(0) to the string, the string doesn't display because Windows sees that char as a 'C' language string terminator, and so displays an empty string.

Unfortunately, ListBox doesn't interpret tabs.

- AltBas
« Last Edit: Feb 7th, 2018, 10:57pm by AltBas » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls