Tree View routine

Discussions related to mouse, keyboard and Graphical User Interface
Post Reply
DDRM
Administrator
Posts: 82
Joined: Mon 02 Apr 2018, 18:04

Tree View routine

Post by DDRM » Wed 15 Aug 2018, 12:27

Richard is keen to provide in BBC-SDL an equivalent of the "CrossReference" utility which is available in BB4W. The actual code is not a problem, since that is already written in BASIC, but he needs a way to display it, preferably in a tree view, as in BB4W. There it is implemented as a Windows control, but for this purpose it would need to be programmed in BBC_SDL's own graphics.

I asked about how data needed to be passed, and suggested that the MSDN pages are a bit intimidating. He agreed, and suggested:

"A better [starting point] might be an existing BBC BASIC program that creates a Tree View, because that would show the context and scope of the typical usage. The best-known such example is probably the Disk Usage program here:

http://bbcbasic.co.uk/bbcwin/examples/dskusage.html

Basically the entirely of the interface to the Tree View control is the TVM_INSERTITEM message, so if an approximation of that functionality could be devised it would meet the likely requirements."

Any one interested in taking it on?

DDRM
Administrator
Posts: 82
Joined: Mon 02 Apr 2018, 18:04

Re: Tree View routine

Post by DDRM » Wed 15 Aug 2018, 12:52

Some additional comments on my perception of the problem might or might not be useful.

In the Windows control, you tell Windows to set up the control, then you send it messages adding bits of data, saying where to insert them, etc. You can also send messages to show/hide branches. The control (or Windows in the background!) does all the memory management, etc.

My guess is that for a pure BBC solution you'll need to take care of storing/organising all the data yourself, perhaps in a linked list, including flags for which branches are open. I'm guessing you might need an initialisation routine which takes a maximum number of entries so you can arrange an array (of structures?), then perhaps additional routines to add data to the list and update links between them, and to display the output.

You'll need to think about font sizes: SDL programmes may end up on devices with very different screen resolutions/sizes, so what looks fine on a computer screen may by miniscule or enormous on a phone!

For anything but small trees you are likely to need the window to scroll down (and potentially even across).

Solutions to some of these problems will be found in existing library routines supplied with BBC-SDL - so I suggest a ferret around there before trying to reinvent the wheel...

...except maybe Michael, whose tagline specifically says he LIKES reinventing it....

Don't be afraid to have a go at part of the problem - indeed, I might have a play with the "core" elements, and leave someone better at SDL to do the final interface.

:-)

D

mikeg
Posts: 32
Joined: Sat 23 Jun 2018, 19:52

Re: Tree View routine

Post by mikeg » Sat 08 Sep 2018, 04:55

except maybe Michael, whose tagline specifically says he LIKES reinventing it....
This is true. Once I am sober I may reconsider my approach. (probably not, as I have been thinking about this for a very long time..) A cross reference utility would be an asset.. No need to reinvent it, as I have already made the tools for organizing the display.. I will get on this once my calculator is done.(which could have been done a long time ago if I was not delaying my projects due to ongoing decisions that embrace entropy. (lack of order or predictability: gradual decline into disorder) If you look back in the old forum (BBC4W) you will see a HTML/CSS program that has the ability to generate interactive pages. As with anything, this can be improved. I know this is not a new concept, but a HTML/CSS program generator is a practical solution.

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: Tree View routine

Post by guest » Fri 30 Nov 2018, 15:53

DDRM wrote:
Wed 15 Aug 2018, 12:52
Don't be afraid to have a go at part of the problem - indeed, I might have a play with the "core" elements, and leave someone better at SDL to do the final interface.
What's the current status of this? Almost every day I'm frustrated by the lack of the Cross Reference utility in BBCSDL: I end up having to copy-and-paste programs into BB4W for the sole purpose of running that utility. Half the time I then get confused about which IDE I'm working with and start making changes to the (unsaved) program in BB4W's editor rather than BBCSDL's editor, and rapidly get in a muddle!

DDRM
Administrator
Posts: 82
Joined: Mon 02 Apr 2018, 18:04

Re: Tree View routine

Post by DDRM » Fri 30 Nov 2018, 18:19

Hi Richard,

I'm afraid I haven't made any progress on this: it's all a bit fraught at work at the moment, and nothing else requiring much intellectual activity is getting done...

Best wishes,

D

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: Tree View routine

Post by guest » Sun 02 Dec 2018, 13:48

DDRM wrote:
Fri 30 Nov 2018, 18:19
nothing else requiring much intellectual activity is getting done...
I sincerely hope that doesn't include your entry for the SyntaxBomb adventure competition, or perhaps you've finished it already?!

DDRM
Administrator
Posts: 82
Joined: Mon 02 Apr 2018, 18:04

Re: Tree View routine

Post by DDRM » Mon 03 Dec 2018, 09:13

It mainly involves learning about and preparing a subject level TEF presentation. You really don't want to know any more than that (unless, I suppose, you have children/grandchildren on the verge of university).

Actually, I did spend a couple of hours over the weekend starting to code for the Syntaxbomb competition, having spent some time lying awake planning the "plot", but I won't have time to make it very fancy, I'm afraid: text-only.

:-(

D

svein
Posts: 10
Joined: Tue 03 Apr 2018, 19:34

Re: Tree View routine

Post by svein » Fri 07 Dec 2018, 18:34

I have started to work on this.
Connecting lines and mouse navigation working.
Tested with BBCsdl windows version.
Do you want some or all of the keyboard navigations ?
Arrows,home,end,pgup,pgdn,bksp and pressing a key jumps to 'words' starting with the same letter ?

How do you prefer to pass the data ?
Some code would be helpful.
The output from the following code would do.(included in DATA)

Svein

Code: Select all

      A%=0
      a=0
      DEF PROC1 : A%=FN2 : ENDPROC
      DEF FN2 : =0

      DATA Main program
      DATA Global variables
      DATA Static variables
      DATA A%
      DATA Variant variables
      DATA a
      DATA Functions
      DATA FN2
      DATA Procedures
      DATA PROC1
      DATA Functions called
      DATA FN2
      DATA Shared variables
      DATA Static variables
      DATA A%
      DATA Warnings
      DATA Possibly unused variables
      DATA Main program
      DATA a
      DATA Possibly unused functions or procedures
      DATA PROC1
      DATA Shared static variables
      DATA PROC1
      DATA A%

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: Tree View routine

Post by guest » Fri 07 Dec 2018, 19:24

svein wrote:
Fri 07 Dec 2018, 18:34
I have started to work on this.
Thank you!
How do you prefer to pass the data ?
As DDRM posted earlier in the thread, the method that would maximise compatibility with BB4W would be a function with a similar functionality to the TVM_INSERTITEM message.

svein
Posts: 10
Joined: Tue 03 Apr 2018, 19:34

Re: Tree View routine

Post by svein » Fri 07 Dec 2018, 21:13

Ok, a lot to read. I'll finish the GUI first.

Svein

Post Reply