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: 83
Joined: Sat May 21, 2016 5:27 am
Has thanked: 1 time
Been thanked: 9 times

Post by huiyi_ch » Wed Dec 13, 2017 2:27 am

thank you Edward!

User avatar
bpd2000
Posts: 1024
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 165 times
Been thanked: 72 times

Post by bpd2000 » Wed Dec 13, 2017 8:38 am

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: 341
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 95 times
Been thanked: 249 times

Post by edk » Wed Dec 13, 2017 3:22 pm

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 60 times

User avatar
serge_girard
Posts: 2092
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 432 times
Been thanked: 92 times
Contact:

Post by serge_girard » Wed Dec 13, 2017 4:44 pm

Thanks Edward !

Looks very great!

Serge

huiyi_ch
Posts: 83
Joined: Sat May 21, 2016 5:27 am
Has thanked: 1 time
Been thanked: 9 times

Post by huiyi_ch » Thu Dec 14, 2017 12:16 am

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

Looks very great!

Serge
+1

edk
Posts: 341
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 95 times
Been thanked: 249 times

Post by edk » Thu Dec 14, 2017 2:50 pm

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 62 times
PS Improvement of small bugs:
DragAndDrop_prg.7z
(3.51 KiB) Downloaded 60 times

edk
Posts: 341
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 95 times
Been thanked: 249 times

Post by edk » Sat Dec 16, 2017 10:10 pm

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 77 times

User avatar
bpd2000
Posts: 1024
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 165 times
Been thanked: 72 times

Post by bpd2000 » Sun Dec 17, 2017 4:24 am

Nice contribution, Thanks
BPD
Convert Dream into Reality through HMG

User avatar
Steed
Posts: 348
Joined: Sat Dec 12, 2009 3:40 pm
Has thanked: 1 time
Been thanked: 2 times

Post by Steed » Mon Dec 18, 2017 2:01 pm

Thanks

Post Reply