B4J Question Resize Pane

Blueforcer

Well-Known Member
Licensed User
Longtime User
Hi,i have a draggable pane in my gui, so the User can move it to another place.
Is it possible that the User can also resize it, like a normal window?
 

stevel05

Expert
Licensed User
Longtime User
Something like this? See post#6
 
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Try this one, I've put all of the required modules in the project. It's overkill for what you want but you can take what you want from it. See post #6
 
Last edited:
Upvote 0

walterf25

Expert
Licensed User
Longtime User
I've stripped the zoompane out of this one, probably easier to see what you need. Sorry, should have done that before posting in the first place
This works fine if a pane is placed inside the root or main, but if I create a pane then load a layout inside that newly created pane, then everything goes out of whack, meaning that the cursor doesn't change accordingly, for example if I put the mouse over the top left corner the Move cursor shows up when it should be the NE_RESIZE cursor, how to fix this?

Walter
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Can you upload a small project that shows the problem?
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Can you upload a small project that shows the problem?
Here is a small project, is basically your same example but I have added an extra pane, and added the two smaller panes inside of this parent pane.
 

Attachments

  • ResizeHandlerBasic.zip
    8 KB · Views: 85
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The initial code was not written to account for the panes being added to a parent, and did all calculations based on the Root pane as the parent.

This version determines the absolute offset for the views by traversing up the tree until it finds an AnchorPane. This will obviously fail if you actually add an AnchorPane to the layout (which you shouldn't), but if you absolutely have to, the you will need to amend the code and pass the root pane to the initialize method and test for equivalence in the loop that calculates the absolute ParentX and Y.

Try this one:
 

Attachments

  • ResizeHandlerBasicWithParent.zip
    8.2 KB · Views: 68
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Thank you very much, that seems to work great.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…