Arsip: Pengen Tau Komponen yang di fokus?

more 18 years ago
ivan
Om.. Om..
Tolong bantu, gimana yach pengen tau nama komponen yg sedang di fokus?
Misal komponen sedang di fokus di Button1 atau di Edit1 atau di memo1.
Matur Tengkyu

more 18 years ago
zuyo
mungkin paling sederhana ya menggunakan event OnEnter :)
yang rumit ya memproses Messages

more 18 years ago
ivan
Kalo dengan proses message bagaimana? soalnya akan digunakan untuk pemanggilan procedure yang lain.
Thx..

more 18 years ago
simba
Gak perlu rumit2 pake message segala. Hampir seluruh kontrol punya property Focused (boolean). Tinggal iterasi aja seluruh control dalam form dan baca property tsb, akan ketahuan yg mana yg sedang fokus. HTH. ;)

more 18 years ago
DelphiExpert
wakakak... ngga' perlu iterasi segala :mrgreen:
1. akses aja property ActiveControl milik TForm, atau
2. gunakan WinAPI GetFocus: HWND - GetFocus retrieves the handle of the window that has the keyboard focus, if the window is associated with the calling thread's message queue, atau
3. gunakan WinAPI GetActiveWindow: HWND - GetActiveWindow retrieves the window handle to the active window associated with the thread that calls the function
silahkan pilih salah satu... atau kombinasi ketiganya :mrgreen:
jika menggunakan WinAPI, utk mendapatkan nama komponen tersebut cukup gunakan fungsi berikut:
var AW: HWND;
begin
AW:= GetActiveWindow; // GetFocus
if AW <> 0 then AName:= FindControl(AW).Name;
end;

more 18 years ago
simba
Iya... lupa kalo ada property ActiveControl di TForm. Hehehehe... thanks, DE! Pake itu aja udah lebih cukup. :D
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 4 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 5 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
- Parsing Vonem..
by indray2j in Multimedia & Graphic Enhancement more 18 years ago - gimana cara nganti string dlm DB
by putukaca in MySQL more 18 years ago - Ada yang pernah bikin Program MD5...???
by safarian in Tip n Trik Pemrograman more 18 years ago - *.dcu
by nurez in Tip n Trik Pemrograman more 18 years ago - TProgress nggak muncul
by delphicode in Tutorial & Community Project more 16 years ago - Timer ?
by umarbakri in Hal umum tentang Pascal Indonesia more 18 years ago - help me buat rsa .........
by CurutZ in Tip n Trik Pemrograman more 17 years ago - [tips]: membuka file pdf menggunakan activeX control
by light_cc80 in Tip n Trik Pemrograman more 20 years ago - menggunakan multi insert di SQL
by derry.othman in Hal umum tentang Pascal Indonesia more 17 years ago - jumlah
by brodien in Tip n Trik Pemrograman more 19 years ago