Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Drag&Drop from ActiveX to a Container Class
Message
De
15/02/2005 12:23:28
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
14/02/2005 13:11:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows NT
Database:
Visual FoxPro
Divers
Thread ID:
00986705
Message ID:
00987120
Vues:
43
>Hello Everyboby.
>
>I do not have much/any experience with drag & drop, so i hope you all can help me here.
>
>I have a Treeview ActiveX contoll in which each node shows a part number (mutible fields) and some other information. what i whant to do is to enable a drag/drop operation starting from the activeX to a container control (which contains my part number object, mutible fields).
>
>i was thinking to create an object in the activex for the partnumber, then at the container drop receive the object, analyze it, and populate my part number object in the container.
>
>is this the correct approach, and how do i do the drag drop operation? can i somehow pass the temporary passed opject to the receiving controll? i did not see a way to do that.
>
>any suggestions, or sample code? i sure would appreatiate all your help & tips you can give me.
>
>thank you in advance as always.
oForm = Createobject('myForm')
oForm.Show
Read Events

Define Class myForm As Form
  Height = 300
  Width = 470
  DoCreate=.T.
  Datasession=2

  Add Object myTree As OleControl With ;
    Top = 0, ;
    Left = 0, ;
    Height = 300, ;
    Width = 200, ;
    Name = "myTree", ;
    OleClass = 'MSComCtlLib.TreeCtrl'
  Add Object myGrid As myGrid With ;
    Top = 0, ;
    Left = 220, ;
    Height = 300, ;
    Width = 250, ;
    Name = "myGrid"

  Procedure Load
  Create Cursor myTest (myID i, myType c(20))
  For ix = 1 To 20
    Insert Into myTest (myID) Values (ix)
  Endfor
  Locate
Endproc
  Procedure myTree.Init
  #Define tvwFirst	0
  #Define tvwLast	1
  #Define tvwNext	2
  #Define tvwPrevious	3
  #Define tvwChild	4

  With This
    .linestyle =1
    .labeledit =1
    .indentation = 5
    .PathSeparator = '\'
    .Scroll = .T.
    .OLEDragMode = 1

    For ix=1 To 3
      .Nodes.Add(,tvwFirst,"root"+Ltrim(Str(ix)),'Main node '+Ltrim(Str(ix)))
      For jx=1 To 4
        .Nodes.Add("root"+Ltrim(Str(ix)),tvwChild,;
          "child"+Ltrim(Str((ix-1)*4+jx)),;
          'Child '+Ltrim(Str(jx))+' of '+Ltrim(Str(ix)))
      Endfor
    Endfor
  Endwith
Endproc

  Procedure QueryUnload
  Clear Events
Endproc
Enddefine

Define Class myGrid As Grid
  OLEDropMode = 1
  Procedure OLEDragOver
  Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
  With This
    lnActiveRow = Ceiling( ;
      ( nYCoord - (.Top + .HeaderHeight) ) / .RowHeight )
    .ActivateCell(lnActiveRow,2)
  Endwith
Endproc
  Procedure OLEDragDrop
  Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
  If oDataObject.GetFormat(1)
    With This
      .Columns(2).Text1.Value = oDataObject.GetData(1)
    Endwith
  Endif
Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform