LB Booster
« Overlaying GRAPHICBOXES in window »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:27am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1 2 3  Notify Send Topic Print
 veryhotthread  Author  Topic: Overlaying GRAPHICBOXES in window  (Read 1248 times)
Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Overlaying GRAPHICBOXES in window
« Reply #13 on: Jul 5th, 2017, 2:37pm »

Not sure if this helps or not.

Code:
nomainwin
WindowWidth  = 200
WindowHeight = 200
UpperLeftX = (DisplayWidth-WindowWidth)/2
UpperLeftY = (DisplayHeight-WindowHeight)/2
open "Graphic" for graphics_nsb as #1
'get the handle of the window
hWD=hwnd(#1)
'get the handle of the DC in that window
CallDll #user32, "GetDC", hWD as ulong, hDC as ulong
'set text to render with transparent background
calldll #gdi32, "SetBkMode",hDC as ulong,_TRANSPARENT as long, re as long
#1 "trapclose [quit]"
#1 "down"
#1 "color red ; backcolor red"
#1 "place 0 0 ; boxfilled 200 100"
#1 "color blue ; backcolor blue"
#1 "place 0 100 ; boxfilled 200 200"

#1 "color yellow ; home ; circle 100"
#1 "font Consolas 40 ; place 30 110 ;\Text"
wait

[quit]
close #1
end

 
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Overlaying GRAPHICBOXES in window
« Reply #14 on: Jul 5th, 2017, 3:43pm »

Here is my code.

Code:
' "K'elle Danse"

' For 1920x1080 display

PrgVersion$ = "0-0-1-1"

NOMAINWIN

FilenameNow$  = ""
FilenameNext$ = ""

' Load danse list from file "Config.ini"
DIM Dance$(31)
OPEN "Config.ini" FOR input AS #ConfigFile
DO
  INPUT #ConfigFile, Dance$
  Dance$(index) = Dance$
  index = index + 1
LOOP UNTIL index >= 31
CLOSE #ConfigFile

' Load background images
LOADBMP "Now",  DefaultDir$ + "\" + "_Now.bmp"
LOADBMP "Next", DefaultDir$ + "\" + "_Next.bmp"

GRAPHICBOX #Main.GBx1,0,0,1920,540     ' top "Now" image
 STYLEBITS #Main.GBx1,0,_WS_BORDER,0,0 'remove image's border

GRAPHICBOX #Main.GBx2,0,540,1920,540   ' bottom "Next" image
 STYLEBITS #Main.GBx2,0,_WS_BORDER,0,0 'remove image's border

GRAPHICBOX #SideMenu.GBx1,0,0,200,1080     ' "Menu" image
 STYLEBITS #SideMenu.GBx1,0,_WS_BORDER,0,0 'remove image's border

BackgroundColor$ = "darkred" ' this color setting MUST stay before the STATICTEXT!!!

STATICTEXT #SideMenu.STx0, "  " + Dance$(0) ,10,  20,200,20
STATICTEXT #SideMenu.STx1, "  " + Dance$(1) ,10,  50,200,20
STATICTEXT #SideMenu.STx2, "  " + Dance$(2) ,10,  80,200,20
STATICTEXT #SideMenu.STx3, "  " + Dance$(3) ,10, 110,200,20
STATICTEXT #SideMenu.STx4, "  " + Dance$(4) ,10, 140,200,20
STATICTEXT #SideMenu.STx5, "  " + Dance$(5) ,10, 170,200,20
STATICTEXT #SideMenu.STx6, "  " + Dance$(6) ,10, 200,200,20
STATICTEXT #SideMenu.STx7, "  " + Dance$(7) ,10, 230,200,20
STATICTEXT #SideMenu.STx8, "  " + Dance$(8) ,10, 260,200,20
STATICTEXT #SideMenu.STx9, "  " + Dance$(9) ,10, 290,200,20
STATICTEXT #SideMenu.STx10,"  " + Dance$(10),10, 320,200,20
STATICTEXT #SideMenu.STx11,"  " + Dance$(11),10, 350,200,20
STATICTEXT #SideMenu.STx12,"  " + Dance$(12),10, 380,200,20
STATICTEXT #SideMenu.STx13,"  " + Dance$(13),10, 410,200,20
STATICTEXT #SideMenu.STx14,"  " + Dance$(14),10, 440,200,20
STATICTEXT #SideMenu.STx15,"  " + Dance$(15),10, 470,200,20
STATICTEXT #SideMenu.STx16,"  " + Dance$(16),10, 500,200,20
STATICTEXT #SideMenu.STx17,"  " + Dance$(17),10, 530,200,20
STATICTEXT #SideMenu.STx18,"  " + Dance$(18),10, 560,200,20
STATICTEXT #SideMenu.STx19,"  " + Dance$(19),10, 590,200,20
STATICTEXT #SideMenu.STx20,"  " + Dance$(20),10, 620,200,20
STATICTEXT #SideMenu.STx21,"  " + Dance$(21),10, 650,200,20
STATICTEXT #SideMenu.STx22,"  " + Dance$(22),10, 680,200,20
STATICTEXT #SideMenu.STx23,"  " + Dance$(23),10, 710,200,20
STATICTEXT #SideMenu.STx24,"  " + Dance$(24),10, 740,200,20
STATICTEXT #SideMenu.STx25,"  " + Dance$(25),10, 770,200,20
STATICTEXT #SideMenu.STx26,"  " + Dance$(26),10, 800,200,20
STATICTEXT #SideMenu.STx27,"  " + Dance$(27),10, 830,200,20
STATICTEXT #SideMenu.STx28,"  " + Dance$(28),10, 860,200,20
STATICTEXT #SideMenu.STx29,"  " + Dance$(29),10, 890,200,20
STATICTEXT #SideMenu.STx30,"  " + Dance$(30),10,1000,200,20


[MAIN]
   ' Main window - background
   UpperLeftX   = 0
   UpperLeftY   = 0
   WindowWidth  = 1920
   WindowHeight = 1080
   OPEN "Now & Next" FOR window_popup AS #Main 'no title, not resizable
   #Main "TRAPCLOSE [QUIT]"

   #Main.GBx1 "down"
   #Main.GBx1 "drawbmp Now 0 0"
   #Main.GBx1 "when leftButtonDown [MouseLeftButton]"
   #Main.GBx1 "when mouseMove [MouseMove]"

   #Main.GBx2 "down"
   #Main.GBx2 "drawbmp Next 0 0"
   #Main.GBx2 "when leftButtonDown [MouseLeftButton]"
   #Main.GBx2 "when mouseMove [MouseMove]"

   ' Side menu - dance selector
   UpperLeftX   = 1720
   UpperLeftY   = 0
   WindowWidth  = 190
   WindowHeight = 1080
   ForegroundColor$ = "white"
   OPEN "Side Menu" FOR window_popup AS #SideMenu  'no title, not resizable
   STYLEBITS #SideMenu,0,_WS_VISIBLE,0,0 ' startup hidden (not visible)
   #SideMenu "font tahoma 12 bold"
   #SideMenu.GBx1 "down; fill darkred"
   #SideMenu.GBx1 "when LeftButtonDown [DanceSelection]"

   WAIT


[QUIT]
   CLOSE #SideMenu
   CLOSE #Main
   END

[REFRESH]
   UNLOADBMP "Now" 'free-up memory
   LOADBMP "Now", DefaultDir$+"\"+FilenameNow$+"_Now.bmp"
   #Main.GBx1 "down"
   #Main.GBx1 "drawbmp Now 0 0"
   UNLOADBMP "Next" 'free-up memory
   LOADBMP "Next", DefaultDir$+"\"+FilenameNext$+"_Next.bmp"
   #Main.GBx2 "down"
   #Main.GBx2 "drawbmp Next 0 0"
   WAIT

[MouseLeftButton]
   IF MouseX = 0 AND MouseY < 10 THEN [ABOUT] 'upper left screen edge "About..."
   IF MouseX = 0 AND MouseY > 530 THEN [QUIT] '"Quitter"
   WAIT

[MouseMove] 'get mouse's XY position - for programming purpose
   IF MouseX > 1720 AND MouseX < 1900 THEN #SideMenu "show"
   IF MouseX < 1720 THEN #SideMenu "hide"
   IF MouseX > 1910 THEN #SideMenu "hide"
   WAIT

[DanceSelection]
   FilenameNow$ = FilenameNext$
   IF MouseY < 45                    THEN FilenameNext$ = Dance$(0)  GOTO [REFRESH]
   IF MouseY >= 45  AND MouseY < 75  THEN FilenameNext$ = Dance$(1)  GOTO [REFRESH]
   IF MouseY >= 75  AND MouseY < 105 THEN FilenameNext$ = Dance$(2)  GOTO [REFRESH]
   IF MouseY >= 105 AND MouseY < 135 THEN FilenameNext$ = Dance$(3)  GOTO [REFRESH]
   IF MouseY >= 135 AND MouseY < 165 THEN FilenameNext$ = Dance$(4)  GOTO [REFRESH]
   IF MouseY >= 165 AND MouseY < 195 THEN FilenameNext$ = Dance$(5)  GOTO [REFRESH]
   IF MouseY >= 195 AND MouseY < 225 THEN FilenameNext$ = Dance$(6)  GOTO [REFRESH]
   IF MouseY >= 225 AND MouseY < 255 THEN FilenameNext$ = Dance$(7)  GOTO [REFRESH]
   IF MouseY >= 255 AND MouseY < 285 THEN FilenameNext$ = Dance$(8)  GOTO [REFRESH]
   IF MouseY >= 285 AND MouseY < 315 THEN FilenameNext$ = Dance$(9)  GOTO [REFRESH]
   IF MouseY >= 315 AND MouseY < 345 THEN FilenameNext$ = Dance$(10) GOTO [REFRESH]
   IF MouseY >= 345 AND MouseY < 375 THEN FilenameNext$ = Dance$(11) GOTO [REFRESH]
   IF MouseY >= 375 AND MouseY < 405 THEN FilenameNext$ = Dance$(12) GOTO [REFRESH]
   IF MouseY >= 405 AND MouseY < 435 THEN FilenameNext$ = Dance$(13) GOTO [REFRESH]
   IF MouseY >= 435 AND MouseY < 465 THEN FilenameNext$ = Dance$(14) GOTO [REFRESH]
   IF MouseY >= 465 AND MouseY < 495 THEN FilenameNext$ = Dance$(15) GOTO [REFRESH]
   IF MouseY >= 495 AND MouseY < 525 THEN FilenameNext$ = Dance$(16) GOTO [REFRESH]
   IF MouseY >= 525 AND MouseY < 555 THEN FilenameNext$ = Dance$(17) GOTO [REFRESH]
   IF MouseY >= 555 AND MouseY < 585 THEN FilenameNext$ = Dance$(18) GOTO [REFRESH]
   IF MouseY >= 585 AND MouseY < 615 THEN FilenameNext$ = Dance$(19) GOTO [REFRESH]
   IF MouseY >= 615 AND MouseY < 645 THEN FilenameNext$ = Dance$(20) GOTO [REFRESH]
   IF MouseY >= 645 AND MouseY < 675 THEN FilenameNext$ = Dance$(21) GOTO [REFRESH]
   IF MouseY >= 675 AND MouseY < 705 THEN FilenameNext$ = Dance$(22) GOTO [REFRESH]
   IF MouseY >= 705 AND MouseY < 735 THEN FilenameNext$ = Dance$(23) GOTO [REFRESH]
   IF MouseY >= 735 AND MouseY < 765 THEN FilenameNext$ = Dance$(24) GOTO [REFRESH]
   IF MouseY >= 765 AND MouseY < 795 THEN FilenameNext$ = Dance$(25) GOTO [REFRESH]
   IF MouseY >= 795 AND MouseY < 825 THEN FilenameNext$ = Dance$(26) GOTO [REFRESH]
   IF MouseY >= 825 AND MouseY < 855 THEN FilenameNext$ = Dance$(27) GOTO [REFRESH]
   IF MouseY >= 855 AND MouseY < 885 THEN FilenameNext$ = Dance$(28) GOTO [REFRESH]
   IF MouseY >= 885 AND MouseY < 915 THEN FilenameNext$ = Dance$(29) GOTO [REFRESH]
   IF MouseY >= 915                  THEN FilenameNext$ = ""         GOTO [REFRESH]
   WAIT

[ABOUT]
      NOTICE "à propos de..."+CHR$(13)+_
      "              --- K'elle Danse ---"+CHR$(13)+CHR$(13)+_
      "version "+PrgVersion$+" / résolution 1920x1080"+CHR$(13)+CHR$(13)
   WAIT
 
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Overlaying GRAPHICBOXES in window
« Reply #15 on: Jul 5th, 2017, 4:18pm »

on Jul 5th, 2017, 2:37pm, Rod wrote:
Not sure if this helps or not.

The same end result but achieved without any API calls (even works in Just BASIC):

Code:
nomainwin
WindowWidth  = 200
WindowHeight = 200
UpperLeftX = (DisplayWidth-WindowWidth)/2
UpperLeftY = (DisplayHeight-WindowHeight)/2
open "Graphic" for graphics_nsb as #1
#1 "trapclose [quit]"
#1 "down; fill blue; color yellow; backcolor blue"
#1 "font Consolas 40 ; place 30 110 ;\Text"
#1 "rule ";_R2_MASKNOTPEN
#1 "color blue; backcolor blue; place 0 0 ; boxfilled 200 100"
#1 "rule ";_R2_MERGEPEN
#1 "color red ; backcolor red; place 0 0 ; boxfilled 200 100"
wait 

[quit]
close #1
end 

Richard.

« Last Edit: Jul 5th, 2017, 4:21pm by Richard Russell » User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Overlaying GRAPHICBOXES in window
« Reply #16 on: Jul 5th, 2017, 5:41pm »

Quote:
The same end result but achieved without any API calls (even works in Just BASIC):

LOL
The point is that Rod's code draws transparent text on any background.
Any fancy loaded bitmap.

Speaking of "without any API calls"
As far as I remember, LB/JB drawbmp is not affected with RULE command.
Does LBB drawbmp obeys RULE command?
It looks something is changing.
So may be where is a way to make text look transparent on bitmap background, using RULE command?

EDIT and it looks like printing text is not affected with RULE command...

EDIT
Quote:
Does LBB drawbmp obeys RULE command?
It looks something is changing.

Not? sad((
« Last Edit: Jul 5th, 2017, 5:56pm by tsh73 » User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Overlaying GRAPHICBOXES in window
« Reply #17 on: Jul 5th, 2017, 7:18pm »

Uggg, not able to run the code too much missing info. It looks like you want to list dance routines and have the user click on one.

You seem to have a graphicbox set to do this with areas set for each dance routine. You will print text or draw graphics in each area that identifies the dance routine and the mouse will select them.

What are all the statictext commands for?

You could just have one single bmp with the selections pre drawn. So I am not understanding why it is getting so complex.

Why not forget the code for now and tell us in as many words as you can what the screen should look like and how the user should interact with it.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Overlaying GRAPHICBOXES in window
« Reply #18 on: Jul 5th, 2017, 8:15pm »

on Jul 5th, 2017, 5:41pm, tsh73 wrote:
Does LBB drawbmp obeys RULE command?

Remember, in both LB and LBB (and JB) the graphics capabilities are simply 'thin wrappers' around the Windows API (GDI). In each case the 'heavy lifting' is done by Windows itself so, pretty much without exception, you can assume that they will work the same way.

Indeed, you can often ascertain how they will work by checking the documentation at MSDN. In this case, LB's rule command translates directly to the SetROP2 API. If you look up that function at MSDN you will find that it says "The SetROP2 function sets the current foreground mix mode. GDI uses the foreground mix mode to combine pens and interiors of filled objects with the colors already on the screen". So only "pens and interiors of filled objects" are affected by rule.

Richard.
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Overlaying GRAPHICBOXES in window
« Reply #19 on: Jul 5th, 2017, 8:15pm »

Hi Rod,

I thought just running my code would be self explaining (...).

Quote:
not able to run the code too much missing info.
As far as I could test, anything is in the exe file I sent a link for in a previous post.
User IP Logged

Roger
flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Overlaying GRAPHICBOXES in window
« Reply #20 on: Jul 5th, 2017, 8:22pm »

Quote:
What are all the statictext commands for?

I'm populating a list of dances that will appear in the side window and as you noticed, I'm detecting the mouse position to make the selection.

Quote:
You could just have one single bmp with the selections pre drawn. So I am not understanding why it is getting so complex.

I actually did this in my version 0-0-1-0. But then, again, this are hard coded and I hate this. It is here http://home.citycable.ch/flotulopex/LBB/Image%20Launcher.exe
User IP Logged

Roger
flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Overlaying GRAPHICBOXES in window
« Reply #21 on: Jul 5th, 2017, 8:26pm »

Using a "graphics" type window, I cant get rid of the title bar.
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Overlaying GRAPHICBOXES in window
« Reply #22 on: Jul 5th, 2017, 10:22pm »

on Jul 5th, 2017, 8:26pm, flotulopex wrote:
Using a "graphics" type window, I cant get rid of the title bar.

As you say, there is no built-in window type that supports graphics but which has no title bar. You could presumably use STYLEBITS to create one, or alternatively use a window of type WINDOW_POPUP containing a GRAPHICBOX control, as the program you listed earlier does.

Richard.
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Overlaying GRAPHICBOXES in window
« Reply #23 on: Jul 7th, 2017, 07:57am »

...so is there any solution to draw text over my background or not?
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Overlaying GRAPHICBOXES in window
« Reply #24 on: Jul 7th, 2017, 08:30am »

on Jul 7th, 2017, 07:57am, flotulopex wrote:
...so is there any solution to draw text over my background or not?

Both Anatoly (tsh73) and Rod have given you solutions with worked examples. What is stopping you adapting their code to suit your precise requirements? If you were hoping that somebody else would modify your program, I think you will find that most people prefer to give hints and pointers to encourage you to learn for yourself.

Richard.
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Overlaying GRAPHICBOXES in window
« Reply #25 on: Jul 7th, 2017, 11:44am »

None of the links you provided us with actually lead to runnable code. Even the .exe does not run because of missing graphic resources. If you want us to help with your actual code you will need to zip the .bas file and all needed resources to a folder and share a link to that. Put everything in a new folder Right Click on it and choose Send To then choose zipped folder. Now put the .zip somewhere we can share.
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Overlaying GRAPHICBOXES in window
« Reply #26 on: Jul 7th, 2017, 11:50am »

I did run the EXE (may be it was previous version) but alas my montor works only up to 1280x1024, so I cannot work with program written to 1900xsomething.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Overlaying GRAPHICBOXES in window
« Reply #27 on: Jul 7th, 2017, 12:45pm »

on Jul 7th, 2017, 11:44am, Rod wrote:
If you want us to help with your actual code you will need to zip the .bas file and all needed resources to a folder and share a link to that.

Or use LBB's capability of embedding the resource files in the EXE (they are compressed when you do that)!

Richard.
User IP Logged

Pages: 1 2 3  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls