Picture doesn't show until I click outside the graphics window

New to FreeBASIC? Post your questions here.
Post Reply
dkr
Posts: 40
Joined: Nov 20, 2015 15:17
Location: Alabama, USA

Picture doesn't show until I click outside the graphics window

Post by dkr »

Hello,
I want to make a program to go through all my wife's phone images, and let her keep her craft photos in one directory, family in another and delete the rest. So I have been playing with the below code just to understand how to show the image. It works okay, but the image does not show up until I do a mouse click outside the graphics window?? Kudos to Joshy Peters for both FBImage and MultiPut and all the FLTK work.

Thanks,
Darren

Code: Select all

#include once "FBImage.bi"
#include once "MultiPut.bi"

' MultiPut [destination],[xmidpos],[ymidpos], source,[xScale],[yScale],[Trans]
chdir exepath()
screenres 1280,1024,32
dim as single scale = 0.25
dim as string fnam = "C:\Users\Darrren\Pictures\temp2\IMG_7658.jpg"
var img = LoadRGBAFile(fnam)

Multiput ,640,512,img,scale,scale
WindowTitle "FreeBASIC example program"

dim as integer res = ScreenSync  ' this does not help
print "File: ";fnam
sleep
ImageDestroy img
hhr
Posts: 211
Joined: Nov 29, 2019 10:41

Re: Picture doesn't show until I click outside the graphics window

Post by hhr »

I can confirm that.
I have used tire.jpg from FBImage and the following example.
Compile example, select exe file, press enter repeatedly.
It seems to work reliably with put, but only sometimes with MultiPut.
In the command prompt it does not seem to work at all with MultiPut.

Code: Select all

#include "FBImage.bi"
#include "MultiPut.bi"

screenres 800,600,32
dim as single scale = 1
dim as string fnam = "tire.jpg"
var img = LoadRGBAFile(fnam)

'put (300,200),img 
MultiPut ,400,300,img,scale,scale

sleep
ImageDestroy img
hhr
Posts: 211
Joined: Nov 29, 2019 10:41

Re: Picture doesn't show until I click outside the graphics window

Post by hhr »

This MultiPut.bi seems to work better:
https://www.freebasic-portal.de/code-be ... t-241.html
dkr
Posts: 40
Joined: Nov 20, 2015 15:17
Location: Alabama, USA

Re: Picture doesn't show until I click outside the graphics window

Post by dkr »

I did find a solution - by luck. I needed to do a ScreenLock before using MultiPut and then ScreenUnlock afterwards.
I guess the size the image caused the issue. The original image I was testing it on was 4416 x 3312.

Darren
Post Reply