Checking (not only) GUI capabilities

Usage of the framework, compiler and tools
dmaksimiuk
Posts: 28
Joined: Sun Jun 14, 2015 3:56 pm
Location: Delft, The Netherlands

Checking (not only) GUI capabilities

Post by dmaksimiuk »

Hi All,
I always tried to avoid any GUI programming in any language I have used :lol: (maybe except Matlab) and I was Ok-ish. Unfortunately/fortunately it is time to change it. I have started to use Robert's plotting libs, and so far I am happy with the results. To keep the story short, these are my questions:
1. Would be possible to redirect (or embed) the StdLog facilities within my own GUI (kind of log or message window) ?
2. Would be possible to create a GUI-emedded graphic object (bitmap) that can be used for displaying streaming data from a camera (like this one: https://www.matrix-vision.com/USB2.0-in ... uefox.html) ?
3. Would be possible to embed Robert's plots inside my GUI instead of opening an external window?

I have noticed that having resolution = 1000 ticks per second is not fast enough in some of my applications. Would be possible to change it to at least 10000 or even better to 100000 without destroying system's integrity and responsiveness?

BTW, I got an older version of this beatiful device:
http://store.digilentinc.com/analog-dis ... er-supply/
and I wrote a BBox (thin) wrapper for its DLL. If somebody is interested in it, please let me know.
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Checking (not only) GUI capabilities

Post by Ivan Denisov »

1-3 questions is "yes".
I do not think, that you need to change resolution. Try this experimental version with server mode in Edit -> Preferences.
http://blackboxframework.org/unstable/i ... a1.459.zip
It has less idle period, so your actions will run with 15ms instead of 50ms frequency.
Anyway, with windows it is not possible to have time resolution 10000.

It is always interesting if you make some bindings. Please, in such case do not be shamed to post it on the forum as attachment or link to any repository.
dmaksimiuk
Posts: 28
Joined: Sun Jun 14, 2015 3:56 pm
Location: Delft, The Netherlands

Re: Checking (not only) GUI capabilities

Post by dmaksimiuk »

Hi Ivan,
thanks for your replay. So, far I am using version 1.6 of the BBox because under newer versions I could not compile the ypk (I needed UDP functionality) subsystem due to some changes in the WinApi definitions.
If the answer to my questions is 3 x yes, then how I can achieve these results? Any reference to a relevant piece of documentation or a sample code would more than enough.

Cheers,
Darek
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Checking (not only) GUI capabilities

Post by Ivan Denisov »

1. StdLog is an extension of Log interface. So in all your project better use Log instead of StdLog. This will allow you to replace the realization by your own Log. The log
You can embedded Log facilities in any form by adding the multiline text field and linking it to some variable you put text of log.
This is small demo, how to do this:
My.zip
(2.43 KiB) Downloaded 403 times
In my example there is no scroll. It is just very coarse prototype to give you some example
Also you can make your own view for displaying the text by leading the instructions from (Part III: View Construction).

2 and 3 a bit later.
User avatar
Robert
Posts: 177
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Checking (not only) GUI capabilities

Post by Robert »

Ivan Denisov wrote:1. StdLog is an extension of Log interface. So in all your project better use Log instead of StdLog.
This seems like strange advice! The Log Docu seems to say "Don't use this". Can you explain?

To be honest I never notice that module Log existed - I've always used StdLog.

Robert
Josef Templ
Posts: 262
Joined: Tue Sep 17, 2013 6:50 am

Re: Checking (not only) GUI capabilities

Post by Josef Templ »

Log is the undocumented foundation of the logging framework.
StdLog is an implementation using a BlackBox text document for logging.
Other implementations are possible but currently only one is active at a time.

By using Log you can avoid problems in the import order:
If you need logging in a low level module you have to use Log.
This imports only Kernel, thus can be used in almost all modules.
As soon as StdLog is loaded the logging starts.

If no module imports StdLog (or loads it explicitly) there is no logging being done
even if Log is imported and Log.XXX is called.

In practice, using Log saves some typing and works well.

- Josef
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Checking (not only) GUI capabilities

Post by Ivan Denisov »

dmaksimiuk wrote:So, far I am using version 1.6 of the BBox because under newer versions I could not compile the ypk (I needed UDP functionality) subsystem due to some changes in the WinApi definitions.
Darek, I prepared compiled Ypk compatible with the last Center version.
Ypk17.zip
(1.41 MiB) Downloaded 377 times
This server issue was already merged with master. So you can try the last version:
http://blackboxframework.org/lastdev
http://blackboxframework.org/lastdev/zip.php

This incompatibility was because of WinNet changes:
http://redmine.blackboxframework.org/pr ... a46e/diff/
dmaksimiuk
Posts: 28
Joined: Sun Jun 14, 2015 3:56 pm
Location: Delft, The Netherlands

Re: Checking (not only) GUI capabilities

Post by dmaksimiuk »

Hi Ivan,
thanks for the compiled version of the ypk subsystem. I will give it try this weekend.

Just an idea. Maybe there should be a "beefy" version of the BBox environment that contains a set of compiled and installed subsystem (Pac,
Ctls, Cpc, Desktop, and for me Robert's Libs :), etc).

Then, when a new distribution is created it gives a compatibility check (and save lots of time and for a potential user).

Another approach is to have a "mega installer" that automatically installs selected subsystems from Helmut's collection.

Cheers,
Darek
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Checking (not only) GUI capabilities

Post by Ivan Denisov »

dmaksimiuk wrote:2. Would be possible to create a GUI-emedded graphic object (bitmap) that can be used for displaying streaming data from a camera (like this one: https://www.matrix-vision.com/USB2.0-in ... uefox.html) ?
Please take a look at the example in the FreeWindow module of the FreeImage subsystem.

Code: Select all

	PROCEDURE RestorePicture* (v: View; f: Views.Frame);
		VAR
			res: INTEGER;
			dc, dc1: WinApi.HDC;
			w, h: INTEGER;
	BEGIN

		v.context.GetSize(w, h);

		dc := f.rider(HostPorts.Rider).port.dc; (* Actual dc *)
		dc1 := WinApi.CreateCompatibleDC(dc);
		res := WinApi.SelectObject(dc1, v.bmp);
		f.rider(HostPorts.Rider).DrawBitmap(dc1, v.w, v.h, f.gx, f.gy, w, h);

		res := WinApi.DeleteDC(dc1)

	END RestorePicture;

	(* To display the imported picture in a stand-alone view *)
	PROCEDURE (v: View) Restore* (f: Views.Frame; l, t, r, b: INTEGER);
	BEGIN
		IF v.bmp # 0 THEN
			RestorePicture(v, f)
		END
	END Restore;
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Checking (not only) GUI capabilities

Post by Ivan Denisov »

dmaksimiuk wrote:3. Would be possible to embed Robert's plots inside my GUI instead of opening an external window?
For the example how to make control element from any view you can look the DiaPlotControl module from my DiaPlot subsystem.
Attachments
plotControl.png
Post Reply