Board Logo
« Window in Window »

Welcome Guest. Please Login or Register.
Feb 25th, 2018, 7:55pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Window in Window  (Read 210 times)
Bonemaster
New Member
Image


member is offline

Avatar




PM


Posts: 4
sad Window in Window
« Thread started on: Nov 18th, 2017, 09:14am »

Hello! i am new to language and get peices from here and there just doing what i can to somehow create this project i'm working on and so far it's going really well although i just ran into at huge problem with making this from main window through button to 2nd window through button to 3rd window keeping this as generic as possible could some1 please show me some code or otherwise help me out, please? i'm new.
« Last Edit: Nov 18th, 2017, 09:14am by Bonemaster » User IP Logged

Bonemaster
New Member
Image


member is offline

Avatar




PM


Posts: 4
sad Re: Window in Window
« Reply #1 on: Nov 18th, 2017, 09:17am »

i can create the main window through button to second window through button to third window and click the 3rd window buttons to open up the 3rd window boxes and that works but when i exit out of 3rd window and go back in the buttons are dissapeared otherwise works great
User IP Logged

Facundo
Board Moderator


member is offline

Avatar




PM

Gender: Male
Posts: 1310
sad Re: Window in Window
« Reply #2 on: Nov 18th, 2017, 2:10pm »

Can you please post some code? how do you do to close each Window? are you using the trapclose statement?
User IP Logged

cundo aka MSlayer
tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3648
sad Re: Window in Window
« Reply #3 on: Nov 18th, 2017, 2:13pm »

Hello Bonemaster

Could you post some code?
I's really hard to guess what's going on.
EDIT (+1 to Facundo wink )
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1273
sad Re: Window in Window
« Reply #4 on: Nov 18th, 2017, 4:26pm »

Yes some code is worth thousands of words and breaks right through language barriers.

Or perhaps you can copy and strip down code to essential problem... might make things clear for yourself as well!
User IP Logged

B+
Bonemaster
New Member
Image


member is offline

Avatar




PM


Posts: 4
sad Re: Window in Window
« Reply #5 on: Nov 18th, 2017, 9:00pm »

Hey all thx for the responses already here is my code im totally new to this and a little self conscious as this is my work so here it is thanks again



[start]
nomainwin

WindowWidth = 800
WindowHeight = 500
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)

button #One.buttonTwo, "BoxTwo", [Two], UL, 25, 250, 100, 25
button #main.buttonOne, "BoxOne", [One], UL, 22, 301, 100, 25
loadbmp "BMP2", "BMP2.bmp"
loadbmp "BMP1", "BMP1.bmp"
menu #main, "Options", "&quit", [quit]

OPEN "This Box One" FOR GRAPHICS_NSB_FS as #main
print #main, "font ms_sans_serif 0 16"
print #main, "trapclose [quit]"

print #main, "background BMP1"
print #main, "drawsprites"

wait


[One]
loadbmp "BMP2", "BMP2.bmp" 'The RED window in upper left corner
OPEN "BoxOne" FOR graphics AS #One
PRINT #One, "trapclose [quitOne]"

print #One, "drawbmp BMP2 10 10 1000 1000; flush"

wait
[quitOne]
CLOSE #One

WAIT

[Two]
loadbmp "BMP3", "BMP3.bmp"
OPEN "BoxTwo" FOR graphics AS #Two
Print #Two, "trapclose [quitTwo]"

print #Two, "drawbmp BMP3 10 10 1000 1000 ;flush"

WAIT
[quitTwo]
CLOSE #Two

WAIT



[quit]

CLOSE #main

end




PLS HELP with my disappearing buttons
thank you!


User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1273
sad Re: Window in Window
« Reply #6 on: Nov 18th, 2017, 10:54pm »

Man if this your first code post congratulations! it is way, way more advanced than my first.

In the future you should put your code in code tags so it reads and copies from a code box. Look for the # button in the forum editor, it is in the 2nd row 5th from the right. Click it first and paste your code between <code> and </code> or select all your code and click the # button.

I am having problems accessing bmp files I can use to substitute for what you may be using, I assume any bmp would do.

I am sure someone more qualified with multi-windows will see right away why buttons are not showing when close a window. Having the code is great help! My guess is you would need some sort of refresh when a window on top is closed, perhaps a flush for each window after they are drawn?
« Last Edit: Nov 18th, 2017, 10:57pm by bplus » User IP Logged

B+
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1273
sad Re: Window in Window
« Reply #7 on: Nov 18th, 2017, 11:08pm »

OK I did get this to work in JB 2.0

Code:
[start]
nomainwin

WindowWidth = 800
WindowHeight = 500
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)

button #One.buttonTwo, "BoxTwo", [Two], UL, 25, 250, 100, 25
button #main.buttonOne, "BoxOne", [One], UL, 22, 301, 100, 25

loadbmp "BMP1", "bmp\Button01.bmp"
menu #main, "Options", "&quit", [quit]

OPEN "This Box One" FOR GRAPHICS_NSB_FS as #main
print #main, "font ms_sans_serif 0 16"
print #main, "trapclose [quit]"

print #main, "background BMP1"
print #main, "drawsprites"

wait


[One]
loadbmp "BMP2", "bmp\Button02.bmp" 'The RED window in upper left corner
OPEN "BoxOne" FOR graphics AS #One
PRINT #One, "trapclose [quitOne]"

print #One, "drawbmp BMP2 10 10"

#One, "flush"
wait
[quitOne]
CLOSE #One

WAIT

[Two]
loadbmp "BMP3", "bmp\Button03.bmp"
OPEN "BoxTwo" FOR graphics AS #Two
Print #Two, "trapclose [quitTwo]"

print #Two, "drawbmp BMP3 100 100"

#Two, "flush"

WAIT
[quitTwo]
CLOSE #Two

WAIT



[quit]

CLOSE #main

end
 


Oh, I see I can go back and forth from 2nd and 3rd windows but going from 1 to 2 a second time, that is when the button on #2 to go to #3 does not appear.
« Last Edit: Nov 18th, 2017, 11:20pm by bplus » User IP Logged

B+
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3174
sad Re: Window in Window
« Reply #8 on: Nov 19th, 2017, 03:13am »

Using multiple Windows might not be the best solution to your problem. You can show and hide controls in a single window for example.

If you are using multiple windows you have to open them in strict order and close them in strict order. The button creation code must be set just before the open window command so setting it once at the head of the program and then later opening and closing windows wont cut it.

There are demos on the LBPE and the sample files have multiwin.bas But be sure you really need multiple windows, it just makes coding twice as hard.

http://lbpe.wikispaces.com/Managing+Multiple+Windows
User IP Logged

tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3648
sad Re: Window in Window
« Reply #9 on: Nov 19th, 2017, 06:59am »

Quote:
he button creation code must be set just before the open window command so setting it once at the head of the program and then later opening and closing windows wont cut it.

That is, just move
Code:
button #One.buttonTwo, "BoxTwo", [Two], UL, 25, 250, 100, 25 

after
Code:
[One] 

label.
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
Bonemaster
New Member
Image


member is offline

Avatar




PM


Posts: 4
smiley Re: Window in Window
« Reply #10 on: Nov 19th, 2017, 1:17pm »

Thank you, all. I am getting things working. My project is alive and well! thank you all so much... i couldn't be happier!
User IP Logged

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

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls