October 09, 2024, 04:34:07 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Andy's editor Q & A

Started by Andy, November 08, 2020, 03:40:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

February 05, 2021, 04:33:00 AM #51 Last Edit: February 05, 2021, 04:37:04 AM by Andy
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.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

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.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

February 10, 2021, 04:00:27 AM #53 Last Edit: February 10, 2021, 06:26:21 AM by Andy
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.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

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?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

February 15, 2021, 02:46:52 AM #55 Last Edit: February 15, 2021, 05:15:20 AM by Andy
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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.