holimax Ierakstīts Septembris 24, 2007 Share Ierakstīts Septembris 24, 2007 (labots) Man ir trīs ProgressBar'i. Pagaidām cenšos piedabūt strādāt kaut vienu pareizi ... Tātad, ir paņemts no Helpa tas kods un izdarīts viss pārējais, kas tika prasīts, lai tas strādātu BET Kad es palaižu programmu, man palaizās gan Auto-Create forma ( Form1, uz kuras tad es arī visu novietoju ), gan Available forma, uz kuras ir novietoti ProgressBar'i. ProgressBar''s strādā tikai uz tās formas, uz kuras, pēc Helpā rakstītā, bija viņi jāuzliek ( tātad, uz Form5 ). Es gribu, lai man palaizās tikai viena forma ( tjipa Form1 ) un lai uz tāš strādātu tie ProgressBar'i. Labots Septembris 24, 2007 - holimax Link to comment Share on other sites More sharing options...
VIL Septembris 24, 2007 Share Septembris 24, 2007 Ja ir atvērta tikai viena forma Form1 un ir vēlme redzēt 3 progressbārus uz šīs formas, tad visi 3 progressbāri ir "jāuzliek" uz Form1. Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 Ja ir atvērta tikai viena forma Form1 un ir vēlme redzēt 3 progressbārus uz šīs formas, tad visi 3 progressbāri ir "jāuzliek" uz Form1. Tas jau ir izdarīts, bet neiet. Link to comment Share on other sites More sharing options...
VIL Septembris 24, 2007 Share Septembris 24, 2007 postē sourci Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 Source: program basicclock; uses Forms, test in 'test.pas' {Form1}, test2 in 'test2.pas' {Form2}, test3 in 'test3.pas' {Form3}, test4 in 'test4.pas' {Form4}, test5 in 'test5.pas' {Form5}; {$R *.res} begin Application.Initialize; with TForm1.Create(nil) do try hourprogbar.Max := 100; Show; // show a splash screen contain ProgressBar control Update; // force display of Form5 Application.CreateForm(Tform1, Form1); hourprogbar.StepBy(25); Application.CreateForm(TForm2, Form2); hourprogbar.StepBy(25); Application.CreateForm(TForm3, Form3); hourprogbar.StepBy(25); Application.CreateForm(TForm4, Form4); hourprogbar.StepBy(25); Application.CreateForm(TForm5, Form5); hourprogbar.StepBy(25); Application.Run; finally Free; end; with TForm1.Create(nil) do try minprogbar.Max := 100; Show; // show a splash screen contain ProgressBar control Update; // force display of Form5 Application.CreateForm(TForm1, Form1); minprogbar.StepBy(25); Application.CreateForm(TForm2, Form2); minprogbar.StepBy(25); Application.CreateForm(TForm3, Form3); minprogbar.StepBy(25); Application.CreateForm(TForm4, Form4); minprogbar.StepBy(25); Application.CreateForm(TForm5, Form5); minprogbar.StepBy(25); Application.Run; finally Free; end; with TForm1.Create(nil) do try secprogbar.Max := 100; Show; // show a splash screen contain ProgressBar control Update; // force display of Form5 Application.CreateForm(TForm1, Form1); secprogbar.StepBy(25); Application.CreateForm(TForm2, Form2); secprogbar.StepBy(25); Application.CreateForm(TForm3, Form3); secprogbar.StepBy(25); Application.CreateForm(TForm4, Form4); secprogbar.StepBy(25) ; Application.CreateForm(TForm5, Form5); secprogbar.StepBy(25); Application.Run; finally Free; end; end. Link to comment Share on other sites More sharing options...
VIL Septembris 24, 2007 Share Septembris 24, 2007 Ieliec arī formas sourci. Form/Show as text Link to comment Share on other sites More sharing options...
Artanis Septembris 24, 2007 Share Septembris 24, 2007 Sourc'i lūdzu postēt iekš [code] [/code] tagiem! Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 (labots) Sourc'i lūdzu postēt iekš tagiem! ok. Formas Source:[ object Form1: TForm1 Left = 211 Top = 251 Width = 870 Height = 640 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object s11: TShape Left = 768 Top = 72 Width = 17 Height = 73 end object s12: TShape Left = 768 Top = 160 Width = 17 Height = 73 end object s13: TShape Left = 704 Top = 240 Width = 57 Height = 17 end object s14: TShape Left = 680 Top = 160 Width = 17 Height = 73 end object s15: TShape Left = 680 Top = 72 Width = 17 Height = 73 end object s16: TShape Left = 704 Top = 48 Width = 57 Height = 17 end object s17: TShape Left = 704 Top = 144 Width = 57 Height = 17 end object s21: TShape Left = 648 Top = 72 Width = 17 Height = 73 end object s22: TShape Left = 648 Top = 160 Width = 17 Height = 73 end object s23: TShape Left = 584 Top = 240 Width = 57 Height = 17 end object s24: TShape Left = 560 Top = 160 Width = 17 Height = 73 end object s25: TShape Left = 560 Top = 72 Width = 17 Height = 73 end object s26: TShape Left = 584 Top = 48 Width = 57 Height = 17 end object s27: TShape Left = 584 Top = 144 Width = 57 Height = 17 end object s31: TShape Left = 504 Top = 72 Width = 17 Height = 73 end object s32: TShape Left = 504 Top = 160 Width = 17 Height = 73 end object s33: TShape Left = 440 Top = 240 Width = 57 Height = 17 end object s34: TShape Left = 416 Top = 160 Width = 17 Height = 73 end object s35: TShape Left = 416 Top = 72 Width = 17 Height = 73 end object s36: TShape Left = 440 Top = 48 Width = 57 Height = 17 end object s37: TShape Left = 440 Top = 144 Width = 57 Height = 17 end object s41: TShape Left = 384 Top = 72 Width = 17 Height = 73 end object s42: TShape Left = 384 Top = 160 Width = 17 Height = 73 end object s43: TShape Left = 320 Top = 240 Width = 57 Height = 17 end object s44: TShape Left = 296 Top = 160 Width = 17 Height = 73 end object s45: TShape Left = 296 Top = 72 Width = 17 Height = 73 end object s46: TShape Left = 320 Top = 48 Width = 57 Height = 17 end object s47: TShape Left = 320 Top = 144 Width = 57 Height = 17 end object s51: TShape Left = 240 Top = 72 Width = 17 Height = 73 end object s52: TShape Left = 240 Top = 160 Width = 17 Height = 73 end object s53: TShape Left = 176 Top = 240 Width = 57 Height = 17 end object s54: TShape Left = 152 Top = 160 Width = 17 Height = 73 end object s55: TShape Left = 152 Top = 72 Width = 17 Height = 73 end object s56: TShape Left = 176 Top = 48 Width = 57 Height = 17 end object s57: TShape Left = 176 Top = 144 Width = 57 Height = 17 end object s61: TShape Left = 120 Top = 72 Width = 17 Height = 73 end object s62: TShape Left = 120 Top = 160 Width = 17 Height = 73 end object s63: TShape Left = 56 Top = 240 Width = 57 Height = 17 end object s64: TShape Left = 32 Top = 160 Width = 17 Height = 73 end object s65: TShape Left = 32 Top = 72 Width = 17 Height = 73 end object s66: TShape Left = 56 Top = 48 Width = 57 Height = 17 end object s67: TShape Left = 56 Top = 144 Width = 57 Height = 17 end object LicenceInfo: TLabel Left = 16 Top = 552 Width = 301 Height = 13 Caption = 'Copyright 2007 by Linards Liepins, a.k.a HX. All rights reserved' + '. ' Color = clSilver Font.Charset = DEFAULT_CHARSET Font.Color = clRed Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentColor = False ParentFont = False end object advcontrolframe: TShape Left = 24 Top = 272 Width = 281 Height = 257 Brush.Style = bsClear end object Shape1: TShape Left = 320 Top = 336 Width = 521 Height = 193 Brush.Style = bsClear end object BlinkIntervalSelect: TLabel Left = 592 Top = 288 Width = 80 Height = 13 Caption = 'Set Blink Interval' end object ModuelCount: TLabel Left = 16 Top = 16 Width = 86 Height = 13 Caption = 'Module sets used:' end object Shape2: TShape Left = 320 Top = 272 Width = 521 Height = 49 Brush.Style = bsClear end object Button1: TButton Left = 40 Top = 312 Width = 75 Height = 25 Caption = 'Sart' TabOrder = 0 OnClick = Button1Click end object Button2: TButton Left = 128 Top = 312 Width = 75 Height = 25 Caption = 'Stop' TabOrder = 1 OnClick = Button2Click end object Button3: TButton Left = 768 Top = 552 Width = 75 Height = 25 Caption = 'About...' TabOrder = 2 OnClick = Button3Click end object actioncontrol: TCheckBox Left = 48 Top = 288 Width = 97 Height = 17 Caption = 'Enable Controls' TabOrder = 3 end object eventloglist: TListBox Left = 528 Top = 352 Width = 297 Height = 161 ItemHeight = 13 TabOrder = 4 end object Button4: TButton Left = 40 Top = 384 Width = 75 Height = 25 Caption = 'Log status' TabOrder = 5 end object logcontrol: TCheckBox Left = 48 Top = 360 Width = 97 Height = 17 Caption = 'Enable Logging' TabOrder = 6 OnClick = logcontrolClick end object Button5: TButton Left = 128 Top = 384 Width = 75 Height = 25 Caption = 'Delete Log' TabOrder = 7 OnClick = Button5Click end object StatusBar1: TStatusBar Left = 328 Top = 552 Width = 433 Height = 25 Align = alNone Panels = <> SimplePanel = False end object hourprogbar: TProgressBar Left = 264 Top = 72 Width = 25 Height = 161 Min = 0 Max = 100 TabOrder = 9 end object minprogbar: TProgressBar Left = 528 Top = 72 Width = 25 Height = 161 Min = 0 Max = 100 TabOrder = 10 end object Button6: TButton Left = 432 Top = 392 Width = 89 Height = 25 Caption = 'Set Text Color...' TabOrder = 11 end object timingcontrol: TCheckBox Left = 48 Top = 432 Width = 97 Height = 17 Caption = 'Enable Timing' TabOrder = 12 OnClick = timingcontrolClick end object colorcontrol: TCheckBox Left = 432 Top = 368 Width = 89 Height = 17 Caption = 'Enable Colors' TabOrder = 13 end object ComboBox1: TComboBox Left = 688 Top = 288 Width = 145 Height = 21 ItemHeight = 13 TabOrder = 14 Text = '...' OnChange = ComboBox1Change Items.Strings = ( 'Interval: 5000' 'Interval: 4000' 'Interval: 3000' 'Interval: 2000' 'Interval: 1000' 'Interval: 900' 'Interval: 800' 'Interval: 700' 'Interval: 600' 'Interval: 500' 'Interval: 400' 'Interval: 300' 'Interval: 150') end object secprogbar: TProgressBar Left = 792 Top = 72 Width = 25 Height = 161 Min = 0 Max = 100 TabOrder = 15 end object Button7: TButton Left = 432 Top = 424 Width = 89 Height = 25 Caption = 'Set BG Color.....' TabOrder = 16 end object Timer1: TTimer Interval = 500 OnTimer = Timer1Timer Left = 144 Top = 8 end object Timer2: TTimer OnTimer = ComboBox1Change Left = 112 Top = 8 end end Pie šā pašā vēl viens jautājums - kā lai piesaista ComboBox'a ievietotās vērtiibas pie Pulksteņa ( Timer) Intervāla propertija? Labots Septembris 24, 2007 - housemouse Link to comment Share on other sites More sharing options...
Padre(FMF) Septembris 24, 2007 Share Septembris 24, 2007 (labots) Attiecibaa uz papildjautaajumu... form1.combobox1CloseUp(Sender:tobject) begin timer1.interval = strtoint(combobox1.text); end; Labots Septembris 24, 2007 - Padre(FMF) Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 (labots) procedūra strādā, bet palaižot projektu un izvēloties kādu no intervāliem, taimeris nemainās ... Liekas, ka vinš to vērtiibu nesaglabā un arii nepiemēŗo programmas izpildes laikā norādītajam Timer1 ... Hm, domu es saprotu, kā tam ir jāizskatās, bet es vēl nezinu sintaksi ( kā nekā tikko Delfus skolā sākām ) ... Uzrakstīju šādu if'u: form1.ComboBox1.Text='5000' then timer1.Interval:=5000; rezultāts - nekas nemainās.... Labots Septembris 24, 2007 - holimax Link to comment Share on other sites More sharing options...
Guest Velis Septembris 24, 2007 Share Septembris 24, 2007 Parasti.. kad kaut kas neiet kā vajag dara divas lietas 1) izpildo kodu pa komandai 2) seko mainīgo izmaiņām.. Neatceros kā šīs padarīšanas saucās Delphi.. bet 100% zinu ka tur tādas iespējas ir. Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 (labots) Vai tik tas nav Kuums ... Jā, es zinu, ka ir Trace / Step over, bet es sev negribu jaukt galvu - es tagad pašmācības ceļā cīnos ar ProgressBar'iem un Pulksteņa izmantošānu aplikācija... P.S. Tev paraksts ir nepilnīgs - pareizi ir: Lai māmiņai un tētiņam un tēvijai ir prieks! Labots Septembris 24, 2007 - holimax Link to comment Share on other sites More sharing options...
Guest Velis Septembris 24, 2007 Share Septembris 24, 2007 Kāda galvas jaukšana.. tu pa soļiem izpildi pergu un skaties, kas notiek. Gribi saprast kāpēc ir tā un ne šitā.. vienīgais variants ir treisot. Link to comment Share on other sites More sharing options...
Padre(FMF) Septembris 24, 2007 Share Septembris 24, 2007 rezultāts - nekas nemainās.... uzraksti šitā: if combobox1.text = '5000' then begin timer1.interval := 5000; timer1.enabled := true; showmessage('Es esmu kruts koderis!'); end; Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 (labots) Kāda galvas jaukšana.. tu pa soļiem izpildi pergu un skaties, kas notiek. Gribi saprast kāpēc ir tā un ne šitā.. vienīgais variants ir treisot. Vecīt, šito treisot - tur var aizmigt ... Nu ok, kamēr Debuggers nemet kļūdu, uzskatīsim, ka viss ir jauki un skaisti Hm, Padre, pamēģināsim ... Nekā! - vienalga Timer1 ir tas pats 1000 milisekunzu intervāls ... Labots Septembris 24, 2007 - holimax Link to comment Share on other sites More sharing options...
Guest Velis Septembris 24, 2007 Share Septembris 24, 2007 Pamaini ciparus lai rezultāts iestājas ātrāk. Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 (labots) maita atsakās reagēt ... varbūt ir kāda f-ja vai operators, kas pilda idejiski to pašu, ko' Update' ? Labots Septembris 24, 2007 - holimax Link to comment Share on other sites More sharing options...
Guest Velis Septembris 24, 2007 Share Septembris 24, 2007 Tātad šķībi nosacījumi kuri nosaka vai notikums izpildās vai nē. Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 (labots) hm, kas tur var būt šķībs?! :twisted: : var Form1: TForm1; laiks:string[8]; implementation {$R *.dfm} procedure TForm1.Timer1Timer(Sender: TObject); begin form1.Caption:=formatdatetime('hh:mm:ss',now); laiks:=formatdatetime('hh:mm:ss',now); end; procedure TForm1.combobox1CloseUp(Sender:tobject); begin timer1.interval := strtoint(combobox1.text); if form1.ComboBox1.Text='150' then begin timer1.Interval:=150; timer1.enabled := true; end; if form1.ComboBox1.Text='5000' then begin timer1.Interval:=500; timer1.enabled := true; end end; Form1.ComboBox1.Items Interval: 5000 Interval: 4000 Interval: 3000 Interval: 2000 Interval: 1000 Interval: 900 Interval: 800 Interval: 700 Interval: 600 Interval: 500 Interval: 400 Interval: 300 Interval: 150 Labots Septembris 24, 2007 - holimax Link to comment Share on other sites More sharing options...
gathis Septembris 24, 2007 Share Septembris 24, 2007 pamēģini comboboksim nevis uz CloseUp bez uz OnChange Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 Vienalga neiet Link to comment Share on other sites More sharing options...
Padre(FMF) Septembris 24, 2007 Share Septembris 24, 2007 A tev tas messagebox parādijās??? Vai tās procedūras ir piesaistitas eventiem?? Link to comment Share on other sites More sharing options...
VIL Septembris 24, 2007 Share Septembris 24, 2007 Man uz mājas kārbas Turbo Delphi nav uzlicies, tādēļ paeksperimentēju iekš 64 bitu Lazarus. Nostrādāja piemērs: uz formas uzliekam 1) Timer1:TTimer 2) combobox1:TCombobox ar trim vērtībām 1000; 5000; 10000 3) Progressbar1:TProgressbar Uzakstu tikai divus notikumu rokturīšu apstrādātājus: procedure TForm1.ComboBox1Change(Sender: TObject); begin Timer1.Enabled:=FALSE; Timer1.Interval:=StrToInt(ComboBox1.Text); Timer1.Enabled:=TRUE; end; procedure TForm1.Timer1Timer(Sender: TObject); begin ProgressBar1.Position:=ProgressBar1.Position+1; end; Link to comment Share on other sites More sharing options...
gathis Septembris 24, 2007 Share Septembris 24, 2007 nuu, ja tev comboboksī ir`šādi itemi: Interval: 5000 ... tad jau loģiski, ka nosacījums: if form1.ComboBox1.Text='150' then neizpildās, jo comboboksa teksts arī ir = Interval: 5000 ??? Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 (labots) Paldies par supportu, vēlāk pačekošu, tagad jāgraiza ņammīgie ābolīši Nu tā, tagad itkā viņi stradā, bet problēma vienalga paliek - tiek nevajadzīgi uztaisīta vēl viena forma. Tad vēl viena lieta - procedure TForm1.timingcontrolClick(Sender: TObject); begin if form1.timingcontrol.Checked then begin form1.hourprogbar.Visible:=True; form1.minprogbar.Visible:=True; form1.secprogbar.Visible:=True; end else form1.hourprogbar.Visible:=False; form1.minprogbar.Visible:=False; form1.secprogbar.Visible:=False; end; ar šo gribu panākt, ka ar checkbox'u tiek paslēpti / parādīti iepriekšminētie ProgressBar'i, bet ( defaultā Enabled:=False ) kad pie palaistas programmas ieķeksēju viņu, man tiek paslēpti ProgressBar2 ( minprogbar ) un ProgresBar3 ( secprogbar ). Kad atķeksēju, paslēpts tiek ProgressBar1 ( houprogbar ), bet kad atkal ieķeksēju CheckBox1, tiek parādīts tikai PtogressBar1 ( hourprogbar ). Kapēc? Kods tak ir pareizs ... Labots Septembris 24, 2007 - holimax Link to comment Share on other sites More sharing options...
VIL Septembris 24, 2007 Share Septembris 24, 2007 Formas Tu pats taisi. Ja kau kas ir par daudz, meklē vainu sevī. OFFT: Tu iepostēji TForm1 metodi. Kādēļ tajā Tu atsaucies uz form1 - konkrētu objektu? Ja klikšķinot parādās un zūd tikai 1 objekts, tad Tava iepostētā metode nebūs tā, kas to rāda. Iesaku ar [F7] iet cauri tekstam un skatīties, kas izpildās. Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 Es zinu, bet kā lai iekš exe Sources norāda, lai netiktu izveidota jauna forma, bet gan lietota jau esosā? Ja es rakstu vienkārši: with TForm1(nil) do tiek mesta klūda. Savād es nezinu, kā neizveidot lieko formu ... Vai varbūt tā lai paliek? Link to comment Share on other sites More sharing options...
VIL Septembris 24, 2007 Share Septembris 24, 2007 projekta opcijās vienīgajai formai norādi autocreated + konstruktorā neveido form1 instances. Pašam formas ir jāveido, ja to ir daudz, ja vienlaikus nepieciešams neliels skaits, ja vienai klasei jāveido vairākas instances. ============== Vienkāršākais paņēmiens: izveido jaunu GUI projektu, saglabā un neko opcijās nemaini. Būs OK. Būs viena forma vienā eksemplārā. P.S. if form1.timingcontrol.Checked then Link to comment Share on other sites More sharing options...
holimax Septembris 24, 2007 Author Share Septembris 24, 2007 Ok, opcijāš noradīju viņu kā vienīgo formu, bet par to konstruktoru nesapratu - ja es lieku ieksā kā Auto-Create jebkādu formu, Delphi automātiski ieraksta exe sourcē Application.CreateForm(TForm_, Form_) Varbūt kaut kā savādāk? Link to comment Share on other sites More sharing options...
VIL Septembris 24, 2007 Share Septembris 24, 2007 Nē, tā arī vajag. Pats TForm1 instances uz savu galvu netaisi. Link to comment Share on other sites More sharing options...
4e4en Septembris 25, 2007 Share Septembris 25, 2007 pēc katras pieskaitīšanas iemet Application.ProcessMessages; Link to comment Share on other sites More sharing options...
Recommended Posts
Izveido kontu, vai pieraksties esošajā, lai komentētu
Jums ir jābūt šī foruma biedram, lai varētu komentēt tēmas
Izveidot jaunu kontu
Piereģistrējies un izveido jaunu kontu, tas būs viegli!
Reģistrēt jaunu kontuPierakstīties
Jums jau ir konts? Pierakstieties tajā šeit!
Pierakstīties tagad!