curly
Full Member
Posts: 161
|
Post by curly on Nov 10, 2021 7:54:02 GMT -5
Good morning all,
I have just two main windows of identifical size. One is used purely to collect data with lots of text and comboboxes. The other for all the admin functions and monitoring progress. They are not full screen, and I simply scaled them to accomodate the GUI objects needed. They are about 15% bigger than the tablet screen, so I'm sure I can resize them to include everything, and as you suggest Rod, make use of every single pixel on the tablet, and yes, we will limit ourselves to one model of tablet.
One thing I learnt a long while ago is that if you have more than one copy of something important, it is really easy to modify one but not the other, and they quickly become very different. So although I keep a backup, I have only one main file. My plan was to have two sets of GUI data in the .bas file, one for a desk top, and the other for the tablet, and use a simple switch and branch to determine which set is used when compiling the standalone programme. The data processing will be identical for both. Does this seem a viable way forward to the experts? Kind regards, David
|
|
|
Post by Walt Decker on Nov 10, 2021 8:37:20 GMT -5
Do you hard code the position and size of all your controls? If so, that is about the only choice you have unless you want to revise the product.
If you plan to sell the product to other electrical engineering firms, don't. You will be getting way over your head.
|
|
curly
Full Member
Posts: 161
|
Post by curly on Nov 10, 2021 10:28:16 GMT -5
Hi Walt,
All GUI objects and controls are hard coded. I didn't realise there were other options?
I won't be selling it. It is for our own use.
Kind regards, and thanks again, David
|
|
|
Post by Walt Decker on Nov 10, 2021 11:04:58 GMT -5
Of course there are other options. Most LB controls provide the LOCATE statement that allows you to move and resize controls after they have been placed. Another option is to determine the sizes of the sizing border, the thin-line black border, the thickness of the caption, and the thickness of the menu (if there is one). Then place your controls with variables and offsets so they do not overlap and finally to set your window to the width and height of the aggregate of the horizontal and vertical plus the sizes of the afore mentioned sizes. This appears to be a lot of code; it really is not.
It would be much easier if LB allowed controls to be defined after their parent window is defined.
|
|
curly
Full Member
Posts: 161
|
Post by curly on Nov 13, 2021 9:17:26 GMT -5
Hi Walt,
That is really clever, I wish I'd thought of it! If a variable is used when defining the location of a textbox, if the variable is subsequently changed and the textbox hidden and then shown, will the textbox still be in the same place?
I'm thinking I will resize my windows to suit the full screen of the tablet, and redefine my boxes using variables.
Kind regards, David
|
|
|
Post by mknarr on Nov 13, 2021 9:49:57 GMT -5
I've never used "Locate" mainly in a commercial program I sold, all my windows, and there were dozens, were Dialog windows except the main window. But what I have done is check the size of the users display and then had variables for different size windows and located the controls before the window was open using hard coated locations plus the variable for the location. At that time all the dialog windows were limited to 600 x 480. Since everybody has bigger displays the largest dialog window I have now is 800 x 600 and only large enough to hold the necessary controls.
|
|
|
Post by Walt Decker on Nov 13, 2021 10:13:59 GMT -5
Hi Walt, That is really clever, I wish I'd thought of it! If a variable is used when defining the location of a textbox, if the variable is subsequently changed and the textbox hidden and then shown, will the textbox still be in the same place? I'm thinking I will resize my windows to suit the full screen of the tablet, and redefine my boxes using variables. Kind regards, David David:
You do not have to hide the window or the controls.
assume:
X = 5 Y = 5 Wide = 50 High = 25 BUTTON, #SOMETHING.BTN1, "PUSH", [PUSH.BTN], UL, X, Y, WIDE, HIGH OPEN "SOMETHING" FOR WINDOW AS #SOMETHING Btn$ = "#SOMETHING.BTN1"
RetVal = FN.MoveIt(Btn$, X, Y, Wide, High)
WAIT
FUNCTION FN.MoveIt(Ctl$, X, Y, Wide, High)
X = X + 50 Y = Y + 50 PRINT #Ctl$, "locate "; X;" ";Y;" ";Wide;" ";High END FUNCTION
That will move the button to a new position at its current width and height. Be aware that LB has a parser bug. When you define your contols you cannot use the same variable for each control unless in the definition you add an offset, e. g.:
BUTTON #SOMETHING.BTN ..., ..., ... X, Y, ..., ... BUTTON #SOMETHING.BTN1 ..., ..., ... X + 55, Y + 30, ..., ...
That makes it a little tricky, but there is a way around that if you are willing to use API.
EDIT:
On second thought you do not need API as long as you know the client area of the window. The client area is that area that is not caption, menu or border. When you define a window you are NOT defining the client area but the entire size of the window.
|
|
|
Post by Brandon Parker on Nov 13, 2021 14:33:10 GMT -5
|
|
curly
Full Member
Posts: 161
|
Post by curly on Nov 15, 2021 6:56:06 GMT -5
Hi again, Being a novice, I'm not up to speed with the terms you all use for the various GUI objects, so please forgive me if I get it wrong. It looks to be as if textboxes and comboboxes are referred to as 'controls'? Assuming that is the case,....
First Walt - I hide and show controls as they are needed. When a user makes a choice, some controls automatically become N/A, so I hide them until such time that they become relevant again to avoid wasted time looking at them. My concern was if a control is declared with a variable, and the control is then hidden, and that variable is changed, will the texbox reappear in a different place when it is 'shown'? I'm not looking to move controls about whilst running the application, but use variables that will enable me to change layouts by simply changing the value of the variables, either hard coded, or by the user as part of start up. I have copied and saved your example in case I have the need, so thank you.
Brandon, I am currently studying 'The ABC of APIs Lesson 1'from Alyces Restaurant to get a start using APIs and DLLs, and your Pseudo PopUpMenu is a bit beyond me at the moment. Being really old means I learn a lot slower than I used to. It's my birthday today, one year older, one day slower! I now find it takes me all night to do one of the things I used to do all night.
|
|