Page 1 of 1

Posted: Mon Apr 29, 2002 10:17 am
by BackupUser
Restored from previous forum. Originally posted by cor.

The code between startdrawing and stopdrawing is not executed.

Does someone knows why???

Code: Select all

 
; this works
      StartDrawing(ImageOutput()) ;
      Line (90,20,20,0)
      Line(100,20,0,80)
      StopDrawing()
; this works before the event handler

Repeat
    EventID.l = WaitWindowEvent()
     
    If EventID= #WM_LBUTTONDOWN 
      StartDrawing(ImageOutput()) ; this is not working
      Line (90,20,20,0)
      Line(100,20,0,80)
      StopDrawing()               ; this is not working

     Beep_(200,100)  ; this one is executed
    
    EndIf

Using Windows 98 SE
Registered PB version : 3.0 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Mon Apr 29, 2002 10:53 am
by BackupUser
Restored from previous forum. Originally posted by Pupil.
The code between startdrawing and stopdrawing is not executed.

Does someone knows why???

Code: Select all

 
Repeat
    EventID.l = WaitWindowEvent()
     
    If EventID= #WM_LBUTTONDOWN 
      StartDrawing(ImageOutput()) ; this is not working
      Line (90,20,20,0)
      Line(100,20,0,80)
      StopDrawing()               ; this is not working

     Beep_(200,100)  ; this one is executed
    
    EndIf

One possible solution could be to insert 'UseImage(YourImage)' before the StartDrawing() command. I've not tested this, but i think it's worth a try..

Posted: Mon Apr 29, 2002 11:00 am
by BackupUser
Restored from previous forum. Originally posted by cor.

I'am sorry , does not work.

Cor
The code between startdrawing and stopdrawing is not executed.

Does someone knows why???

Code: Select all

 
Repeat
    EventID.l = WaitWindowEvent()
     
    If EventID= #WM_LBUTTONDOWN 
      StartDrawing(ImageOutput()) ; this is not working
      Line (90,20,20,0)
      Line(100,20,0,80)
      StopDrawing()               ; this is not working

     Beep_(200,100)  ; this one is executed
    
    EndIf

One possible solution could be to insert 'UseImage(YourImage)' before the StartDrawing() command. I've not tested this, but i think it's worth a try..

Using Windows 98 SE
Registered PB version : 3.0 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Mon Apr 29, 2002 12:08 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
I'am sorry , does not work.

Cor
Ok, tell me a little more how your program is supposed to work.
I've tested some and everything works fine, you know you have to actually display the image after you've drawn on it to see what you've been drawing! This little example might point you in the right direction:

Code: Select all

CreateImage(0, 128,32)

If OpenWindow(0, 400,400,400,400,#PB_Window_SystemMenu, "test")
  Repeat
    event.l = WaitWindowEvent()
    
    Select event
      Case #PB_EventCloseWindow
        quit = #TRUE
      Case #WM_LBUTTONDOWN
        StartDrawing(ImageOutput())
          Locate(10,10)
          DrawText("Left MB pressed")
        StopDrawing()
      Case #WM_LBUTTONUP
        StartDrawing(ImageOutput())
          Box(0,0,128,32)
        StopDrawing()
    EndSelect
    
    
    StartDrawing(WindowOutput())
      DrawImage(UseImage(0), 10, 100)
      Box(0,0,100,100)
      Locate(20,20)
      DrawText(Hex(event))
    StopDrawing()
  Until quit
EndIf
I've not commented the code but it should be quite easy to understand...

Posted: Mon Apr 29, 2002 12:23 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.

It seems that ImageOutput() does not always work...

El_Choni

Posted: Mon Apr 29, 2002 1:35 pm
by BackupUser
Restored from previous forum. Originally posted by BalrogSoft.

Code: Select all

CreateImage(0, 128,32)

If OpenWindow(0, 400,400,400,400,#PB_Window_SystemMenu, "test")
  Repeat
    event.l = WaitWindowEvent()
    
    Select event
      Case #PB_EventCloseWindow
        quit = #TRUE
      Case #WM_LBUTTONDOWN
        Useimage(Number)   ; Change the number to the image that you want draw
        StartDrawing(ImageOutput())
          Locate(10,10)
          DrawText("Left MB pressed")
        StopDrawing()
      Case #WM_LBUTTONUP
        UseImage(Number)   ; Change the number to the image that you want draw
        StartDrawing(ImageOutput())
          Box(0,0,128,32)
        StopDrawing()
    EndSelect
    
    
    StartDrawing(WindowOutput())
      UseImage(0)   
      DrawImage(ImageID(), 10, 100)    
      Box(0,0,100,100)
      Locate(20,20)
      DrawText(Hex(event))
    StopDrawing()
  Until quit
EndIf
I found some troubles in this code that i rewrite.

Bye, Balrog Soft

Balrog Soft
Amiga and PC Coder
http://www.balrogsoftware.com
[url]mailto:balrog@balrogsoftware.com[/url]