Arsip: nama komponen dijadiin nama komponen yg laen??

 
user image
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.
user image
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;
user image
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;
user image
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
Share to

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

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com