BBC BASIC for Windows
« Displaying a histogram in a dialog box »

Welcome Guest. Please Login or Register.
Apr 6th, 2018, 12:26am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Displaying a histogram in a dialog box  (Read 1077 times)
g3nrw
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 74
xx Re: Displaying a histogram in a dialog box
« Reply #6 on: Aug 5th, 2014, 05:44am »

Richard

I don't understand your reply:

on Aug 4th, 2014, 11:09pm, Richard Russell wrote:
See my earlier post


Which "earlier post"?

Quote:
an ordinary non-dialogue window looks as if it would suit just as well):


Don't understand: your 4-window "Hello world"/graphics example *is* in a dialog box.

--
Ian


User IP Logged

rtr
Guest
xx Re: Displaying a histogram in a dialog box
« Reply #7 on: Aug 5th, 2014, 08:34am »

on Aug 5th, 2014, 05:44am, g3nrw wrote:
Which "earlier post"?

The one in which I announced support for drawing graphics in a custom dialogue control, which I posted yesterday only a few hours before yours. wink

This thread triggered me to re-visit that functionality, which was intended to have been provided in GUILIB but, in the absence of that library, has never been supported in BB4W until now.

Quote:
Don't understand: your 4-window "Hello world"/graphics example *is* in a dialog box.

The subject line of this thread is "Displaying a histogram in a dialog box". That is exactly the sort of thing the newly-supported functionality, as illustrated by that graphic, allows!

My 'aside' stemmed from the fact that you accompanied your most recent message with a code listing. When I run that program, and click on the OK button, it displays your histogram graphics in what appears to be a regular window - it has no 'dialogue-style' features such as multiple controls or OK/cancel buttons.

Looking at the detail of your code, that window consists of a dialogue box containing a static 'picture box' and nothing else. Therefore it begs the question of why you are using a dialogue box at all, when you could achieve something almost identical with an ordinary 'BBC' window, and in so doing avoid all the complications of drawing graphics and dealing with DPI variation.

Having spent considerable time and effort in providing support for drawing graphics in a dialogue control, it was a bit disconcerting to see that - at least superficially - you don't actually require that functionality at all. sad

So do you actually need to "display a histogram in a dialog box" as the thread title implies, or would an ordinary graphics-capable window (created most easily using the MULTIWIN library) suffice?

Richard.
User IP Logged

sveinioslo
Developer

member is offline

Avatar




PM


Posts: 64
xx Re: Displaying a histogram in a dialog box
« Reply #8 on: Aug 5th, 2014, 11:54pm »

Well Ian, if you want to animate graphics in a dialog, here is one way of doing it.
But it so much easier with the new Multiwin library Richard so kindly provided.

Svein

Code:
      STM_SETIMAGE = 370
      SS_BITMAP = &E
      BS_DEFPUSHBUTTON = 1

      INSTALL @lib$+"WINLIB2"
      dlg%=FN_newdialog("Displaying animated histogram in a dialog box", 20, 20, 400, 200, 8, 500)
      cx%=380 : cy%=160
      PROC_static(dlg%,"",123,10,10,cx%,cy%,SS_BITMAP)
      PROC_pushbutton(dlg%, "Start", 1, 240, 180, 56, 14, BS_DEFPUSHBUTTON)
      PROC_pushbutton(dlg%, "Cancel", 2, 310, 180, 56, 14, 0)
      PROC_showdialog(dlg%)

      ON CLOSE PROC_close:QUIT
      ON ERROR PROC_close:PRINT'REPORT$:END

      DIM rc{l%,t%,r%,b%}
      rc.r%=cx% : rc.b%=cy%
      SYS "MapDialogRect", !dlg%, rc{}
      cx%=rc.r% : cy%=rc.b%
      SYS "CreateCompatibleBitmap", @memhdc%, cx%, cy% TO hbitmap%

      *REFRESH OFF
      Click%=0 : start%=0
      ON SYS Click% = @wparam% : RETURN

      REPEAT
        IF start%=1 THEN
          a%+=1 : IF a%>30 THEN a%=1
          FOR n% = 0 TO 17
            SYS "SelectObject", @memhdc%, hbitmap% TO C%
      
            REM do your graphics here
            x% = n% * 64
            y% = n% * a%
            GCOL RND(15): RECTANGLE FILL x%, 2*@vdu%!212-2*cy%, 32, y%
            REM .....................
      
            SYS "SelectObject", @memhdc%, C%
            SYS "SendDlgItemMessage", !dlg%, 123, STM_SETIMAGE, 0, hbitmap%
            *REFRESH
            WAIT 2
          NEXT n%
        ENDIF
  
        click%=0
        SWAP Click%, click%
        IF click%=1 THEN start%=1
  
      UNTIL click%=2 OR !dlg%=0
      PROC_close : QUIT

      DEF PROC_close
      PROC_closedialog(dlg%) : SYS "DeleteObject", hbitmap%
      ENDPROC
 
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls