Drag grid item to another grid

Utilities like DBU, Make, IDE written in HMG/ used to create HMG based applications

Moderator: Rathinagiri

huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Re: Drag grid item to another grid

Post by huiyi_ch »

thank you Edward!
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: Drag grid item to another grid

Post by bpd2000 »

serge_girard wrote: Tue Dec 12, 2017 4:10 pm Great and many thanks!

I will take a look at it asap!

Serge
+1
BPD
Convert Dream into Reality through HMG
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Drag grid item to another grid

Post by edk »

Next version.
  • Support for LISTBOX and LISTBOX Multiselect has been added.
  • Support for Grid Multiselect has been added.

    Because the Multiselect support has been added, the concept of storing the dragged variables has been changed. Each table item is one record. Each record is an array containing data:
    Grid - cell values ​​in a row.
    TextBox, EditBox - value of the control
    RichEditBox - if there is no text selection, the contents of the control, if selected, is the selection value.
    ListBox - item value.
  • The mouse pointer has been changed to drag.
  • Small fixes for using EditBox and RichEditBox.
Dragging from ListBox only with the right mouse button.

There is a problem with determining the row position when dropping data on ListBox. I can not determine this based on the parameter lParam. The GET_DRAG_LIST_DRAGITEM function does not work properly due to receiving the wrong control handle. I do not know why the received control handle differs from the saved value _HMG_SYSDATA [54].
Therefore, the function of handling the data dropout on ListBox is limited and it is not possible to simulate the data insertion operation between items as in Grid.
Attachments
DragAndDrop_0.002.7z
(1.07 MiB) Downloaded 290 times
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Drag grid item to another grid

Post by serge_girard »

Thanks Edward !

Looks very great!

Serge
There's nothing you can do that can't be done...
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Re: Drag grid item to another grid

Post by huiyi_ch »

serge_girard wrote: Wed Dec 13, 2017 4:44 pm Thanks Edward !

Looks very great!

Serge
+1
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Drag grid item to another grid

Post by edk »

Another version.
While dragging the data, a preview of what we drag. :)
Unfortunately, when dragging ListBox, the preview is not precise. :(
DragAndDrop_0.003.7z
(1.1 MiB) Downloaded 285 times
PS Improvement of small bugs:
DragAndDrop_prg.7z
(3.51 KiB) Downloaded 267 times
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Drag grid item to another grid

Post by edk »

Next version.
Support for dragging GRID column headers has been added.

Due to the ON HEADCLICK event handler, dragging is possible with the right mouse button only.

Within the same Grid, dragging the header changes the order of the columns.

Dragging a column header from GRID Form_1 to Grid Form_2 or Form_3 adds a new column.
By the way, I found a bug in the operation of the AddColumnEx method.
If we add a new column between existing ones, after inserting the column, the neighbor column's caption also changes.

You can test this eg in \SAMPLES\Controls\Grid\GRID_40 changing in file demo.prg line No. 108 from

Code: Select all

@ 250,  55 BUTTON Button_1 CAPTION "AddCol" ACTION Form_1.Grid_1.AddColumnEx (Nil, "Col"+alltrim(str(++n)), 100, NIL, {'TEXTBOX','NUMERIC','$ 999,999'})
to

Code: Select all

@ 250,  55 BUTTON Button_1 CAPTION "AddCol" ACTION Form_1.Grid_1.AddColumnEx (2, "Col"+alltrim(str(++n)), 100, NIL, {'TEXTBOX','NUMERIC','$ 999,999'})
Dragging GRID columns is possible only within currently visible columns and only from GRID, in which Items are.

In addition, the problem with ScrollBar in GRID was revealed. By moving the mouse pointer to ScrollBar the handle does not change, and the program "Sees" as if it was still on GRID, moving the slider horizontally may result in a drag effect.

I'm really sorry for the imperfections of my DragAndDrop.

Certainly better results could be obtained using the C language, but this is beyond my reach.
Attachments
DragAndDrop_0.004.7z
(6.92 KiB) Downloaded 272 times
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: Drag grid item to another grid

Post by bpd2000 »

Nice contribution, Thanks
BPD
Convert Dream into Reality through HMG
User avatar
Steed
Posts: 427
Joined: Sat Dec 12, 2009 3:40 pm

Re: Drag grid item to another grid

Post by Steed »

Thanks
Post Reply