Silverfrost Forums

Welcome to our forums

Figure in application

27 Jun 2013 1:16 #12512

Would like to add a figure in an application as shown below. This user then automatically sees the definition of the variables. Do I have to compile the figure as a resource to make it 'part' of the program. Which ClearWin function would be the best to use?

[URL=http://imageshack.us/photo/my-images/545/18s.png/]http://img545.imageshack.us/img545/2093/18s.png[/URL]

   WINAPP
   INTEGER i,winio@
   i=winio@('%ca[A beautiful bitmap]&')
   i=winio@('%bm[mybitmap]%2nl%cn%`bt[OK]')
   END
   RESOURCES
     mybitmap BITMAP c:\\bitmaps\\pic1.bmp

or

  WINAPP
  INTEGER winio@,i
  i=winio@('%ca[Image bar]%sy[3d]&')
  i=winio@('%bd&',0.0D0,0.0D0,0.5D0,1.0D0)
  i=winio@('%mn[File[Exit]]&','EXIT')
  i=winio@('%3ib[flat]','cut/Cut',4,'CONTINUE',
+ 'copy/Copy',4,'CONTINUE', 'paste/Paste',4,'CONTINUE')
  END

  RESOURCES
  cut BITMAP cut.bmp
  copy BITMAP copy.bmp
  paste BITMAP paste.bmp
27 Jun 2013 3:57 #12518

Basically you need winio@ with %bm, %im or %gi. Probably the best option is to use %im with a jpeg image. Alternatively, if you get the latest beta download of salflibc.dll you could try %im with a png file. The main advantage is that these files use compressed data and so are much smaller than bmp files.

27 Jun 2013 4:20 #12519

You have many choices. If you use %bm, you can pre-draw the bitmap and use it in the resources as you have done. %bm is good because if you want to, you can make the image clickable, like a fancy button. If you use %ic you again need to pre-draw the bitmap, but it will appear against a background of the window, whatever that is. You need to become very skilled with icon editors, and that is difficult. I would recommend %bm. And yes, you have to compile the image. You can do this is a RESOURCES section if your program uses few resources, but if you use many resources, it is better to put them all in a resource file (of type .rc) and pre-compile it with SRC

My alternative response would be to use a %gr area. In the first instance, I would put a bitmap in using IMPORT_IMAGE@, so it isn't much different to %bm, and still needs the image in the resources section. However, with a %gr you could rescale and redraw the image when the dimensions changed by putting a subroutine call to redraw the image into the callbacks for each dimension. In this case, you don't need a pre-drawn image (although it might be easy to have one for use at startup) and you will need a lot of programming. A %gr area will have the 3D look of the input boxes in your window, but if you want them for a %bm you will have to draw them yourself.

Eddie

27 Jun 2013 4:25 #12520

Paul posted while I was writing. With lossy compressed file formats like JPEG you will get noticeable visual artifacts for a line drawing - they are fine for photos etc. PNG and GIF are better than JPEG for line drawings, and more equivalent to %bm. If you have a static image you specify it in your set of WINIO@ calls, if you change the image you do that in your callbacks.

E

28 Jun 2013 6:05 #12524

Thanks - I will try the mentioned options!

ClearWin is really a fine addon. Until know I have use it for very simple calculations in a more or less 'DOS-Box' environment. Here feedback from another application.

Recently we integrated this very simple tool in a larger and more complex design program. In oder to do so we just added an option to parse command line arguments. The cool idea behind this is that: We can run the program parsing the input file and variables as a simple text-file (or whatever format is required). No GUI appears and the results are written to a file for further processing.

Should the user need the 'old' tool for standalone calculations, one can invoke the GUI by neglecting any command line arguments.

And the best of all: The maintanance effort is the same - one program in two solutions.

[URL=http://imageshack.us/photo/my-images/195/xrfy.jpg/]http://img195.imageshack.us/img195/8166/xrfy.jpg[/URL]

28 Jun 2013 8:47 #12525

I agree - Clearwin+ enables 'old dogs' to learn 'new tricks' (according to folk knowledge, they cannot!).

I am enormously envious that you can get a printer icon onto the caption bar. Even though the current Windows User Experience Guide says that you should not do it, it looks great. How do you do it?

Eddie

28 Jun 2013 9:56 #12526

Hi Eddie

The printer icon is done automatically by a program called Hardcopy. I could not find any information in English. Anyway the website shows some screen shots.

28 Jun 2013 3:15 #12528

The website comes up in English for me! Thanks.

Eddie

Please login to reply.