Arsip: ContextMenu hanya muncul pada node tertentu di TreeView
more 19 years ago
eena
Mau tanya neh....
Saya mencoba untuk membuat ContextMenu muncul saat node dari TreeView diklik_kanan.
Kira-kira codenya seperti apa dan dimasukkan k dalam event apa????
Makasih atas bantuannya.
more 19 years ago
eena
Saya pake WinForm for Delphi 2006 .NET.
Dan saya coba pake code:
if e.Button = System.Windows.Forms.MouseButtons.Right then
treeview1.SelectedNode := treeview1.GetNodeAt(e.X,e.Y);
di event TreeView1_MouseUp. Tapi ContextMenu masih muncul di semua bagian TreeView klo di klik_kanan.
Kira2 ditambah code apalagi ya biar contextmenu hanya muncul jika node dari treeview di klik kanan???
Mohon bantuannya...
more 19 years ago
kifmesoft
Untuk memunculkan ContextMenu bisa menggunakan event OnContextPopup,
pastikan property AutoPopup pada PopupMenu yang digunakan bernilai True,
untuk deteksi click Node, gunakan method
GetNodeAt dan GetHitTestInfoAt
contoh untuk memuncul PopupMenu saat Node di click kanan.. ;)
procedure TForm1.TreeView1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
Handled:= Not ((TTreeView(Sender).GetNodeAt(MousePos.X, MousePos.Y) <> Nil) And
(htOnItem In TTreeView(Sender).GetHitTestInfoAt(MousePos.X, MousePos.Y)));
end;
more 19 years ago
kifmesoft
oouuw... iya (Win32)
hmm... tinggal ubah2 dikit aja (disesuaikan) mungkin di event MouseDown
terus.. untuk nampilinnya bisa pake PopMenu1.Popup (itu pun kalo ada)
sory nih blm sempat ngecek yg .NET :(
more ...
- Pages:
- 1
reply |
Report Obsolete
AI Forward
🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now:
https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 5 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 5 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 5 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 5 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 5 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 5 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 6 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 13 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 13 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 13 years ago
Random Topic
- Baca File CSV(Comma Seperated Value) melalui delphi
by kacungdelphi24 in Tip n Trik Pemrograman more 17 years ago - info buku delphi
by wong_error in OOT more 18 years ago - TEdit yang auto complete
by areksby in MsSQL more 19 years ago - penambahan waktu ?
by jajang in Tip n Trik Pemrograman more 17 years ago - Tanya: Design Time & Runtime Package
by mambamaestro in Tip n Trik Pemrograman more 14 years ago - Tutorial Live belajar delphi.....
by EkoIndri in Tutorial & Community Project more 19 years ago - Delphi-id masuk koran
by ip4nk in Hal umum tentang Pascal Indonesia more 19 years ago - Tanya tentang cara mengganti nilai create object runtime
by busan in Tip n Trik Pemrograman more 16 years ago - tulung..tulung
by alvonz in MsSQL more 16 years ago - resize image
by sulth4n in Multimedia & Graphic Enhancement more 19 years ago