Liberty BASIC Community Forum
« Problem: Texteditor doesn't work programmatically »

Welcome Guest. Please Login or Register.
Jan 23rd, 2018, 7:21pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Problem: Texteditor doesn't work programmatically  (Read 434 times)
tsh73
Board Moderator

member is offline

Avatar

Anatoly (real name)


PM

Gender: Male
Posts: 1732
xx Problem: Texteditor doesn't work programmatically
« Thread started on: Oct 5th, 2016, 01:44am »

(It was a hard to find bug in a program)
Problem:
Texteditor doesn't work programmatically
That is, you see Texteditor on a form
Then program runs, you can type/select/copy/paste there
But all operations on a textbox from a program - printing or !cls - does not make any visible effect
Does not ring any errors either.

Cause:
(due to convoluted program execution path involving GOTOs and GOSUBs) it happens that line defining texteditor
TEXTEDITOR #handle.ext, xpos, ypos, wide, high
got executed twice.
It resulted in creating TWO texteditors, one above other
And all programmatical activity went to below one.

Example:
Code:
nomainwin

    WindowWidth = 416
    WindowHeight = 215

    UpperLeftX=int((DisplayWidth-WindowWidth)/2)
    UpperLeftY=int((DisplayHeight-WindowHeight)/2)

    texteditor #main.texteditor1, 26, 16, 216, 120
    'texteditor #main.texteditor1, 26, 16, 216, 120 'uncomment this line - and see texteditor stops working
    texteditor #main.texteditor1, 16, 06, 216, 120  'Now I moved it up - and I see text prints in this control
        'which for some reasom ends up UNDER (Z-order) first one
    button #main.button2, "Button Caption", [button2Click], UL, 270, 16, 122, 25
    menu #main, "Edit"    '<--- Texteditor Menu can be moved but not removed.

    open "Overlaid texteditor (by doubling)" for window as #main
    print #main, "trapclose [quit.main]"

    wait

[quit.main]
    Close #main
    END


[button2Click]
     #main.texteditor1 "Hello there"
    wait
 
« Last Edit: Oct 12th, 2016, 09:36am by tsh73 » User IP Logged

damned Dog in the Manger
JackKelly
Guest
xx Re: Problem: Texteditor doesn't work programmatica
« Reply #1 on: Oct 5th, 2016, 02:45am »

My sympathies, Anatoly. I hope you were able to smile when you found the error. But few bugs are easy to find, don't you agree. I'm thinking of writing a wiki article on debugging techniques. Not that I'm an expert, just a big offender...
User IP Logged

tsh73
Board Moderator

member is offline

Avatar

Anatoly (real name)


PM

Gender: Male
Posts: 1732
xx Re: Problem: Texteditor doesn't work programmatica
« Reply #2 on: Oct 5th, 2016, 03:28am »

Quote:
I'm thinking of writing a wiki article on debugging techniques.

Please do.
If it would be on WIKI and structure of article would be easy to pick, probably some folks could contribute adding their techniques (that is if you did not cover all of them wink)

There is an article on LBPE by Alyce
Debug Your Code an overview of debugging methods
but I somehow don't like it - probably it differs with my understanding of "debug". Or I cannot get article structure.

(btw1 I think that porting a program from other BASIC is very similar to debugging, but in this case you start with totally not-runnable program (due to syntax differences), but likely could run it in other BASIC to see how it should work)
(btw2 I wonder if adding an example of debugging a thing in the end would be possible/do any good?)
User IP Logged

damned Dog in the Manger
JackKelly
Guest
xx Re: Problem: Texteditor doesn't work programmatica
« Reply #3 on: Oct 5th, 2016, 09:31am »

Your enthusiastic response has inspired me to get moving on the debugging article. It will take a little time, though. I'm a better coder than writer, and that's not saying much! I think Alyce's fine article is an excellent point of departure. With everyone's input, we can hopefully come up with something that encompasses many 'tricks of the trade' that have been learned by hard experience.

Be thinking of a good 'case study' for a conclusion that brings everything together. I will too...

Jack
User IP Logged

Alyce Watson
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Female
Posts: 14918
xx Re: Problem: Texteditor doesn't work programmatica
« Reply #4 on: Oct 5th, 2016, 10:09am »

on Oct 5th, 2016, 03:28am, tsh73 wrote:
There is an article on LBPE by Alyce
Debug Your Code an overview of debugging methods
but I somehow don't like it - probably it differs with my understanding of "debug". Or I cannot get article structure.


I just revisited the article. I do like it, because it addresses the issues I meant to address. The focus was on reaching brand new programmers and giving them the tools to find their own errors; from building a program structured for easy debugging, to using the debugging tools provided, to creating their own debugging printouts. (And reading the help file!)

What it does not address is advanced debugging techniques for experienced programmers like Jack and Anatoly.

A new article for advanced debugging would be most welcome!
User IP Logged

Alyce
Liberty BASIC Workshop - a complete IDE for Liberty BASIC


Alyce's Restaurant
for Liberty BASIC code, tools and references
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

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