Posts: 522
Threads: 55
Joined: Jul 2022
Reputation:
48
PS: same compilelog.txt running the snippets at #3 abd #8 of this thread
tool for testing viewport in different SCREEN mode
QB64pe version 4.1
Posts: 89
Threads: 13
Joined: Apr 2022
Reputation:
9
Hi,
I have a question about using the HelperCanvas property of picture boxes: I am working on a program for simulating a signalized intersection. There are a couple of picture boxes to depict signals. To test the displays, I am doing this in the BeforeUpdateDisplay sub:
IF Control(SignalDesignFR).Hidden = False THEN
olddisplay = _SOURCE
_DEST sigdisplay
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
Control(SignalsPB).HelperCanvas = sigdisplay
_DEST intdisplay
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
Control(TrafficPB).HelperCanvas = intdisplay
_DEST olddisplay
END IF
The two images sigdisplay and intdisplay are created with _NEWIMAGE and match the dimensions of the picture boxes SignalsPB and TrafficPB respectively. The Sections() array contains handles to 64x64 pixel images of individual signal sections (red, amber, green) from _EMBED/_EMBEDDED image files (per the online tutorial page "Icons, Images and Title".)
The results I get are as shown. The left endpoints of the lines appear to be correctly located for the insertion points specified by the _PUTIMAGE calls; the lines run to the right edges of the picture boxes.
Am I missing something?
It's not the having, it's the doing.
Posts: 485
Threads: 24
Joined: May 2022
Reputation:
91
I am unable to see the image from my work network. However, it looks like you are replacing the HelperCanvas image handle with your own. This will lead to an image handle leak.
Instead, use the following pattern:
Code: (Select All)
IF NOT Control(SignalDesignFR).Hidden THEN
BeginDraw SignalsPB
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
EndDraw SignalsPB
BeginDraw TrafficPB
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
EndDraw TrafficPB
END IF
Also, I think you got _SOURCE and _DEST mixed up a bit.
Posts: 89
Threads: 13
Joined: Apr 2022
Reputation:
9
(12-16-2025, 01:08 PM)a740g Wrote: I am unable to see the image from my work network. However, it looks like you are replacing the HelperCanvas image handle with your own. This will lead to an image handle leak.
Instead, use the following pattern:
Code: (Select All)
IF NOT Control(SignalDesignFR).Hidden THEN
BeginDraw SignalsPB
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
EndDraw SignalsPB
BeginDraw TrafficPB
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
EndDraw TrafficPB
END IF
Also, I think you got _SOURCE and _DEST mixed up a bit. 
I tried doing a direct _PUTIMAGE to the picture boxes, but it didn't seem to work. I'll try it again.
I was doing the _SOURCE and _DEST thing because I wasn't sure how images are handled with an active InForm window.
It's not the having, it's the doing.
Posts: 89
Threads: 13
Joined: Apr 2022
Reputation:
9
(12-16-2025, 01:08 PM)a740g Wrote: I am unable to see the image from my work network. However, it looks like you are replacing the HelperCanvas image handle with your own. This will lead to an image handle leak.
Instead, use the following pattern:
Code: (Select All)
IF NOT Control(SignalDesignFR).Hidden THEN
BeginDraw SignalsPB
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
EndDraw SignalsPB
BeginDraw TrafficPB
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
EndDraw TrafficPB
END IF
Also, I think you got _SOURCE and _DEST mixed up a bit. 
No joy, I got the same result using your suggestion.
It's not the having, it's the doing.
Posts: 522
Threads: 55
Joined: Jul 2022
Reputation:
48
(12-15-2025, 09:27 PM)bobalooie Wrote: Hi,
I have a question about using the HelperCanvas property of picture boxes: I am working on a program for simulating a signalized intersection. There are a couple of picture boxes to depict signals. To test the displays, I am doing this in the BeforeUpdateDisplay sub:
IF Control(SignalDesignFR).Hidden = False THEN
olddisplay = _SOURCE
_DEST sigdisplay
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
Control(SignalsPB).HelperCanvas = sigdisplay
_DEST intdisplay
_PUTIMAGE (50, 50), Sections(0)
_PUTIMAGE (50, 114), Sections(5)
_PUTIMAGE (50, 178), Sections(10)
Control(TrafficPB).HelperCanvas = intdisplay
_DEST olddisplay
END IF
The two images sigdisplay and intdisplay are created with _NEWIMAGE and match the dimensions of the picture boxes SignalsPB and TrafficPB respectively. The Sections() array contains handles to 64x64 pixel images of individual signal sections (red, amber, green) from _EMBED/_EMBEDDED image files (per the online tutorial page "Icons, Images and Title".)
The results I get are as shown. The left endpoints of the lines appear to be correctly located for the insertion points specified by the _PUTIMAGE calls; the lines run to the right edges of the picture boxes.
Am I missing something?
![[Image: Screenshot-2025-12-15-154101.png]](https://i.ibb.co/FLvn502c/Screenshot-2025-12-15-154101.png) Hi @bobalooie
I've not understood from your image posted here the issue, but your description is almost clear.
So I have built an Informpe demo with the essential items to duplicate the issue or to solve it.
I made a form with 2 pictureboxes of height 70 and width 280 , a button for switching between drawing and clearing the surfaces of the 2 pictureboxes using Informpe. Saving and passing to QB64pe IDE 4.2.0 I have added 2 _newimages of the same dimensions of the 2 pictureboxes and 11 _newimages 64x64 pixels to draw on the pictureboxes via the 2 bigger _newimages.
After a normal compiling, on running I got a console output of errors that leads me to an unsolved output in the running application.
Maybe that this result is for the OS where I made the attempt: Kubuntu 24.04 and the same code has no error in Windows.
Now I cannot use a Windows pc to test this code.
Please try it on a Windows pc if you can.
_putimage_Picturebox.bas (Size: 5.55 KB / Downloads: 17)
_putimage_Picturebox.txt (Size: 2.5 KB / Downloads: 21)
_putimage_Picturebox.txt must be renamed changing the extension into .frm because the website has denied to load the .frm file.
Please gimme a feedback.
Posts: 89
Threads: 13
Joined: Apr 2022
Reputation:
9
(12-20-2025, 04:04 PM)TempodiBasic Wrote: Hi @bobalooie
I've not understood from your image posted here the issue, but your description is almost clear.
So I have built an Informpe demo with the essential items to duplicate the issue or to solve it.
I made a form with 2 pictureboxes of height 70 and width 280 , a button for switching between drawing and clearing the surfaces of the 2 pictureboxes using Informpe. Saving and passing to QB64pe IDE 4.2.0 I have added 2 _newimages of the same dimensions of the 2 pictureboxes and 11 _newimages 64x64 pixels to draw on the pictureboxes via the 2 bigger _newimages.
After a normal compiling, on running I got a console output of errors that leads me to an unsolved output in the running application.
Maybe that this result is for the OS where I made the attempt: Kubuntu 24.04 and the same code has no error in Windows.
Now I cannot use a Windows pc to test this code.
Please try it on a Windows pc if you can.
_putimage_Picturebox.txt must be renamed changing the extension into .frm because the website has denied to load the .frm file.
Please gimme a feedback.
Sorry for the late response, I've been off playing in FreePascal/Lazarus world. The program doesn't work for me. I think you need to have something in the __UI_BeforeUpdateDisplay subroutine to make the program display something. I have found that nothing displays in a picture box unless that is invoked.
It's not the having, it's the doing.
Posts: 485
Threads: 24
Joined: May 2022
Reputation:
91
__UI_BeforeUpdateDisplay is automatically called by the InForm-PE runtime at ~60Hz.
See an example here showing how to use it with a PictureBox - https://github.com/QB64-Phoenix-Edition/...se.bas#L43
Posts: 1,215
Threads: 162
Joined: Apr 2022
Reputation:
34
Hi everybody, I am finally checking out InForm, woohoo!
So I started by skimming through this thread and now I'm looking at the tutorial.
I noticed the "install InForm-PE" link at the bottom of that page is broken, the link opens to
https://raw.githack.com/a740g/InForm-PE/...all_inform.htm
which results in 404: Not Found
I did find the page from the menu, the URL is
https://raw.githack.com/a740g/InForm-PE/...all_inform.html
and it looks like the broken link just needs an "L" added to the end (the page is install_inform.html but the link is to install_inform.htm).
Anyway I thought I would mention this, in case it helps someone.
Posts: 522
Threads: 55
Joined: Jul 2022
Reputation:
48
@madscijr
what?
do you like joking?
Informpe Gitub
|