Author Topic: New screen - How?  (Read 7423 times)

0 Members and 1 Guest are viewing this topic.

Offline Mad Axeman

  • Newbie
  • Posts: 74
    • View Profile
    • My web site - Harrythetrout
New screen - How?
« on: December 15, 2021, 11:50:32 am »
Let's say you have created your screen, it's done it's bit and then you need another new screen with completely different inputs. Is that possible?
Oh look - a sig file :-)

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: New screen - How?
« Reply #1 on: December 15, 2021, 12:19:20 pm »
Easily doable.


FirstScreen = _NEWIMAGE(640,480,32)
SecondScreen = _NEWIMAGE(640, 480, 32)

'Do stuff on first screen
SCREEN FirstScreen
CLS, _RGB32(0, 0, 255)
SLEEP

'Phew!  I did a lot and now I'm done.
'Go to second screen
SCREEN SecondScreen
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Mad Axeman

  • Newbie
  • Posts: 74
    • View Profile
    • My web site - Harrythetrout
Re: New screen - How?
« Reply #2 on: December 15, 2021, 12:29:29 pm »
That's fine in plain QB64 but would it work the same with Inform? I haven't played around with it yet but looking at the video about creating a simple word search prog then I can't see how you would design the two screens in Inform and then integrate them into 1 QB64 prog??
Oh look - a sig file :-)

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: New screen - How?
« Reply #3 on: December 15, 2021, 01:27:23 pm »
I think, it is none problem, if you use more screens as virtual screens as in this example. For writing points (and text) to this virtual screens use _DEST, for reading colors using POINT from this screen use _SOURCE. This screens does not have to  be visible and you can making with them as with normal images.

Code: QB64: [Select]
  1. Screen1 = _NewImage(640, 480, 32)
  2. Screen2 = _NewImage(640, 480, 32)
  3. _Dest Screen1
  4. Cls , Yellow
  5. _PrintString (100, 240), "This is Screen 1"
  6. _Dest Screen2
  7. Cls , Red
  8. _PrintString (440, 240), "This is Screen 2"
  9.  
  10. DefaultScreen = _NewImage(1980, 1050, 32)
  11. Screen DefaultScreen
  12.     _Dest Screen1
  13.     Locate 1, 1: Print Time$ 'works on unvisible screen1 - print time$
  14.  
  15.     _Dest Screen2
  16.     Circle (Rnd * 640, Rnd * 480), 10, _RGB32(255 * Rnd, 255 * Rnd, 255 * Rnd) 'works on unvisible Screen2 - draw circle
  17.  
  18.     _Dest 0 ' 0 is always visible SCREEN
  19.  
  20.     _PutImage (0, 0), Screen1, 0 'place first screen as image to visible screen
  21.     _PutImage (1980 / 2, 0), Screen2, 0 'place second screen as imge to visible screen
  22.  
  23.     _Display
  24.     _Limit 20
  25.  

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: New screen - How?
« Reply #4 on: December 15, 2021, 02:14:39 pm »
I rather think that @Mad Axeman is correct here.  In Inform, you can only have the one screen open.  Everything has to be done in the one Inform window.  The Master (@FellippeHeitor) will need to give the Intellignt Answer.

FellippeHeitor

  • Guest
Re: New screen - How?
« Reply #5 on: December 16, 2021, 04:48:03 pm »
The way to have a different set of controls in the same app is to keep different sets in different containers, like a frame. Create your "sub dialog" inside a frame, then hide it from view (either by placing its .Left and .Top properties outside the form's boundaries or by setting it to .Hidden = True).

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: New screen - How?
« Reply #6 on: December 17, 2021, 04:34:33 am »
Yes, I have done this a few times in InForm projects and it works very well.

Offline Mad Axeman

  • Newbie
  • Posts: 74
    • View Profile
    • My web site - Harrythetrout
Re: New screen - How?
« Reply #7 on: December 17, 2021, 04:27:08 pm »
I'm not sure what you mean. Any chance you could give a simple demo of how to do this? If it helps, what I want to do is have an input screen with various input boxes and drop downs plus wait for input from a barcode scanner. If it gets the input from the screen prompts it keeps what is on the screen, adds 'Loading', does it's stuff then prints 'Completed'

 If a scanner input is registered then is jumps to the screen for section 'B' where it reads the data from that barcode and displays it on a the new screen.
Oh look - a sig file :-)

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: New screen - How?
« Reply #8 on: December 21, 2021, 10:10:39 am »
If it is any use, please see my Gravitational Simulation program

https://www.qb64.org/forum/index.php?topic=581.msg4319#msg4319

This is an Inform project where controls are brought in and out of the Inform window (just as, say, images would be loaded/unloaded).  Line 628 onwards deals with how the Controls are handled.

If you run the program and click on the Options in the Simulation Type frame, you will see Controls removed/loaded as necessary.  It is a restriction in Inform that you can only use the one window created with the UIEditor, and you have to load/unload Controls as necessary within that window.  Use the Top/Left/Hidden/Disabled Control parameters as necessary.

I think that the UIEditor does not like Controls on top of each other / overlapping.  So, as a tip place your controls so that this does not occur at design and move them into position as required at run.  I also make sure that Controls don't overlap at runtime.

Hope that helps.
« Last Edit: December 21, 2021, 10:19:04 am by Qwerkey »

Offline Mad Axeman

  • Newbie
  • Posts: 74
    • View Profile
    • My web site - Harrythetrout
Re: New screen - How?
« Reply #9 on: December 23, 2021, 06:21:27 am »
Thanks Qwerkey. I'll take a look. No doubt I'll have questions :-)
Oh look - a sig file :-)