problems with statictext and bmpbutton display

You can talk about anything related to LB Booster here, not covered in another category
dkl
Posts: 4
Joined: Thu Nov 04, 2021 5:11 am

problems with statictext and bmpbutton display

Post by dkl »

I enjoy programming in Liberty Basic and enjoy using LB Booster, but do have a few queries, which I hope someone would be kind enough to answer or offer help with.

Both 'statictext' and 'bmpbutton' commands cause problems when using LB Booster. The programme will still run, but the GUI becomes messy and spoils the design.

'Statictext' seems to leave a white background behind the text with a box around it and if I use 'bmpbutton' as an alternative I still get a 'box' around the bmp and if I 'disable' it it goes dullish.

I also have a Dll problem. Everytime a dll is called I get an error highlighting the relevant line and saying "missing AS in CALLDLL" every thing seems to be correct as shown below:-

calldll #jpg, "jpg_to_bmp1",_ 'copy jpgfile to bmpfile
jpgfile$ as ptr,_ 'jpg filename
bmpfile$ as ptr,_ 'bmp filename
result as long, <==============================THIS IS THE LINE
if not(result) then
notice "Error saving file."
end if
close #jpg

Any help with these issue would be much appreciated. Thank you
guest
Site Admin
Posts: 198
Joined: Tue Apr 03, 2018 1:34 pm

Re: problems with statictext and bmpbutton display

Post by guest »

dkl wrote: Thu Nov 04, 2021 5:20 am

Code: Select all

calldll #jpg, "jpg_to_bmp1",_ 'copy jpgfile to bmpfile
    jpgfile$ as ptr,_  'jpg filename
    bmpfile$ as ptr,_  'bmp filename
    result as long,  
That's a simple one: you have a spurious comma at the end of the statement:

Code: Select all

    result as long,  ' spurious trailing comma
    result as long   ' correct
The error message is a little unhelpful, but the presence of the comma makes LBB expect more to follow, and it gets upset when there isn't! It's generally the case that LBB tries to behave the same as LB4 when presented with valid code, but they may well behave differently when presented with invalid code.
Both 'statictext' and 'bmpbutton' commands cause problems when using LB Booster. The programme will still run, but the GUI becomes messy and spoils the design.
I've never spotted this, and I don't think anybody else has reported it, so it suggests that there is something 'non standard' about your system. What version of Windows are you running? Have you customised the 'theme' (GUI colours etc.) in any way?

As far as Windows GUI features are concerned, both LB4 and LBB are simply wrappers around the standard Microsoft Win32 API, which takes care of the actual rendering, so a difference in appearance is surprising and difficult to explain. Unless a way can be found to reproduce this effect it may be difficult to get to the bottom of it.

I would be very interested to learn whether anybody else has experienced the same symptom.
dkl
Posts: 4
Joined: Thu Nov 04, 2021 5:11 am

Re: problems with statictext and bmpbutton display

Post by dkl »

Many Thanks for your quick response. I have eliminated the comma in the CALLDLL and it now works fine. Thanks

I am running in Windows 10 and LB V4.5.1 I have only changed the BackgroundColor$ statement to "darkcyan", but I have attached 3 jpg's to demonstrate what I mean. This has always been a problem for me since I discovered LBB many years ago, hence I have not used it as much as I would like, sadly.

Hopefully the jpg's will give you an idea of what I mean. I haven't used any stylebit commands to change anything relative to the statictext or bmpbutton's. Only a stylebits command to centre text in textboxes & to 'setfocus' on certain button controls.

Hope this helps

Many Thanks :)
Attachments
3.) GUI using bmpbuttons &  running in LB Booster.PNG
3.) GUI using bmpbuttons & running in LB Booster.PNG (37.72 KiB) Viewed 9450 times
2.) GUI using statictext & running in LB Booster.PNG
2.) GUI using statictext & running in LB Booster.PNG (38.29 KiB) Viewed 9450 times
1.) GUI using statictext & running in LB.PNG
1.) GUI using statictext & running in LB.PNG (34.54 KiB) Viewed 9450 times
guest
Site Admin
Posts: 198
Joined: Tue Apr 03, 2018 1:34 pm

Re: problems with statictext and bmpbutton display

Post by guest »

dkl wrote: Thu Nov 04, 2021 11:57 am Hopefully the jpg's will give you an idea of what I mean.
I'm afraid I still can't reproduce it here. If I run this program:

Code: Select all

	nomainwin
	WindowHeight = 470

	BackgroundColor$ = "darkcyan"
	statictext #w.st1, "No Stylebits", 50, 20, 200, 32
	stylebits  #w.st2, _SS_CENTER or _WS_BORDER, 0, 0, 0
	statictext #w.st2, "Thin Line Border", 50, 65, 200, 32
	stylebits  #w.st3, _SS_CENTER or _WS_DLGFRAME, 0, 0, 0
	statictext #w.st3, "Raised Background", 50, 110, 200, 32
	stylebits  #w.st4, _SS_CENTER, 0, _WS_EX_CLIENTEDGE, 0
	statictext #w.st4, "Recessed Background", 50, 155, 200, 32
	stylebits  #w.st5, _SS_CENTER, 0, _WS_EX_CLIENTEDGE, 0
	statictext #w.st5, "Recessed Disabled", 50, 200, 200, 32
	stylebits  #w.st6, _SS_CENTER, 0, _WS_EX_STATICEDGE or _WS_EX_CLIENTEDGE, 0
	statictext #w.st6, "Double Recessed Edge", 50, 245, 200, 32
	stylebits  #w.st7, _SS_CENTER, 0, _WS_EX_DLGMODALFRAME or _WS_EX_CLIENTEDGE, 0
	statictext #w.st7, "Raised Frame", 50, 290, 200, 32
	stylebits  #w.st8, _SS_CENTER or _WS_THICKFRAME, 0, _WS_EX_CLIENTEDGE, 0
	statictext #w.st8, "Thicker Raised Frame", 50, 335, 200, 36
	stylebits  #w.st9, _SS_CENTER or _WS_BORDER, 0, 0, 0
	statictext #w.st9, "Flat Disabled", 50, 386, 200, 32

	open "Stylebits for Statictext" for window as #w
	#w "font Times_New_Roman 14 bold"
	#w.st5 "!disable"
	#w.st9 "!disable"
	#w "trapclose [quit]"
	wait

[quit]
	close #w
	end
This is what I see, which is the same as in LB4. I'm guessing you'll see something different on your system, but I haven't a clue why, sorry.

statictext_backgroundcolor.png
statictext_backgroundcolor.png (100.75 KiB) Viewed 9441 times
dkl
Posts: 4
Joined: Thu Nov 04, 2021 5:11 am

Re: problems with statictext and bmpbutton display

Post by dkl »

This is very strange - with your code, I see exactly the same as you! How does my code work for you?

this is my original code - as seen in pix

'nomainwin
WindowWidth = 1155
WindowHeight = 600
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)

x=10:y = 80:w = 110:h = 400:xgap = w+20

ListboxColor$ = "lightgray"
listbox #1.3, store3$(), [EH3], x+(xgap*0), y, w, h
listbox #1.4, store4$(), [EH4], x+(xgap*1), y, w, h
listbox #1.5, store5$(), [EH5], x+(xgap*2), y, w, h
listbox #1.6, store6$(), [EH6], x+(xgap*3), y, w, h
listbox #1.7, store7$(), [EH7], x+(xgap*4), y, w, h
listbox #1.8, store8$(), [EH8], x+(xgap*5), y, w, h
listbox #1.9, store9$(), [EH9], x+(xgap*6), y, w, h
listbox #1.10, store10$(), [EH10], x+(xgap*7),y, w, h
button #1.ext, "Exit", [quit],UL,1000, y-60, 35, 25
stylebits #1.tb1, _ES_CENTER, 0, 0, 0
textbox #1.in, x, y-60, 300, 25
stylebits #1.ok, _BS_DEFPUSHBUTTON, 0, 0, 0
button #1.ok, "OK", [getWord],UL, x+305, y-60, 30, 25
button #1.cl, "Clear", [clear],UL, x+345, y-60, 50, 25

statictext #1.ina, "Input User Word (Min 3 - Max 10 Letters)",10+(xgap*0),0,340,20
statictext #1.3a, "3 Letter Words",10+(xgap*0),y-20,120,20
statictext #1.4a, "4 Letter Words",10+(xgap*1),y-20,120,20
statictext #1.5a, "5 Letter Words",10+(xgap*2),y-20,120,20
statictext #1.6a, "6 Letter Words",10+(xgap*3),y-20,120,20
statictext #1.7a, "7 Letter Words",10+(xgap*4),y-20,120,20
statictext #1.8a, "8 Letter Words",10+(xgap*5),y-20,120,20
statictext #1.9a, "9 Letter Words",10+(xgap*6),y-20,120,20
statictext #1.10a, "10 Letter Words",10+(xgap*7),y-20,120,20

y2 = 500
statictext #1.3b, "Word Count",10+(xgap*0),y2-20,120,20
statictext #1.4b, "Word Count",10+(xgap*1),y2-20,120,20
statictext #1.5b, "Word Count",10+(xgap*2),y2-20,120,20
statictext #1.6b, "Word Count",10+(xgap*3),y2-20,120,20
statictext #1.7b, "Word Count",10+(xgap*4),y2-20,120,20
statictext #1.8b, "Word Count",10+(xgap*5),y2-20,120,20
statictext #1.9b, "Word Count",10+(xgap*6),y2-20,120,20
statictext #1.10b, "Word Count",10+(xgap*7),y2-20,120,20

textbox #1.3t, x+(xgap*0), 500, 40, 25
textbox #1.4t, x+(xgap*1), 500, 40, 25
textbox #1.5t, x+(xgap*2), 500, 40, 25
textbox #1.6t, x+(xgap*3), 500, 40, 25
textbox #1.7t, x+(xgap*4), 500, 40, 25
textbox #1.8t, x+(xgap*5), 500, 40, 25
textbox #1.9t, x+(xgap*6), 500, 40, 25
textbox #1.10t, x+(xgap*7), 500, 40, 25

textbox #1.tim, 900, y-60, 40, 25

stylebits #1.inf, _ES_CENTER, 0, 0, 0
textbox #1.inf, x+450, y-60, 400, 25

TextboxColor$ = "green"
stylebits #1.sinf, _ES_CENTER, 0, 0, 0
textbox #1.sinf, x+450, y-60, 400, 25'y-50

button #1.wb, "WB", [WB],UL, 1050, 500, 50, 25

statictext #1.cmin, "Min", 1070 , y-20, 30, 20
statictext #1.cmax, "Max", 1070 , y+50, 30, 20
combobox #1.cmin, cMin$(), [cmin], 1070, y, 30, 20
combobox #1.cmax, cMax$(), [cmax], 1070, y+70, 30, 20

BackgroundColor$ = "darkcyan"

[main_loop]
if op = 0 then open w$ for Window as #1:op = 1
#1, "font Georgia 10 bold"
#1.in, "!setfocus"
#1.inf "!hide"
#1.sinf "!hide"
#1.inf,"":#1.inf,ct;" words loaded from ";wordCount;" words available":playwave "L:\_WAV\plop.wav",async
#1.3, "singleClickSelect [SingleClickAction]"
wait
Attachments
Yout prog on my Computer - It's fine!.PNG
Yout prog on my Computer - It's fine!.PNG (12.28 KiB) Viewed 9436 times
guest
Site Admin
Posts: 198
Joined: Tue Apr 03, 2018 1:34 pm

Re: problems with statictext and bmpbutton display

Post by guest »

dkl wrote: Fri Nov 05, 2021 6:32 am This is very strange - with your code, I see exactly the same as you! How does my code work for you?
In the 'New features' section of the LB Booster documentation it says this: "The background color of (for example) a STATICTEXT control may be selected independently of the background color of its parent window, by changing the value of the BackgroundColor$ variable in between".

This necessarily implies that BackgroundColor$ must be set before the controls to which it applies are declared. In your program you change BackgroundColor$ after the statictext controls are declared, so LBB assumes that you do not want it to apply to those controls.

If you move the BackgroundColor$ to before the statictext controls are declared it should have the effect you want (without affecting compatibility with LB4):

Code: Select all

BackgroundColor$ = "darkcyan"

statictext #1.ina, "Input User Word (Min 3 - Max 10 Letters)",10+(xgap*0),0,340,20
statictext #1.3a, "3 Letter Words",10+(xgap*0),y-20,120,20
statictext #1.4a, "4 Letter Words",10+(xgap*1),y-20,120,20
statictext #1.5a, "5 Letter Words",10+(xgap*2),y-20,120,20
statictext #1.6a, "6 Letter Words",10+(xgap*3),y-20,120,20
statictext #1.7a, "7 Letter Words",10+(xgap*4),y-20,120,20
statictext #1.8a, "8 Letter Words",10+(xgap*5),y-20,120,20
statictext #1.9a, "9 Letter Words",10+(xgap*6),y-20,120,20
statictext #1.10a, "10 Letter Words",10+(xgap*7),y-20,120,20
LBB is not intended to be a clone of LB4 (that would be impossible, without stealing Carl's code). Rather it is designed to be substantially compatible but to provide a large number of extensions and bug fixes. You should expect occasionally to have to make small changes to programs.
dkl
Posts: 4
Joined: Thu Nov 04, 2021 5:11 am

Re: problems with statictext and bmpbutton display

Post by dkl »

Ahh..... now I understand. Sorry for leading you on a wild goose chase. I really appreciate all your time spent sorting this out for me. Thank you for your time. All the Best :)