How to integrate GraphicBox(s?) into WINLIBx

Discussions related to mouse, keyboard and Graphical User Interface
Post Reply
neiljeff
Posts: 5
Joined: Sat 30 Jun 2018, 15:16

How to integrate GraphicBox(s?) into WINLIBx

Post by neiljeff » Sun 01 Jul 2018, 11:35

Hi All,

* I'm wanting to migrate a Liberty Basic program to BB4W (and later BBCSDL on Raspberry Pi?)
* The program is a real time controller, which controls synchronisation of power generators to the electricity power grid.
* I've included a screen-shot of the Liberty Basic GUI component to give you an idea of what the controller GUI interface looks like.
* The many blue bar-graphs are updated at a rate of 1Hz or faster; while the graduation markings should remain static (not updated?).
* The yellow/black LEDs all turn yellow when the generator output is ready to synchronise to the grid, when CLOSE button could be pressed to close the switch to connect generator to grid.
* Liberty Basic includes a graphicbox with various buttons (etc.) in the GUI, which facilitates integration of the controller in the GUI window.
* I don't see an equivalent graphicbox to integrate with WINLIB2 (say?) in BB4W?
* My LB program consists of multi-window dashboards; which I imagine could be implemented using BB4W WINLIBx(?) library PLUS some other GRAPHICS library(?).

* I'm a newbie to BB4W, please give me some ideas on how this could be done?
* I'm wanting to rewite the GUI in BB4W; and not just speed it up with LBB.
* Perhaps someone could show me some links with BB4W code examples of similar dashboard applications that integrate WINLIB(2?) library functions PLUS graphbox in the same window?

Hope you guys can show me how?
Neil
Attachments
SyncScope_1.jpg
SyncScope_1.jpg (56.31 KiB) Viewed 1139 times

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

Re: How to integrate GraphicBox(s?) into WINLIBx

Post by DDRM » Sun 01 Jul 2018, 21:16

Hi Neil,

Welcome to the gang!

I can think of a few ways you could go about producing such bars. You could use standard Windows elements- perhaps a trackbar or a progressbar? Both are supported using WINLIB3 (or WINLIB 2 in a dialogue box). Neither is really intended for what you want, but might be suitable.

To be honest, for something that looked like your existing ones, I'd probably just write a routine to produce them. That would work fine in your main window (you could get standard Windows elements using WINLIB5), but would be more difficult if you plan to implement your interface in one or more dialogue boxes. I note that you have 2 windows, which might tip you towards using dialogue boxes (one of which might or might not be docked to your main window), but you could also use the MULTIWIN library to give you two BB4W windows.

Not quite sure what you mean by your "graphic box" in Liberty Basic, since I'm not a user of that, but most of the standard Windows elements (buttons, radio buttons, edit boxes, list boxes, etc....) are directly supported by the WINLIB libraries. The manual gives simple examples of most things, but please ask here if you can't work how to do what you want.

Best wishes,

David

neiljeff
Posts: 5
Joined: Sat 30 Jun 2018, 15:16

Re: How to integrate GraphicBox(s?) into WINLIBx

Post by neiljeff » Mon 02 Jul 2018, 08:15

Thank you David,

* You're right, I could do it with trackbar or progressbar, but I'm also probably luke warm on that.

* I would appreciate it if you could take a couple of the example programs in BB4W such as DLGDEMO.BBC and add some BB4W code to print a few simple bargraphs as you suggested; written directly into the "dlg%" dialogue box? (As a newbie, I am battling with this)

* With respect to Liberty Basic "graphic box", here are some random examples of a few GUI controls including the "graphicbox" definition:

Code: Select all

    statictext  #mainSScontrol.statictext1, "V bus bar", 330, 50, 105, 16
    statictext  #mainSScontrol.statictext2, "V generator", 330, 80, 105, 16
    stylebits   #mainSScontrol.button1, _BS_MULTILINE, 0, 0, 0
    button      #mainSScontrol.button1, "Info", [InfoSynchroScope], UL, 45, 40, 160, 30
    graphicbox  #mainSScontrol.gboxLEDDecrGenVolts, 224, 288, 20, 20
    graphicbox  #mainSScontrol.SyncStatus, 224, 148, 20, 20
* Together with buttons, radiobuttons, edit boxes etc, LB has included the possibility of doing graphics directly in the dialog box, using graphicbox; so just like you could print into a text box like this:

Code: Select all

    print #mainSScontrol.tboxVbb, USING("###.#", VoltsBB)
* You could also print into the graphicbox like this:

Code: Select all

    print #mainSScontrol.gboxLEDVbb, "delsegment mainSScontrolVbbSegID"   ' discard previous graphics command
    print #mainSScontrol.gboxLEDVbb, "down; fill yellow"
    print #mainSScontrol.gboxLEDVbb, "segment mainSScontrolVbbSegID"
    print #mainSScontrol.gboxLEDVbb, "flush"
regards,
Neil

Zaphod
Posts: 39
Joined: Sat 23 Jun 2018, 15:51

Re: How to integrate GraphicBox(s?) into WINLIBx

Post by Zaphod » Wed 04 Jul 2018, 18:50

Neil,

if your aim is to make it suitable for SDL then BB4W is probably not a good intermediary. The WINLIBs use WIN32 API which won't work on other platforms. You need to build your graphics from primitive BBC BASIC drawing commands or tap into the SDL API's directly if you want to use it on these other platforms. While that is likely to be tedious it is probably possible.
I would suggest that Richard is the only one likely to have enough information to get you started on that. He has made dialog like constructions in SDL based versions and of course in the IDE for the SDL version which is written in BBC BASIC. The code for those are in the Windows version of the SDL package which may give you some ideas.

Z

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

Re: How to integrate GraphicBox(s?) into WINLIBx

Post by DDRM » Thu 05 Jul 2018, 08:51

Thanks, Zaphod,

I also meant to say (but forgot to add it...) that if you are thinking of going on to implement it in SDL then going down the "roll your own" route (for all the controls) looks more attractive than doing it one way in the Windows version but then having to re-write the interface for the SDL.

Indeed, you could sensibly just go straight to the SDL version (which will also work in Windows). That version does include libraries for creating both multiple windows and dialogue boxes.

If you DO want to go down the Windows Dialogue box route, AND want to draw your own controls (I envisaged you doing it in (one of) your main windows, with other elements provided through WINLIB5(A)), then at least at one stage Richard had a BBC BASIC window type - indeed I think that's how MULTIWIN works. You might be able to incorporate that into a dialogue box, though I'm not sure how.... You might be able to adapt the code in MULTIWIN.

Best wishes,

D

neiljeff
Posts: 5
Joined: Sat 30 Jun 2018, 15:16

Re: How to integrate GraphicBox(s?) into WINLIBx

Post by neiljeff » Thu 05 Jul 2018, 08:57

Hello Z,

Thank you for your pointers in the right direction. Yes I would like to use it for Linux and Windows applications. I've had the SDL version of BBC-Basic running some of the example programs on a RaspberryPi and it looks impressive.

I'm wanting to migrate from LB for the same reason... ie. to run real time systems on lean Linux environments.
Maybe Richard or some other magician will come up with the rest of the solution?

regards,
Neil

neiljeff
Posts: 5
Joined: Sat 30 Jun 2018, 15:16

Re: How to integrate GraphicBox(s?) into WINLIBx

Post by neiljeff » Thu 05 Jul 2018, 09:08

Hi Z,
It seems our last messages crossed each other in the ether...
I will take another look at your suggestions in your last message and then respond.
Mean time, has someone perhaps used BB4W in DASH BOARD type applications? You know eg., dash boards for IT/website management?
Thank you,
Neil

neiljeff
Posts: 5
Joined: Sat 30 Jun 2018, 15:16

Re: How to integrate GraphicBox(s?) into WINLIBx

Post by neiljeff » Thu 05 Jul 2018, 09:10

Sorry guys, I was confused with Z and D.
Thanks to you both.
Neil

Post Reply