Just BASIC Programming
Just Basic Newsletter >> Articles & Tutorials >> Background for a guiwindow program
http://justbasic.conforums.com/index.cgi?board=tutorial&action=display&num=1500998386

Background for a guiwindow program
Post by pmbolton on Jul 25th, 2017, 10:59am

Hello to those who stil use this great program.

I am creating a program which uses gui windows ALOT ... to make life more interesting and instead of background being a "colour" , I would like to have a picture behind which everything else sits above ...
Only way i have acheived this thus far is by creating a window filling button and uploading an image into it, then disabling that button so it is not active.. works perfectly well .. though one annoying snag....

when going from window closing to another opening.. the text on that screen does not show until I maximise the window.. then all works well..

My obvious question is, how do I acheive what I wish (if possible) without having to maximise the new window every single time??

Cheers for help.. hopefully
Paul
Re: Background for a guiwindow program
Post by pmbolton on Jul 25th, 2017, 11:02am

P.S
statictext does not show ... until maximise.. all other text issues show up first time
Re: Background for a guiwindow program
Post by pmbolton on Jul 25th, 2017, 11:10am

P.P.S
Sorry to linger on here smiley ..
is there quite simply a command which will automatically maximise the window,, maybe that would solve my problem
Re: Background for a guiwindow program
Post by Rod on Jul 25th, 2017, 11:12am

Some code to demonstrate would help us answer. First off you are not meant to place controls on graphic resources.

The graphicbox is set to take all sorts of mouse and keyboard input. By placing other controls that take mouse and keyboard input over that you are setting up a problem. The Z order of controls is also an issue.

Statictext are known not to work in graphic resources, so the fact it works at all is lucky.

I am guessing but I think the solution will be to place graphic resources "around" your gui controls. Either that or mimic gui controls inside your graphicbox.
Re: Background for a guiwindow program
Post by pmbolton on Jul 25th, 2017, 11:24am

Cheers for reply...
TBH alot of what you said went right over my head ... not been a big gui user up until this point.. so nove am afraid..

below is a simple example of what i mean... it does what it says on the tin.. but I need to maximise before statictext appears .. hope it helps

WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
UpperLeftx = 0
UpperLefty = 0

bmpbutton #HISTORYRECORDS.bmpbutton1, "C:\PREDMASTER\IMAGES\USING\HISTORYRECORDS.bmp", [bmpbutton1Click], UL, 0, 0

statictext #HISTORYRECORDS.statictext2, team$(1), 52, 29, 179, 30
listbox #HISTORYRECORDS.listbox2, team$(, [listbox2DoubleClick], 1024, 26, 182, 35

open "HistoryRecords" for window as #HISTORYRECORDS
#HISTORYRECORDS.bmpbutton1 "disable"
print #HISTORYRECORDS, "font Ariel_Black_serif 6 24"

[HISTORYRECORDS.inputLoop] 'wait here for input event
wait

Re: Background for a guiwindow program
Post by pmbolton on Jul 25th, 2017, 11:30am

if I delete the font line .. it works perfectly fine

but the default font i need glasses for smiley
Re: Background for a guiwindow program
Post by pmbolton on Jul 25th, 2017, 11:50am

Problem solved thankfully more simply than I thought...
It was the font size choice that is the problem..

7 24 works just fine and now gives me a faultless look to background images to the windows created.. sorry for wasting ya time
Re: Background for a guiwindow program
Post by rtr on Jul 25th, 2017, 3:44pm

on Jul 25th, 2017, 11:12am, Rod wrote:
First off you are not meant to place controls on graphic resources. The graphicbox is set to take all sorts of mouse and keyboard input. By placing other controls that take mouse and keyboard input over that you are setting up a problem.

The OP stated that the background image was placed on a BMPBUTTON, not on a GRAPHICBOX. Surely in that case most of your cautions do not apply?

Re: Background for a guiwindow program
Post by Rod on Jul 25th, 2017, 3:57pm

Yep,missed that point, who would have thought to put controls on a button. 7 24 does not work for me it still only shows after resize.

To explain Z order, imagine three buttons one on top of the other all exactly the same size. You click the mouse, which is clicked? Not them all, which? Top one, which is that?

Statictext don't react to mouse or keyboard so are special case but can you click through a statictext to the control below?

Me, I would stick to protocol.
Re: Background for a guiwindow program
Post by pmbolton on Jul 25th, 2017, 5:53pm

All is working fine now .. correct way or not
I can have a full screen image background .... disabled .. with any kind of text use above with 0 selection and now no viewing problems
Re: Background for a guiwindow program
Post by Rod on Jul 26th, 2017, 01:51am

Good, when I get some time I will experiment with your technique and see if it provides new functionality we have mostly avoided in the past.