{"id":98,"date":"2007-05-12T14:03:21","date_gmt":"2007-05-12T12:03:21","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/nsonic-homepage\/"},"modified":"2007-05-12T14:04:09","modified_gmt":"2007-05-12T12:04:09","slug":"nsonic-homepage","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/nsonic-homepage\/","title":{"rendered":"TreeView Scroll when Drag"},"content":{"rendered":"<p>The following code works in a TListBox. I assume that it will also work<br \/>\nin a TTreeView. I have the Timer1.Interval set to 250. Declare a<br \/>\nprivate variable sDirection : String.<\/p>\n<p>Good luck,<br \/>\nWayne<\/p>\n<p>[code lang=&#8221;delphi&#8221;]procedure TfrmExportData.lbFieldsExportingDragOver(Sender, Source:<br \/>\nTObject;<br \/>\nX, Y: Integer; State: TDragState; var Accept: Boolean);<br \/>\nbegin<br \/>\nAccept := Sender = Source;<br \/>\nif (Accept) and (iStartItem = 0) then begin<br \/>\niStartItem := lbFieldsExporting.ItemIndex;<br \/>\nend;<\/p>\n<p>\/\/ handle the scrolling of the listbox<br \/>\nif Y < 0 then begin\n\/\/ need to scroll the listbox up\nsDirection := 'UP';\ntimer1.enabled := true;\nend else begin\nif y > lbFieldsExporting.height &#8211; 5 then begin<br \/>\n\/\/ need to scroll the listbox down<br \/>\nsDirection := &#8216;DOWN&#8217;;<br \/>\ntimer1.enabled := true;<br \/>\nend else begin<br \/>\n\/\/ need to stop scrolling of the listbox<br \/>\ntimer1.enabled := false;<br \/>\nend; \/\/ if y > lbFieldsExporting.height &#8211; 5 then begin<br \/>\nend; \/\/ if Y < 0 then begin\nend;\n\nprocedure TfrmExportData.Timer1Timer(Sender: TObject);\nbegin\nif sDirection = 'UP'\nthen PostMessage( lbFieldsExporting.handle, wm_vscroll,\nsb_lineup,0)\nelse PostMessage( lbFieldsExporting.handle, wm_vscroll,\nsb_linedown,0);\nend;\n[\/code]\n\n[tags]Delphi, Components, TreeView[\/tags]\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following code works in a TListBox. I assume that it will also work in a TTreeView. I have the Timer1.Interval set to&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[90,75,95],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-1A","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/98"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=98"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/98\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}