IonicWind Software

IWBasic => Tutorials => Topic started by: Andy on November 08, 2020, 03:40:07 AM

Title: Andy's editor Q & A
Post by: Andy on November 08, 2020, 03:40:07 AM
I'm releasing the next beta version of my editor today.

And I think a Q & A post would keep the beta version post nice and clean.

So please, if you have any questions / observations etc, please post them here.

Thanks,
Andy.
 :)
Title: Re: Andy's editor Q & A
Post by: Brian on November 08, 2020, 04:52:26 AM
Hi, Andy,

Well, it compiled OK (rather than using the supplied exe), but when it opens it shows the active file as DemoFile.iwb, but doesn't show the program's text. Even when opening it myself, I don't see anything

I also quickly maximised the window, and noticed that the controls don't resize. Is that something you are still working on?

Brian
Title: Re: Andy's editor Q & A
Post by: Andy on November 08, 2020, 05:49:59 AM
Brian,

I made an amendment to the zip file - you were too quick for me! Try downloading it again.

I have just made a new folder, downloaded it, extracted the files to the new folder and compiled it.

Everything is okay here and on Anne's laptop too.

Does the original exe file load it okay?

Attached is the screen shot.

Strange?

Close the demo file & try loading one of your own files...

Andy.
Title: Re: Andy's editor Q & A
Post by: billhsln on November 08, 2020, 01:05:56 PM
Strange results.  I ran the compiled version, closed all files and then closed the program.  Reopened the program and it comes up 'Untitled.iwb', now load any file and the title at the bottom stays 'Untitled.iwb' and if you open another file, the code switches in the RTF, but the name on the bottom stays 'Untitled.iwb'.  Now close the program and bring it back up and you have 'Untitled.iwb' and the other 2 programs that you loaded showing at the bottom.  I then deleted the Untitled and close the program and reopen and it looks fine.

I did this 3 times and it is repeatable.

Bill
Title: Re: Andy's editor Q & A - Bug fix 1
Post by: Andy on November 08, 2020, 08:22:11 PM
Bill,

Thanks, that's bug number 1 - logged.

Seems it doesn't like going down to zero files.

Attached is a screen shot for a manual fix when you get the problem.

You have to manually edit it's start up file (xeditor4.ini)

1. Close the editor program.

2. Edit the xeditor4.ini (found in the Res folder)

3. Type in one full path to an IWB file on your machine.

4. Save the file & close it.

5, Restart the program.

For now, we need to keep to at least one file open until I can fix it.

Please see attached.

Thanks for reporting it.

Andy.
Title: Re: Andy's editor Q & A Bug 1 Fixed
Post by: Andy on November 09, 2020, 04:28:20 AM
Hi,

Just to let you all know, I've fixed the bug.

I've also added a recent files option in the File menu, everything looks good.

I will test repeatedly over the next day or so, when I'm happy I will post an amendment to the Beta 2 version of the editor.

You will be presented with just one "Untitled" file on first time use, which you will be able to close, then just browse to your files.

Took another 8 hours of works but that's nothing compared to some of the other things I've had to do with my editor.

Looks good.

Andy.
:)
Title: Re: Andy's editor Q & A
Post by: billhsln on November 09, 2020, 01:25:57 PM
Another little minor bug.  When you open the editor and the files don't exist, it still shows the names at the bottom with no code showing.

Bill

Title: Re: Andy's editor Q & A - Can someone test for me please
Post by: Andy on November 11, 2020, 12:17:55 AM
Can anyone test for me please?

What I need testing is this:

When you first open up the editor, it should be blank with some buttons greyed out.

Now if you browse in the "Bin" folder, you will see a copy of Brian's Age calculator IWB file.

Can you open it please (in this / my editor program) and tell me if it shows a tab at the bottom (left of screen) a tab with the name "Age calculator" in it.

I've tried here on three different machines at it works on all of them, but Bill reports differently - he says the first time he opens a file it does not show the tab.

It is possible I might have missed sending him something.

Attached is the test zip file - you don't need to compile the program - there is an exe file ready made... Andy's editor (in the "Bin" folder).

Please could you let me know if it works or not.

Thanks,
Andy.
Title: Re: Andy's editor Q & A
Post by: Egil on November 11, 2020, 01:05:33 AM
Hi Andy,

Nice work!
But am a little confused.

The first time I tried your exe Brians code appeared to load, but all I could see is what you see in pic #1 below. No scrollbars, and no filename in lower left corner. I exited the program whithout closing the file first.

The second time I started the program and tried to load Brians code, the only difference was that the up/down scrollbar appeared, but was not able to scroll the code to see the rest of the file. See pic #2.

The third time the program was started, Brians code was alreadty there, the filename was shown in lower left corner, and the scrollbars worked. I was able to scroll up and down the file. And guess it all now worked as planned.
See pic #3.


Egil
Title: Re: Andy's editor Q & A
Post by: Andy on November 11, 2020, 02:04:17 AM
Thanks for taking the time Egil, nice to talk to you again!

Screenshots appreciated.

It could be something to do with the ResizeTabs routine.

The controls FileTab1 to FileTab6 are set to zero width on creation, when you load a file the tabs are resized according to the program name.

It's possible it cant work it out and the width is remaining zero - hence you won't be able to see it.

But that leaves the question, why does it work on three different machines for me?

I need to check it out.

Glad you like what you see anyway - thanks again.
Andy.
Title: Re: Andy's editor Q & A
Post by: Andy on November 11, 2020, 02:32:45 AM
Egil,

Any chance you could go to the LoadWindow sub, change FileTab1 to a width of 225
(Line 13729)

Then put a RETURN statement in SUB ResizeTabs

SUB ResizeTabs()
RETURN '<---- like that.

Before you do that, in the "Res" folder, please
delete AgeCalulator.pth
delete AgeCalulator.txt

And edit xeditor4.ini to one line
!0     

Exclamation plus a zero.

If you have the time...

Thanks,
Andy.
Title: Re: Andy's editor Q & A
Post by: Egil on November 11, 2020, 03:33:10 AM
Quote from: undefinedBut that leaves the question, why does it work on three different machines for me?

Andy,
There are numerous examples of Windows programs that behave different on computers set up on other language systems than the programs were compiled on. For some obscure reason Microsoft issue different versions of their DLLs with the various language setups.
This was very easy to see when I in addition to my norwegian language systems also had a laptop with american language setup. I once bought it in Vancouver, BC. Unfortunately I gave that laptop away a couple of years ago.
But usually my own software worked ok on the system it was compiled on.

Having this in mind, I recompiled your code, and when trying to run the program I discovered that now the program started as in step two in my post above. The same happened if I closed the program after first closing the loaded file. But If I just closed the program whithout closing the loaded file first, it worked as in step three above, when restarting the program.


Tried to edit the code as you suggested, but FileTab1 is set up as a constant and I was unable to find a location in your code where it is dimensioned. Wonder if I have the same version of the code you are working on? Screendump is showing the section of the code you are referring to.

I'll try to help you as much as I can, and today I have nothing better to do...


Egil

PS
When doing the other things you suggested, it all was only a mess trying to run program after after compiling.


Title: Re: Andy's editor Q & A
Post by: Andy on November 11, 2020, 03:48:31 AM
Thanks Egil, I really need help on this one.

When I said about FileTab1 what I meant was setting the initial size & height:

CONTROL w1,@BUTTON,"",0,647,225,20,@CTEDITLEFT,FileTab1 '<-- like this

Then just putting a RETURN line straight after SUB ReSizeTabs() so it just returns without doing anything.

The program will load more correctly because each file loaded generates 2 files.

1. A .pth file
2. A .txt file.

So after making the code changes, and before compiling / running it you need to go to the sub folder "Res" and delete any .txt files, and any .pth files.

Finally, edit xeditor4.ini so there is only one line in it:

!0

An exclamation mark plus a zero and save.

That sets everything back to before you ever used it.

Thanks,
Nice to have a friend to help out.

Andy.
 
Title: Re: Andy's editor Q & A
Post by: Egil on November 11, 2020, 04:07:29 AM
Sorry Andy...

I didn't think properly. just haven't used IWB for a couple of years.

After making the changes you suggested, the filename is now shown in lower left corner, but still unable to scroll the file. But after exiting the program whithout closing loaded file, everything works as intended when the program is restarted. The loaded file is there and you can scroll up/down.

Trying to study your code, but sure will need time to understand it all.... :)


Egil
Title: Re: Andy's editor Q & A
Post by: Andy on November 11, 2020, 04:15:54 AM
Thanks Egil,

There must have been something there that I wasn't supposed to include hence the fault.

I've now put something in place so when using it for the very first time it will make sure none of these files exist, either that or it's the resizing of tabs.

Think I will remove that just in case.

In the latest release (with this bug in it) there is a help file "Code of interest".

If you want to have a look around the code (and it's a big one) this would be your starting point, otherwise you and everyone else might understandably get confused. Something that happens to me all the time I can tell you!

Thanks for your help - greatly, greatly appreciated.

Andy.
 :)

Title: Re: Andy's editor Q & A - Two new features
Post by: Andy on November 12, 2020, 05:55:33 AM
While I work on the initial first time use of the editor, I decided to have a break  and add in a couple of new features.

1. Control names are now coloured, a very useful visual effect.
( If colouring is too much for you, you can simply turn things back to black )

2. When you are searching controls, you can now select a control & add in other words to it to give you a fast, less typing & powerful search.

Just click on the "Find control in the file..." checkbox and it does the rest for you.

Please see attached.

Andy.
Title: Re: Andy's editor Q & A
Post by: billhsln on November 12, 2020, 11:56:11 AM
I would think that coloring the Control Names would be confusing.  Maybe doing something like an italicized font or maybe underlined?  Just to make it stand out for what it is.  Since you are coloring commands, comments and other stuff.  I would think underlined might be easier to read then italicized.

Bill
Title: Re: Andy's editor Q & A - Test 2
Post by: Andy on November 15, 2020, 02:19:01 AM
Well here goes again.

I've changed the file tabs back to a fixed size for now, and just in case, when you run this it will purge the "Res" folder of any text files.

The only text file that should be in there is "First.txt".

Please could you do three things for me:

1. Run the program, browse to any IWB file to open it.
2. Tell me if there is a tab with the file name in it at the bottom of screen.
3. What size in MB's does task manager report it is.

Testing would be greatly appreciated.

Thanks,
Andy.
Title: Re: Andy's editor Q & A
Post by: Brian on November 15, 2020, 04:23:45 AM
Andy,

If you open up the editor without any previous files being open, the icons on the left don't always appear

And the scrollbar appears to jump to the bottom at times, so you can't grab it to move down the opened file

Brian
Title: Re: Andy's editor Q & A
Post by: Andy on November 15, 2020, 05:35:25 AM
Brian,

The icons on the left only "light up" after you have opened a file.

The scroll bar won't work likewise until the editor has a file opened.

So your step 1 is to browse to an IWB and open it.

Andy.
Title: Re: Andy's editor Q & A
Post by: Brian on November 15, 2020, 06:25:07 AM
I understand what you are saying, but this happened: I loaded up the program, and closed two opened IWB files. I then closed the program, and re-started it. OK so far. Then I opened up an IWB file. Only three icons on the left lit up, and the scrollbar control "square" was down at the bottom

Brian
Title: Re: Andy's editor Q & A
Post by: Andy on November 15, 2020, 07:10:32 AM
Thanks Brian.

I get what you say now.

But when you first opened it and browsed to a file did it show the tab name at the bottom?

Andy.
Title: Re: Andy's editor Q & A
Post by: Brian on November 15, 2020, 08:30:55 AM
Yes - just tried it again

Brian
Title: Re: Andy's editor Q & A - New feature for faster coding
Post by: Andy on November 18, 2020, 05:09:27 AM
After thinking hard on how I program, I realised that when I'm working on some new section of code & using a particular control type (that I've used before) that I'm searching around for the same code examples.

Let's take a list view control:

What things am I likely to want?

CONTROLCMD(w1,ListView,@LVDELETEALL)
CONTROLCMD(w1,ListView,@LVGETTEXT,a,0,text)
CONTROLCMD(w1,ListView,@LVSETTEXT,a,0,text) etc...

So it would be very handy and speedy to have these things ready to hand.

That's what I've done here, just click on the new "Fast code" button, select the control type and up comes a list of things concerning that control type that you might want.

You can select which lines you want, send them to the clipboard, the paste them into you code FAST.

Better still, you can amend the list yourself so you can have what ever you like in there.

See attached screen shots.

Andy.




Title: Re: Andy's editor Q & A - First time use test
Post by: Andy on November 20, 2020, 12:25:31 AM
Hi,

Can someone test for me please?

It's two simple tests (exe file already included).

Please unzip the attached file.

In the Bin folder, please run Andy's editor (or compile a new copy - single file compile if you wish).

When you run the program at this point, you will see the "Welcome" message, there won't be a scroll bar or any tabs. Please ignore the on screen instructions and do test 1.

Test 1.
Go to FileTest first time use.
Make sure "Don't resize tabs" is selected.
Click "Test".

When the program restarts, after running test 1, you will get the welcome message again, open one of your IWB files please.

A. Do you see a tab at the bottom of the screen with the file name there?
B. Can you scroll?



Test 2.
Please do as test one describes, but this time select "Resize tabs".
Click "Test".

When the program restarts, after running test 2 open one of your IWB files please.

A. Do you see a tab at the bottom of the screen with the file name there?
B. Can you scroll?


Tried this on as many machines as I can get my hands on my end - all looks okay.

The results would be very helpful as I'm ready to post the latest editor version with more functions & bug fixes, just need to know the first time use works now.

Thanks,
Andy.
:)
Title: Re: Andy's editor Q & A
Post by: Egil on November 20, 2020, 02:22:06 AM
Hi Andy

When starting this version of the editor for the first time, the welcome text was shown whithout scrollbars. No file name was shown in lower left corner.

Then I opened Brian's code, and both scrollbars where shown, but I was only able to scroll horizontally. Now the filename was shown in lower left corner.

After exiting the program whithout closing the edited file, and then restarting the program, I was able to scroll up/down and left/right. The filename shown in lower left corner.

Hope this worked on my system as intended.

Good Luck!

Egil
Title: Re: Andy's editor Q & A
Post by: Andy on November 20, 2020, 02:30:38 AM
Egil,

Thanks for that.

With the welcome screen up, there is no scroll bar or tab name - so that's correct at that point.

Can I ask, before opening Brian's code, did you do both tests?

The editor needs to purge some of it's internal work files before opening a file on your machine for the first time.

Both Test 1 & Test 2 purge these files for you.

Andy.
Title: Re: Andy's editor Q & A
Post by: Egil on November 20, 2020, 04:08:10 AM
Sorry, forgot to mention the tests.

After both tests I saw the filename in lower left corner after loading, but was only able to scroll horizontally in both cases.

Now I'll stay at home the rest of the day, so if you want me to test more, just give me a word.


Egil
Title: Re: Andy's editor Q & A
Post by: Andy on November 20, 2020, 04:20:35 AM
Thanks Egil,

It would be a help!  :)

1. Can you go to the "Res" folder please, and delete out all *.txt & *.pth files.
2. In the same folder, please create a new text file simply called first.txt - just a simple empty file.

Then run the program again for me & try one of your files (one that I don't have here).

On opening a file, or clicking on a tab the scroll range should be updated to the number of lines the rich edit has, so you should always be able to scroll whatever the file.

Thanks,
Andy.
Title: Re: Andy's editor Q & A
Post by: Egil on November 20, 2020, 04:45:02 AM
Deleted the files you mentioned and made a new empty text file.
Then I loaded my own file called skeleton.iwb. The filename was shown in lower left corner, and was able to scroll both horizontally and vertically.

Then I closed the file, and tried to load it a second time. Now the filename was shown in the corner, but no file was loaded into the edit window.


Egil
Title: Re: Andy's editor Q & A
Post by: Egil on November 20, 2020, 04:54:43 AM
Forgot to say that when loading my own source file the second time, I clicked the icon "open file".
When trying to use the file menu, nothing happened.

egil
Title: Re: Andy's editor Q & A
Post by: Andy on November 20, 2020, 05:21:12 AM
Thanks Egil,

Think I'm getting closer.

In the "Res" folder, do you see / can you open skeleton.pth & skeleton.txt? (open with notepad)

Can you paste in what they both say in the files please.

The .pth file should give you the full file path name.
The .txt file will have some details about what skeleton.iwb subs, windows has etc.

These files are an old hangover from when loading files took "some time", and I think I can bin these now. If that's the case I will work on that tomorrow - started at 5 am this morning!

Thanks,
Andy.
Title: Re: Andy's editor Q & A
Post by: Egil on November 20, 2020, 05:35:27 AM
I attach both files in a zip-file.

Egil
Title: Re: Andy's editor Q & A
Post by: Andy on November 20, 2020, 05:53:53 AM
Egil,

Supremely helpful.

In the txt file you have

:sr-0!1  = Scroll range.

From zero to line 1.

It should be how ever many lines are in the rich edit, and as you say the rich edit is empty, that makes my mind up - these files are going to be binned.

I simply don't need them anymore after implementing fast loading of files.

I will remove the creation of these files, and test tomorrow without them and see how I get on.

Thank you so much my friend for taking the time!

Most helpful...

Andy.
:)
Title: Re: Andy's editor Q & A - Can someone send me a file please
Post by: Andy on November 24, 2020, 10:32:24 PM
Well,

Woke up this morning with what I think is the answer to the first time scrolling problem.

Before I used the fast loading of a file code (which I need), I was adding a CHR$(13) + CHR$(10) to every line before setting the rich edit with the file.

The fast loading code doesn't (or rather I can't) add these to every line.

I remember in the dark and dim past why I was adding these to every line...

I had the same initial problem with some files.

So I need to test a file.

If you are able to, can you send me a file that you could not scroll with the first time you loaded it into my editor please?

It's the only way I can test this theory out.

Many thanks,
Andy.
:)
Title: Re: Andy's editor Q & A
Post by: Egil on November 25, 2020, 02:33:56 AM
Hi Andy,

Attaching the file I used for testing.


Good Luck!

Egil
Title: Re: Andy's editor Q & A
Post by: Andy on November 25, 2020, 03:46:06 AM
Egil,

Thanks for the file.

After testing it I realised what I was asking!

As this file has been loaded before in my editor, even if you could not scroll, on exit the file will have been corrected.

Seems there are differences between the IWB editor and mine.

Any chance of a different file or a couple of files you didn't try to load into my editor?

I'm sure I'm correct on what dawned on me this morning...

Thanks,
Andy.
 :)
Title: Re: Andy's editor Q & A
Post by: Egil on November 25, 2020, 06:34:26 AM
Here are two more files to try.


Egil
Title: Re: Andy's editor Q & A
Post by: Andy on November 25, 2020, 07:10:51 AM
Thanks so much Egil,

I will have a look at them.

Thanks again for all your help!

Andy.
 :)
Title: Re: Andy's editor Q & A - New version this week
Post by: Andy on December 14, 2020, 04:11:32 AM
I was going to post the new version of the editor yesterday, but found a problem with a variable called Ucase.

Bill explained why it was happening, so after fixing that I came up with another feature:

Wouldn't it be nice if we could pick a program's window, and list all the controls with their creation line number and where applicable, their case statement. When you're working on a program, especially a larger one its another huge time saver.

Just create the list, save it somewhere for reference, or make a new one at anytime...

This I've put into place, so it only take a couple of clicks to do it.

Just checking everything and dotting the I 's.

Attached is what I can produce for my main window w1.

Keep watching please...
Andy.
Title: Re: Andy's editor Q & A - New version available for download
Post by: Andy on December 17, 2020, 04:26:31 AM
The new editor version is now available to download.

http://www.ionicwind.com/forums/index.php?topic=6448.msg47254;topicseen#msg47254

Thanks,
Andy.
Title: Re: Andy's editor Q & A - Two new features
Post by: Andy on December 28, 2020, 05:56:39 AM
Hi,

Well it's all quiet on here as expected, but I thought I would just let you all know about two new features coming before the year is out.

1. I've been asked about a stand alone version of the editor, so I have now made it. All you will have to do is to double click the exe file (when copied to a new folder) and it will do any setup required for you.

2. Another idea was to be able to group controls together (your choice).

Take this scenario:

You have an edit control, surrounding it is a static, some buttons like "Add", Edit","Delete" etc...

When you type something in the edit control, you want the buttons to appear, and when the edit control is empty, you want them hidden.

So now you can create a group name "Edit control 1", and add in the above controls to this group.

Next, you can then select what typical command line you want like .... @SWSHOW ...

Finally, just click on create code, and all the controls in your group have the command line ....@SWSHOW... sent to the clipboard.

You can then just paste that into your code.

I will add a user defined command before posting.

Another time saver!

See attached.

Andy.
:)
Title: Re: Andy's editor Q & A - 2020 version now finished
Post by: Andy on December 31, 2020, 03:38:27 AM
The final version of the editor for this year is now complete.

I have added in to grouping controls and creating code windows the ability to search by:

Windows
Control types
Control groups

There is now a user defined edit box for adding in your custom commands:

MaskEditControl(w1,Button1,Something) would be entered as
MaskEditControl(w*,c*,Something) - w* for the window, c* for the control.

All controls selected will be added to this custom command, replacing W* with the window it resides in, and c* with the control name.

It's taken a couple of days longer than I thought (of course), and because it's New Years eve today I think I will post this on the 2nd or 3rd of January as it's likely to get lost in the Happy new year's day messages.

Due to upload limits, I will post this in two parts:

1. The source code.
2. A stand alone exe file.

Thanks,
Andy.
:)
Title: Re: Andy's editor Q & A - Editor version 5.0
Post by: Andy on January 11, 2021, 06:39:04 AM
Hi,

Just thought I would bring anyone who is still interested in the editor as to  what I am doing at the moment.

Thanks to Aurel & LarryMc, I have now been able to use a tab control in this new version, I had a horrible feeling it was going to be a huge re-write, but thankfully it's not.

At the moment I have set the maximum tabs to 50, but it will be up to you to decide.

And all seems to be working well.

The other thing I touched on was a debug function, I think it would be a great addition to do a "pre-compile" check of your code.

I very often type a full stop instead of a comma, and also miss one or more ")' closing brackets on a line.

Any suggestions for what you would like to check for please let me know here.

Thanks,
Andy.
 :) 
Title: Re: Andy's editor Q & A - Welcome back Hecktor
Post by: Andy on January 16, 2021, 11:11:32 PM
Welcome back Hecktor,  :)

It's been a while so I thought I would bring you up to speed on my editor, I hope you have a look at it.

Maybe it might give you some ideas for yours...

A short summary:

1. I continued to work on this all year, usually around 8 hours a day.
2. It is much much more than just an editor now, more like a new programming tool.
3. It eventually got to 28,000 + lines of code.
4. You can list all controls in any window.
5. You can jump straight to a control's creation line, or it's CASE statement.
6. It has the ability to search an open file for not just an exact search but
also multiple words on a line e.g. IF THEN GOTO.
7. You can create and drop in pre-made lines of code.
8. You have the ability to copy whole subroutines and windows.
9. You can easily jump to a subroutine or window.
10. You can easily jump to a window's handler.
11. You can enter line numbers to jump straight to.
12. Auto complete of IWB key words is included.
13. It has it's own built in tailor made undo & redo functions.
14. Included is my Win API search program containing 4,000 + messages, notifications & values etc.
15. A nice surprise - I found using both mine & LarryMc's editors together meant that I could actually program much faster.

The link below is the final version of 4.x - there are no doubt still some bugs in it which will be fixed in version 5.x

I'm now working on version 5.0, which includes unlimited number of tabs / open files.

Version 5.0 will also include a "pre-compile" check for an opened file,
e.g. if you have missed a " ) " on a line and how many etc.

Here is Version 4.x (scroll to the end of the thread):
http://www.ionicwind.com/forums/index.php?topic=6448.0

I would be interested to see what you think of it.

Nice to see you back.

Andy.
:)
Title: Re: Andy's editor Q & A - Debug code
Post by: Andy on January 19, 2021, 05:23:13 AM
Hi,

For those of you who are still interested, I have now completed the transition to tab controls with all the file functions working.

As promised, I have now begun the debug section.

Here you can click on a button and a new window will open.
In that new window, I will add buttons / check boxes etc with specific debug tests.

I already have one, "Syntax", which checks the number of (, ), [, ], brackets on each line. If there is an imbalance, it will be listed in a listview control.

I will now move on to full stops, which I am always typing instead of a comma etc...

To test this, I deliberately made some typing mistakes.

Please see attached.

Thanks,
Andy.
:)
Title: Re: Andy's editor Q & A - Any thoughts?
Post by: Andy on January 19, 2021, 08:07:33 PM
I was wondering if you have had a look at my editor Hecktor?

Yes, we do like to share code on here, in fact many of the people here have helped me with the editor e.g. testing, help out with difficult problems etc.

Each and every one of them giving their time to help.

I think you must have some extra ideas no one has mentioned yet?

Any ideas would be great.

Thanks,
Andy.
:)
Title: Re: Andy's editor Q & A - Debug code quicker
Post by: Andy on January 27, 2021, 03:45:23 AM
Well,

Brian sent me some code that was driving him round in circles, (and let's face it, we've all been there).

This was what the compiler said:

(449) Error: syntax error
(450) Error: syntax error
(412) Error: unexpected end of sub: missing ENDIF
(412) Error: unexpected end of sub: missing ENDIF

He suspected it was something to do with a SELECT / ENDSELECT or an IF statement, and from what I could see there were no syntax errors in the code...

Now by a strange coincidence I was working on adding other features to my debug function in the editor, so I decided to see if it could make any more sense of things.

It told me there was a missing ENDSELECT and a missing ENDIF (see attached).

Now, armed with these facts, I was able to firstly work through the IF's / ENDIF's and then the SELECTS's.

It helped me to fix the compile error, but of course I don't know if I have ended up changing the logic of the program - that's a different matter.

The debug buttons added so far do the following:

Syntax, checks each line for things like ( ) [ ].
For, checks for FOR / NEXT blocks.
Select, checks for SELECT / ENDSELECT blocks.
IF, checks for IF / ENDIF blocks.
Do, checks for DO / UNTIL blocks.
While, checks for WHILE / ENDWHILE blocks.

It might not sound much, but you can really "zoom in" to a problem quickly rather than pulling your hair out!

Any more debug check suggestions would be very welcome.

Andy.
:)
Title: Re: Andy's editor Q & A
Post by: Brian on January 27, 2021, 09:39:19 AM
Andy,

I tried your program first before I sent it to you, but I couldn't make out which was the debug button. I knew you had put some code in for debugging

Brian
Title: Re: Andy's editor Q & A
Post by: Andy on January 29, 2021, 04:37:25 AM
Brian,

The debug function you will have will be for the previous version (version 4.x).

The new debug function (in version 5.x I'm working on now) is different.

Version 4.x was just to check the line you are on for ( ) [ ] brackets, and it would tell you if there was an imbalance.

I put on hold (removed the debug option on screen) so I could concentrate on posting the final 4.x version.

The new debug function checks for quite a few things more now.

I can send you a copy if you like...

Andy.
Title: Re: Andy's editor Q & A - To save or not to save?
Post by: Andy on January 29, 2021, 05:07:06 AM
Had a thumping head ache this morning, but while staying away from the PC and trying to ignore the pain I found myself thinking of when you should ask someone to save their file.

We have two distinct things:
1. Undo / redo's
2. Saving the file.

The two are not the same...

If, when you save a file, you clear the undo / redo's you've lost the ability to undo your changes, so that's no good.

I decided that when you load a file, you should have two buffers.
1. To hold the text as it is now.
2. To hold the text as it was when you loaded the file.

When you come to close the editor down, it compares the two, if they are different - ask to save the file.

Should you click on the save button before closing the editor, both buffers become the same for that file.

Just an idea for anyone interested, and it was quick to implement.

Andy.
Title: Re: Andy's editor Q & A - Update for the interested
Post by: Andy on February 05, 2021, 04:33:00 AM
Bill did (as always some great testing for me the other day), and most things seem to be working okay now.

Saving files:
Well, going back on my old findings, it seems that we can just save what's in a buffer to the file itself without stripping off carriage return characters.

I've loaded the editor code into the editor itself and made numerous changes, clicked save etc, and the same goes for other people's code.

Once loaded back into the IWB they compile with no errors.

One thing I found, you have to be careful with hex strings...

I have the IWB editor to display in uppercase, and a hex string looks like this:
0XFFFFF. My editor was actually saving the hex string as you see it here (upper case X), and that causes a compile error.

It seems the "X" must be in lower case "x" - 0xFFFFF.

So, the editor now saves a hex string with a lower case x.

Loading files:
Version 4.x was limited to 6 files, I now use a tab control (as most of you know) and it's set to a nominal 50 tabs - think that's enough for now.

Apart from that, all seems okay at the moment.

Shout if you would like a copy to test, I will release a general test version soon.

Andy.
:)
Title: Re: Andy's editor Q & A - Bored? Fancy testing Version 5
Post by: Andy on February 07, 2021, 01:11:58 AM
Well, sorry to hog the forum again, but if you are bored, looking to pass an hour or so then you could have a go at compiling / running / testing version 5 of the editor (attached).

After only 1 month starting on the new version, here it is, and it's gone much faster and easier than I thought it would have...

Do and Don't!

Don't:
Load the only copy of your iwb files into this editor.

Do:
Make a copy first (of your iwb files) and load the copies in.

What's new:
Version 5 is a "sea change" from version 4.
Here I am using a tab control, which is set to a nominal maximum of 50 tabs.

You will see a lady bird "bug" button (bottom left of screen), this will bring up the debug screen which has the beginnings of my code checking section.

I had a problem with partial key words being set to upper case,

e.g. GetMyProc() was displaying as GETMyProc(), this in now fixed.

I mentioned about the 0X problem, that too is now fixed.

Learning from my mistakes in version 4, this version now uses one buffer (TBuffer) with much more information stored in it, so most things are under one roof.

I'm also saving the file directly from the buffer, which is a faster way and seems to work well.

Apart from the include file, version 4 was just one large single file, here I am now splitting it up into separate files which is both easier to work with and should help to to understand the program a little more.

Extra keys:
ESC will close the program.
F1 will undo an action.
F2 will redo an action.
F8 will give you the option to reset the editor.

Compiling:
Please read the "ReadMe" txt file for instructions.

Testing:
Could you load some of your files into the editor, and generally switch between them using the tabs.

Scrolling should not be an issue.

Could you make a couple of changes to a file, say insert a blank line, save it.

When you load this file into your IWB editor, can you still compile it?

And of course, just general usage of the editor.

Please ignore the console screen, I use that for tracing etc.

All bugs / feedback are very welcome!

Thanks,
Andy.
:)
Title: Re: Andy's editor Q & A - Auto complete lines of code
Post by: Andy on February 10, 2021, 04:00:27 AM
Hi,

Now this is a big big time saver...

This is a typical scenario:

I'm typing the word OPENWINDOW, and so far, I've typed "openw".
The auto complete key words list appears and "OPENWINDOW" is highlighted.

The shear fact that I'm intending to type "OPENWINDOW" implies that I will type something like this:

OPENWINDOW w1,0,0,1350,725,@MINBOX|@MAXBOX|@SIZE|@TOPMOST|@CAPTION,0,"Main window",&main

But that's quite a bit of typing to do.

With the auto key words list showing, if I now press the Ctrl key while OPENWINDOW is showing, release the Ctrl key & now press <Enter> the whole line appears!

It's just a case of changing whatever you need to...

OPENWINDOW w1,0,0,w,h,@MINBOX|@MAXBOX|@SIZE|@CAPTION,0,"",&handler

I have added this function to over 30 key words like SETCONTROLTEXT etc.

Should you be working on a particular window or control, you can now specify the window or control name in a new section of the program (a screen), so you can have:

SETSELECTED(Win1,Combo2,x), "w1" is replaced with your window, and "Ctrl" is replaced with your control.

As a bonus, it helps to cut down on syntax errors, and in most cases supplies you with the correct number of parameters for that key word.

I have to say, I have been using this all morning, and it's super fast for writing code!

Andy.
:)
Title: Re: Andy's editor Q & A
Post by: LarryMc on February 14, 2021, 01:16:27 PM
Quote from: Andy on February 10, 2021, 04:00:27 AMNow this is a big big time saver...

Kinda like the work a visual designer does for you, huh?
Title: Re: Andy's editor Q & A - Three ways to save time
Post by: Andy on February 15, 2021, 02:46:52 AM
Kind of "yes" / "no" Larry.

I can only talk about how I code and this is what I find for me...

I can hold several things in my head such as:

1. Do this first
2. This next
3. Finally do this.

But then I realise I need a new button which when clicked will do the above.

Now, usually at this point I've been working of say a subroutine or something other than a control, this when I get frustrated, I just want to find a button control and copy it.

To do that, I have to either move off from where I am in the code and find one, or change files to one I know has a button control line in it.

Either way, I have to go search for one.

Quite often, at this stage after finding a button control line I forget what I needed to do i.e. steps 1 to 3.

So I've put in place three ways for fast coding.

1. Auto complete a whole line of code based on a partial key word typed

e.g. OPEN and key presses (Ctrl + <Enter>) will give you OPENWINDOW w1....... &Hndlr


2. A check box (when clicked) will show 12 buttons with 12 common things you want

e.g. OPENWINDOW, CREATEDIALOG, STATIC, BUTTON, EDIT controls etc.


3. Make your own blocks of code.

If you create a new IWB file, drop in / type what you want then save it to the "Res" folder, you can at any time drop this code into your current code.

Please see screen shots.

As I have said before, these are really great time savers and it's so easy & fast.

As for writing an actual visual designer program, well that's not for me!

Andy.