Larry
New Member
Posts: 40
|
Post by Larry on Apr 26, 2020 13:18:14 GMT -5
I am trying to load a bmp into a graphics box. I have a project file that is loaded which contains all of the names of the files associated with the specific language that will be edited using my Dalota language editor and dictionary program. Then, one at a time those are loaded into the system. Depending on the language being edited, as to what those filenames will be, therefore the variable script$ holds the filename of the bmp to be displayed.
I've tried it this way, but it would appear that possibly the loadbmp command cannot take the variable script$, in place of the actual filename enclosed in quotes. Any help would be appreciated.
[lists.b12] print #lists.gb1,"show" print #lists.tb1,"!hide" loadbmp "script",script$ unloadbmp "script" print #lists.gb1, "drawbmp script x y" wait
|
|
|
Post by Rod on Apr 26, 2020 13:31:18 GMT -5
well first off have you issued a down command? Secondly why unload before you have even used it? Also where do you fill script$?
Aldo what happens when you replace script$ with the literal drive,path and file name?
|
|
|
Post by tsh73 on Apr 26, 2020 14:02:24 GMT -5
Try this. Plug right path.
nomainwin graphicbox #lists.gb1, 1,1,300,300 open "test" for window as #lists #lists "trapclose [quit]" #lists.gb1 "down"
script$ = "C:\progs\Just BASIC v1.01\bmp\CHERRY.BMP"
loadbmp "script",script$ 'unloadbmp "script" 'unload it only in the end x=50 y=100 'print #lists.gb1, "drawbmp script x y" print #lists.gb1, "drawbmp script ";x;" "; y wait
[quit] unloadbmp "script" 'unload it here, the end close #lists end
|
|
|
Post by tenochtitlanuk on Apr 26, 2020 14:04:34 GMT -5
Ninja'd by tsh!
Just a comment that the 'print' is redundant... see below
open "Test" for graphics_nsb as #wg
script$ ="test.bmp"
loadbmp "script", script$ #wg "drawbmp script x y" unloadbmp "script"
wait
|
|
Larry
New Member
Posts: 40
|
Post by Larry on Apr 27, 2020 1:34:37 GMT -5
well first off have you issued a down command? Secondly why unload before you have even used it? Also where do you fill script$? Aldo what happens when you replace script$ with the literal drive,path and file name? No I forgot the down command.
I have a data file, that has the filename in it that is to be loaded using loadbmp. I load it into script$ from the data file. Then I tried to draw it to a graphic box using drawbmp script$. When it did not work, I got a giant box with an error that all manner of wierd ascii type characters on it and I click ok and it goes away.
|
|
|
Post by Rod on Apr 27, 2020 2:47:50 GMT -5
So we are still not fixed? If so print the the contents of sctipt$ tell us what it contains and give us a bit more detail on what the error report says.
|
|
Larry
New Member
Posts: 40
|
Post by Larry on Apr 27, 2020 11:05:15 GMT -5
|
|
|
Post by tsh73 on Apr 27, 2020 12:40:31 GMT -5
I see two possible culprits * file path - make it print always, so you can see if it is formed correctly * or file itself (LB is known? not to handle some BMP versions - I had troubles with less-then 256 color BMP saved from Gimp) - if you know file what fail, will it fail if you hard code it?
|
|
|
Post by Rod on Apr 27, 2020 13:43:24 GMT -5
why is there a .jpg involved? Liberty needs API help to load them directly.
|
|
Larry
New Member
Posts: 40
|
Post by Larry on Apr 27, 2020 16:22:57 GMT -5
I see two possible culprits * file path - make it print always, so you can see if it is formed correctly * or file itself (LB is known? not to handle some BMP versions - I had troubles with less-then 256 color BMP saved from Gimp) - if you know file what fail, will it fail if you hard code it? I solved the problem. Thanks for all of your help Rod. It is much appreciated. The solution I cam up with is this.
[lists.b12] print #lists.gb1,"show" print #lists.tb1,"!hide" notice "Please click on the bmp image that has the name of your language in it." if script$="" then filedialog "Open language script picture", "*.bmp", script$ if script$="" then wait loadbmp "script",script$ print #lists.gb1, "drawbmp script 5 5" unloadbmp "script" wait
It is odd however as I see no difference between loading the filename in from a data file versus this way, but it works so I am not complaining
|
|
Larry
New Member
Posts: 40
|
Post by Larry on Apr 27, 2020 16:27:22 GMT -5
I see two possible culprits * file path - make it print always, so you can see if it is formed correctly * or file itself (LB is known? not to handle some BMP versions - I had troubles with less-then 256 color BMP saved from Gimp) - if you know file what fail, will it fail if you hard code it? Thanks for your help. I do know sometimes file formats can be tricky. No, it did not fail when hardcoded. However, I had to find a way to make it dynamic and not static. I needed to be able to load a different bmp, depending on the name in the data file, which turned out not to work. I finally had to have the user ( namely me), select the bmp file from a fialdialog in order to get it to work right.
|
|
Larry
New Member
Posts: 40
|
Post by Larry on Apr 27, 2020 16:32:18 GMT -5
why is there a .jpg involved? Liberty needs API help to load them directly. There isn't. I'm not sure what happened there. It was always a bmp. The screen grab I made of the error in lb4.04 Pro might have been a jpg
|
|