Arsip: nama komponen dijadiin nama komponen yg laen??

more 19 years ago
imunk
bikin bgg gak mas subjeknya...??? :)
gini mas maksudnya,
misal ada komponen TEdit namanya E_nama terus ada komponen Radio Button namanya RB_nama.
pada kejadian tertentu, misal ada kondisi:
if E_nama.text<>'' then
RB_nama.checked:=true;
kalo hanya satu komponen sih gak masalah mas, tapi ini banyak komponennya kalo satu2 emang bisa sih tapi kalo ada yg lebih simple kan apa salahnya dipake....:)
(lah maunya gimana neh....)
coding diatas terlihat ada kata yg sama (nama) nah kira2 yg sama, nah krn sama kan cukup ditulis satu saja gitu....
misal pada event onChange komponen TEdit:
if (sender as TEdit).text<>'' then
RB_((sender as TEdit).nama).checked:=true;
aku lom coba seh kode di atas, mohon bantuannya deh....
makasih sebelumnya.....:)
maju terus.
more 19 years ago
mat_koder
sebagai "hint" ini saya kutipin dari salah satu help yg disediakan Oom Borland buat property-ComponentCount-nya si TForm:
(mudah-mudahan dapat anda modifikasi sesuai dengan kebutuhan anda , misalkan anda bisa bikin : if Temp is TEdit then TEdit(Temp).Visible:=TRUE)
This code fragment moves any nonvisual components on the form into a separate data module. Note that the components are removed starting with the last component, so that the unprocessed portion of the Components array does not change.
Note: This code does not save the form or data module to disk after the nonvisual components are moved. If executed at runtime, the effect will not persist.
var
I: Integer;
Temp: TComponent;
begin
for I := ComponentCount - 1 downto 0 do
begin
Temp := Components[I];
if not (Temp is TControl) then
begin
RemoveComponent(Temp);
DataModule2.InsertComponent(Temp);
end;
end;
end;

more 19 years ago
prakasiwi
procedure TForm1.edNamaKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
var namaedit:string;
namacb:string;
I : integer;
temp : tcomponent;
begin
//misal
// tedit ==> ednama, edalamat
// tcheckbox ==> cbnama, cbalamat
namaedit := (Sender as TEdit).Name;
namaedit := copy(namaedit,3,length(namaedit));
for i := ComponentCount - 1 downto 0 do
begin
temp := Components[i];
if temp is Tcheckbox then
begin
namacb := (temp as Tcheckbox).Name;
namacb := copy(namacb,3,length(namacb));
if uppercase(namacb) = uppercase(namaedit) then
begin
if trim((sender as tedit).Text) <>'' then
begin
(temp as Tcheckbox).Checked := true;
end
else
begin
(temp as Tcheckbox).Checked := false;
end;
end;
end;
end;
end;

more 19 years ago
prakasiwi
procedure TForm1.edNamaKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
var namaedit:string;
namacb:string;
I : integer;
temp : tcomponent;
begin
//misal
// tedit ==> ednama, edalamat
// tcheckbox ==> cbnama, cbalamat
namaedit := (Sender as TEdit).Name;
namaedit := copy(namaedit,3,length(namaedit));
for i := ComponentCount - 1 downto 0 do
begin
temp := Components[i];
if temp is Tcheckbox then
begin
namacb := (temp as Tcheckbox).Name;
namacb := copy(namacb,3,length(namacb));
if uppercase(namacb) = uppercase(namaedit) then
begin
if trim((sender as tedit).Text) <>'' then
begin
(temp as Tcheckbox).Checked := true;
end
else
begin
(temp as Tcheckbox).Checked := false;
end;
end;
end;
end;
end;
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
- Rubah CURSOR di MaskEdit ... HELP ...
by dell-phi in Form Enhancement & Graphical Controls more 14 years ago - membuat new form/window dari komponen menu.......
by pits_its in Form Enhancement & Graphical Controls more 18 years ago - input dari dbgrid gengan stored procedure
by zones in MsSQL more 17 years ago - Tipe Data MySQL
by J4ckR1pp3r in MySQL more 19 years ago - Active MDI Form Error?
by kayla in Tutorial & Community Project more 16 years ago - gimana bikin format 001 di fast report 3.xx
by oloan_ac in Reporting more 17 years ago - memanggil image dari URL
by Shaf in Hal umum tentang Pascal Indonesia more 17 years ago - Create DLL Database Application
by rtl_gitulho in Lain-lain more 18 years ago - Dynamic load packages in Delphi
by DelphiExpert in OOT more 16 years ago - Jaket status (onDelivery Process)
by yayaretina in Tutorial & Community Project more 16 years ago