Quantcast
Channel: Small Basic
Viewing all articles
Browse latest Browse all 669

Small Basic - Hammer and Nails

$
0
0

One of the great things about Small Basic is that you have to be imaginative to solve problems, since there is such a small set of commands.  This makes it fun to use even when you have quite good programming skills - it is still a challenge to get it to do new things more efficiently.

There was a recent Small Basic forum question that highlighted this for me, and reminded me of the saying...

"If the only tool you have is a hammer, then everything looks like a nail"

 

In other words for programming - "if you know one way of doing something, then this may be how you try to do everything".  This is a very good lesson to be mindful of.


I had been adding and fixing some methods for a Small Basic extension, when I saw this post by jricestk (JR).

TextWindow Issues Can't Show after hiding textwindow

"I have tried this on 2 computers that are running windows8.1 and get the error that is in the image.

TextWindow.WriteLine("Here")
TextWindow.Hide()
TextWindow.Show()

Can anyone confirm that they get the same error? If I comment out the 1st line I don't get the error. This does occur with no extensions present."

A few posts later it was confirmed that it appeared to be a Small Basic bug and some-one suggested perhaps an extension could be written to create a fix for it.

It was a simple fix and I had just been working on extensions so I created a couple extension commands to handle hiding and showing the TextWindow.  Job done.


Then came a post by Jibba Jabba with simple and effective workaround without any need for extensions reminded me of the Hammer and Nail proverb.

"Hello jr

What about a simple work around?

I use this for both TW and GW, it solves any clearing of the TW and any Shapes issues for the GW."

TextWindow.WriteLine("hello, hide for 3 seconds")
Program.Delay(2000)
 
lastTop = TextWindow.Top
TextWindow.Top = Desktop.Height
Program.Delay(3000)
TextWindow.Top = lastTop

 


So all you have to do is move the TextWindow off the desktop, and return it to show it again - cool - lesson learned again.


Viewing all articles
Browse latest Browse all 669

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>