Hi!
I'm here because i hope someone can explain me the strange thing is happening.
On Page1 I have 5 Button objects;
On the global functions event I have a table with all the button objects:
On the OnKey event I have this code:Code:tblObjects = {} tblObjects.FirstObject = "Button1"; tblObjects.Object2 = "Button2"; tblObjects.Object3 = "Button3"; tblObjects.Object4 = "Button4"; tblObjects.LastObject = "Button5";
(OT: sorry, I don't have much time to add the color codes to the code... )Code:--an elseif statement to determine if the "S" or (elseif) the "W" Button on the keyboard is down if (e_Key == 83) then --Get the position for the first button (tblObjects.FirstObject) in the table PosA = Button.GetPos(tblObjects.FirstObject); --an if..else statement to determine if the "Shift" button on the keyboard is down if (System.IsKeyDown(16) == true) then --an if statement to determine if when decreasing by 20 the position of the first button it isn't out of page bounds upside if not ((PosA.Y - 20) < 0) then --a for..do function to move up by 20 each button in the table for i, variable in tblObjects do Button.SetPos(variable, Button.GetPos(variable).X, Button.GetPos(variable).Y - 20); end end else --an if statement to determine if when decreasing by 10 the position of the first button it isn't out of page bounds upside if not ((PosA.Y - 10) < 0) then --a for..do function to move up by 10 each button in the table for i, variable in tblObjects do Button.SetPos(variable, Button.GetPos(variable).X, Button.GetPos(variable).Y - 10); end end end elseif (e_Key == 87) then --W --Get the position of the last button in the table (tblObjects.LastObject) PosB = Button.GetPos(tblObjects.LastObject); --Get the size of the last button in the table (tblObjects.LastObject) SizB = Button.GetSize(tblObjects.LastObject); --Get the size of the entire application window WinSize = Window.GetSize(Application.GetWndHandle()); --an if..else statement to determine if the "Shift" button on the keyboard is down if (System.IsKeyDown(16) == true) then --an if statement to determine if when increasing by 20 the position of the last button it isn't out of page bounds downside if not ((PosB.Y + SizB.Height + 20) > WinSize.Height) then --a for..do function to move down by 20 each button in the table for i, variable in tblObjects do Button.SetPos(variable, Button.GetPos(variable).X, Button.GetPos(variable).Y + 20); end end else --an if statement to determine if when increasing by 10 the position of the last button it isn't out of page bounds downside if not ((PosB.Y + SizB.Height + 10) > WinSize.Height) then --a for..do function to move down by 10 each button in the table for i, variable in tblObjects do Button.SetPos(variable, Button.GetPos(variable).X, Button.GetPos(variable).Y + 10); end end end end
All this code is built to move the buttons up and down by 10 pixels, and if the shift button is pressed to move faster, so, by 20 pixels. Also, it is built to stop moving if the buttons are going out of the page bounds in the upside and downside.
My project is set to have the 640 x 480 size (not resizable). And here we go with troubles... if I set the window to be flat or bordered, the code works as it's build for. But if I set the project to have a standard window (with minimize and close buttons) it doesn't stop when the last button is going out of the page bounds downside, it goes down for 15 or 20 pixels and just then it stops (the code for the upside always works fine).
So, can anyone please explain me why with flat and bordered window it works fine but with standard window it doesn't? Is there any mistake in my code?
EDIT
I added an attachment with the project
Thanks to anyone will answer,
Bye!

Reply With Quote