Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drag & Drop in a Grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00088798
Message ID:
00088838
Vues:
31
>I want to allow an operator to change the order of items in a grid (rows, not columns) through drag and drop. So I added a column at the far left with a button in it, just to give them a visual handle to grab; I am able to identify the active record when they do grab the handle (because the record is clicked on), but so far as I can tell that stays the active record even when the drop occurs.
>
>So my question is, is there any easy way (or any way at all) to tell when I am over a different record, and if so, which record that is?
>
>It seems that one cannot make a textbox (or some other control within a column) the target; it has to be the grid as a whole. Code to respond to DragOver in a column control does not fire whether or not there is similar code in the grid's DragOver. But then this means that there is no way to recognize the number of times the DragOver has fired (which would give a count of rows to skip).
>
>It occurs to me that I could do some pretty complex math involving the distance moved (based on starting and dropping YCoords) and the RowHeight of the grid, but how does one cope with fractions of a row (e.g. a move of two rows could be anywhere from 19 to 34 -- assuming a row height of 17, and a move of 25 could be either one or two rows depending on where in the first row it starts).
>
>Has anyone ever done anything like this or should I give up and find another way?
>
>Any help would be greatly appreciated
>
>Reg
>
>Thanks,
>
>Reg

No, I don't have the answer. I asked the same question a while ago. I have a feeling that the answer probably involves an active-x drag-button grid control. Please let me know if you find an answer.

This is something we want to do every time the user has a table whose records are supposed to be in a certain order, but has no natural field on which to order them. A field of meaningless numbers gets created, and we ask users to adjust the numbers, made visible in the grid, in order to get the order they want. Such a table probably began life as a word-processor document or a spreadsheet or something.

The next best thing is to make two columns in your grid, one with buttons that move a record up, another for down. Each click would swap the current record with the previous/next. I haven't tried that either.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform