I’m having an odd problem when updating my app from RealStudio 2011Rel 3 to XOJO 2018 rel 2.
I have some code in the resize and resized events that work fine.
When I close the main window and create a new project, the new window will come up, but when I resize the new window, the bevel buttons disappear and it seems to ignore the resize. Things don’t move like they did in the initial main window until I try to resize it again, but still the buttons don’t appear. I tried refreshing the window, but that didn’t help and I tried setting the AutoDeactivate to off, but that didn’t help either.
Also if i close the new window then click on the menubar anywhere (not even selecting anything) a new main window appears. Really weird.
So with the initial window everything works fine, but when i close that window and open a new one things go wonky. Not sure where to look.
just tried removing all code from the resizing and resized events and still the buttons disappear on resize. I can see them flicker sometimes, however. some are in group boxes and 2 are out on their own.
I also tried commenting out everything in the close and open events. still lose the buttons on resize.
It is hard to tell based on your description but are you saying some buttons on your app’s main window disappear after you re-open that main window and resize it?
That certainly seems strange. Some things to look for:
- Check your locking to see if something is off here
- Are the controls “parented” wrong? That is, do they have as a parent another control instead of the main window?
- Are you certain there’s not code elsewhere that is modifying the buttons in some way?
- What happens if you remove these problem buttons and add back new ones?
I deleted one of the buttons and added a new one. It doesn’t seem to have the same problem when resizing, so I’ll go ahead and replace them all. Thanks Paul. BTW, enjoyed your Threading webinar on tuesday. it was very helpful.
now all the buttons are showing up, but the new window is still not jumping to the size it’s supposed to be. It ignores the resize. as a test I put a msgBox(“Window is open”) in the open event of the main window. It fires when I first start the app. If I close the window and open it again ( editorWin.close then editorWin.show) the window appears, but the open event is not firing. I do not get the msgBox. why would the new window not fire an open event? I also tried putting the resize code into the activate event but it ignored that too. If I manually change the window size, it will then jump to the right size. shouldn’t have to do that though.
becareful putting MSGBOX inside certain window events, as it moves the focus from the window, and then returns it, causing the sequence of events to not be what you would have normally expected.
Open happens when the window is created (or recreated)
Activate happens when the window gets the focus back (a msgbox in the wrong place will cause this to happen over and over)
Resizing, usually happens when LiveResize and window changes via code (width=x) or mouse drag
Resized happens when Resizing is completed
You never call Resizing or Resized, (or Open/Activate) directly under any circumstances. If some function is required outside of the run/event loop… more it to a method that can be accessed by the event.
yeah the msgbox was simply a test to see if the open event was firing. thanks for the clarification on open and activate.
although the window is opening, it seems to ignore the code in the resizing event when I drag the window or it will change somewhat erratically, like it won’t move the window controls when enlarging, then it will when reducing the window size, but not correctly. the original main window works very smoothly as it should when i enlarge and reduce the window size, so I can’t figure out what’s different about the new window than the original one that opens when the app opens.
have you checked the locks on each control?.. sounds like they are not correct
nothing is locked. i tried explicitly setting lockbottom and lockright to false on some of the larger controls and it doesn’t seem to help.
Resizeing is fired when the window is resizing
(during the resize).
My best advice is to create a brand new project with one window, a MenuItem for Window1.Close, another for Window1.Show and a PushButton somewhere on the Window, near the window bottom/right.
Then add code to resize the window (in Window1.Open for example).
Because a resize is done from bottom-right to top-left, be sure, as Dave wrote, to lock your Button to left and top.
I just noticed my old project file was using a class called UndoToolKit for some of the controls like the listbox. I made a new listbox and gave it all the same coding for the events and i removed the old listbox and gave the new one the name listbox1 like the old one. but when i run my app it won’t resize at all. nothing seems to work right. kind of a mess i’m going to have to sort out. odd that although i didn’t have the UndoToolKit in my new project that the controls were working properly even though their class was set to that (like UndoableListBox). It’s just when I made a new instance of the window it didn’t construct it using that class I suppose. wonder why it won’t resize, though, if it’s not using the undoable listbox now. Tried doing a project-wide name change to listbox10, but that didn’t work either. Maybe i need to just rebuild the whole project from scratch using the same code.
Nothing will resize if you don’t lock the corners… you must lock RIGHT and/or BOTTOM to get the size to change along with the window… otherwise they stay in one place at one size
ah, ok. I think that was it. i thought it was just the opposite. I thought if i locked the bottom and right it would NOT move. Thanks!