Recent

Author Topic: Can components be dragged out of the form's boundary by enduser?  (Read 6102 times)

Elmug

  • Hero Member
  • *****
  • Posts: 849
Hi dear people,

I was wondering, for I could use if so, if components, by so establishing it, can be dragged out of the form's boundary by the end-user.

If so how-to would be appreciated.

Thanks!

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Can components be dragged out of the form's boundary by enduser?
« Reply #1 on: August 09, 2011, 04:03:03 am »
There is at least a mathematical way, to manually move components Left and Top properties along with cursor.

- Check when mouse is held down (components onMouseDown, onMouseUp)
- Check where cursor is now on screen (something like mouse.cursorpos)
- Save difference of cursor and component position, and also save original position in case user does not drag to outside
- While mousebutton is held down, reduce that difference from cursors current position
- If component is outside of screen -> ....

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: Can components be dragged out of the form's boundary by enduser?
« Reply #2 on: August 09, 2011, 04:10:01 am »
User 137,

I was hoping for a user to click on a component of the application, and without having to do math, just move it out of the form and leave it there and move it again, within or without the form.

For instance, a panel with some components on it.

Is that possible?

Thanks!


avra

  • Hero Member
  • *****
  • Posts: 2544
    • Additional info
Re: Can components be dragged out of the form's boundary by enduser?
« Reply #3 on: August 09, 2011, 10:35:18 am »
There are many ways to skin the cat...

You can move components position outside of the visible form, like
Code: [Select]
  Edit1.Left := 5000;Or you can modify the owner of the component and move it to some parent never shown or hidden. Or you can hide the component itself. Or create and destroy it programmatically.
Or take a look at the frames. Maybe they better suite your needs.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: Can components be dragged out of the form's boundary by enduser?
« Reply #4 on: August 09, 2011, 01:31:56 pm »
There are many ways to skin the cat...

You can move components position outside of the visible form, like
Code: [Select]
  Edit1.Left := 5000;Or you can modify the owner of the component and move it to some parent never shown or hidden. Or you can hide the component itself. Or create and destroy it programmatically.
Or take a look at the frames. Maybe they better suite your needs.

Thank you Avra.

I appreciate you kind explanation, and will study the suggestion.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Can components be dragged out of the form's boundary by enduser?
« Reply #5 on: August 21, 2011, 07:53:49 am »
Hiding the components can be done with  panel1.Hide; and restore with panel1.Show; or changing the .Visible property. They will hide the panel and all its contents.

While Edit1.Left := 5000; may work for most, maybe someone extreme is using 10 monitor desktop and still sees it  :D Also it will not prevent those components from getting Focus with tab for example.

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: Can components be dragged out of the form's boundary by enduser?
« Reply #6 on: August 21, 2011, 10:04:08 am »
Hiding the components can be done with  panel1.Hide; and restore with panel1.Show; or changing the .Visible property. They will hide the panel and all its contents.

While Edit1.Left := 5000; may work for most, maybe someone extreme is using 10 monitor desktop and still sees it  :D Also it will not prevent those components from getting Focus with tab for example.

Thank you much, EndUser.

I am already using this idea you discuss, and indeed it is correct that form sizes, locations, and so for can be peculiar to different systems, and need to be used with care.

Actually, though my original question is as in some applications I've seen, where one window can be dragged out of the mother window.

And, although I don't need to do that right now, I still am interested if that is possible, and if so, briefly, mentions of how it is to be approached are most welcome.

Thanks!

« Last Edit: August 21, 2011, 02:03:09 pm by Elmug »

 

TinyPortal © 2005-2018