[ Delphi / Pascal ] — начинающим: задаем вопросы

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by begin_end, 28 Apr 2015.

  1. triblekill

    triblekill Member

    Joined:
    21 Aug 2011
    Messages:
    329
    Likes Received:
    64
    Reputations:
    0
    Да я понимаю к чему ты клонишь но символы должны быть разные для каждого edit ! Несколько функций объявлять тоже не хочется
     
  2. #colorblind

    #colorblind Elder - Старейшина

    Joined:
    31 Jan 2014
    Messages:
    598
    Likes Received:
    220
    Reputations:
    36
    Нет, не понимаешь.
    PHP:
    CheckSym('Символы для первого Edit'Edit1.Text);
    ...
    CheckSym('Символы для второго Edit'Edit2.Text);
    ...
    CheckSym('Символы для третьего Edit'Edit3.Text);
     
  3. triblekill

    triblekill Member

    Joined:
    21 Aug 2011
    Messages:
    329
    Likes Received:
    64
    Reputations:
    0
    Нет. Символами которым будет заменяться запрещённая строка !
     
    #43 triblekill, 22 Jun 2015
    Last edited: 26 Jun 2015
  4. vasykas

    vasykas Banned

    Joined:
    7 Mar 2011
    Messages:
    963
    Likes Received:
    136
    Reputations:
    37
    Подскажите где ошибка?
    при выборе камеры в ComboBox , выдает ошибку...
    код:
    Code:
    var
      Form1: TForm1;
       VideoDevice: TSysDevEnum;
       AudioDevice: TSysDevEnum ;
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.FormCreate(Sender: TObject);
    var
    i,j: integer;
    begin
       VideoDevice:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
       AudioDevice:= TSysDevEnum.Create(CLSID_CWaveinClassManager);
    
    if VideoDevice.CountFilters > 0 then
    for i := 0 to VideoDevice.CountFilters - 1 do
    
       ComboBox1.Items.Add(VideoDevice.Filters[i].FriendlyName);
    
    if AudioDevice.CountFilters > 0 then
    for j := 0 to AudioDevice.CountFilters - 1 do
    
       ComboBox2.Items.Add(AudioDevice.Filters[j].FriendlyName);
    
    end;
    {-----------------------------------------}
    procedure TForm1.ComboBox1Change(Sender: TObject);
    begin
    FilterGraph.ClearGraph;
    FilterGraph.Active := false;
    
    Filter1.BaseFilter.Moniker := VideoDevice.GetMoniker(ComboBox1.ItemIndex);
    FilterGraph.Active := true;
    
    with FilterGraph as ICaptureGraphBuilder2 do
    RenderStream(@PIN_CATEGORY_PREVIEW, nil, Filter1 as IBaseFilter, SampleGrabber1 as IBaseFilter, VideoWindow1 as IbaseFilter);
    FilterGraph.Play;
    ButtonStopPlay.Enabled:=True;
    end;
    вроде все правильно сделал или сам компонент DSPack не поддерживает мою камеру?
     
  5. #colorblind

    #colorblind Elder - Старейшина

    Joined:
    31 Jan 2014
    Messages:
    598
    Likes Received:
    220
    Reputations:
    36
    Ты привел кодес заполнения комбобоксов, но не выбора камеры. Покажи какой у тебя там ивент (OnChange, OnClick) или может по нажатию на кнопке.
     
  6. vasykas

    vasykas Banned

    Joined:
    7 Mar 2011
    Messages:
    963
    Likes Received:
    136
    Reputations:
    37
    Code:
    procedure TForm1.ComboBox1Change(Sender: TObject);
    begin
    FilterGraph.ClearGraph;
    FilterGraph.Active := false;
    
    Filter1.BaseFilter.Moniker := VideoDevice.GetMoniker(ComboBox1.ItemIndex);
    FilterGraph.Active := true;
    
    with FilterGraph as ICaptureGraphBuilder2 do
    RenderStream(@PIN_CATEGORY_PREVIEW, nil, Filter1 as IBaseFilter, SampleGrabber1 as IBaseFilter, VideoWindow1 as IbaseFilter);
    FilterGraph.Play;
    
    end;
     
  7. #colorblind

    #colorblind Elder - Старейшина

    Joined:
    31 Jan 2014
    Messages:
    598
    Likes Received:
    220
    Reputations:
    36
    Попробуй так:
    PHP:
    RenderStream(@PIN_CATEGORY_PREVIEW, @MEDIATYPE_VideoFilter1 as IBaseFilterSampleGrabber1 as IBaseFilterVideoWindow1 as IbaseFilter);
    У тебя точно в FilterGraph.RenderStream косяк, нужно только правильные аргументы передать.
     
  8. vasykas

    vasykas Banned

    Joined:
    7 Mar 2011
    Messages:
    963
    Likes Received:
    136
    Reputations:
    37
    тоже самое
     
  9. #colorblind

    #colorblind Elder - Старейшина

    Joined:
    31 Jan 2014
    Messages:
    598
    Likes Received:
    220
    Reputations:
    36
    Блин, ну тогда надо открывать делфи, а под рукой ее нету. Завтра если не забуду, постараюсь посмотреть)
     
  10. GoldenEagle

    GoldenEagle New Member

    Joined:
    4 Aug 2015
    Messages:
    8
    Likes Received:
    0
    Reputations:
    0
    Есть ответ от сервера :
    Code:
    {"response":{"count":309753,"users":[54804637,54805008,54805511,54805815,54806767,54807263,54808526,54808533,54808977,54810573,54810700,54811016,54812425,54814097,54815571,54817936,54818098,54818158,54818339,54818511,54818647,54818847,54820497,54821205,54821760,54823286,54823320,54823934,54824534,54824699,54824850,54824908,54826360,54827923,54828499,54828517,54829029,54830239,54830923,54831086,54831168,54831471,54833767,54833798,54834171,54834411,54835048,54836973,54837319,54838200,54838249,54838913,54839120,54839790,54840977,54842216,54842395,54842850,54842930,54844366,54845002,54845446,54845599,54846142,54846495,54847253,54849596,54849781,54849790,54851232,54851785,54852986,54853302,54853476,54854079,54854204,54855475,54855813,54856544,54857297,54858688,54858893,54858911,54859164,54859562,54861073,54861280,54861719,54862341,54862664,54863427,54863462,54863775,54864188,54864879,54864961,54865477,54865555,54866325,54866755,54866973,54867005,54867114,54867354,54867680,54868089,54868628,54869928,54869982,54870552,54870649,54871042,54872141,54873107,54874867,54875311,54875669,54875841,54876013,54876666,54877059,54877639,54879228,54880534,54880700,54880703,54881571,54884938,54885755,54885984,54886177,54887556,54888106,54888778,54889724,54890089,54890176,54890547,54890803,54891184,54893445,54893682,54893732,54893906,54894359,54894709,54895473,54895719,54896814,54899555,54900187,54900260,54901056,54901190,54902006,54902785,54903219,54903658,54904332,54905867,54906037,54906276,54906971,54907216,54908623,54908843,54908932,54909639,54909897,54910735,54911378,54913006,54914191,54914976,54915213,54915973,54916780,54917332,54917845,54917869,54918248,54918254,54919189,54919636,54919789,54920690,54921226,54921283,54921377,54921396,54921400,54921415,54922133,54922206,54922371,54923817,54924587,54926039,54927497,54927610,54927688,54927935,54929322,54930548,54931088,54931098,54931451,54931965,54932937,54933889,54934849,54935544,54936111,54936413,54937482,54937686,54938094,54941683,54941841,54943030,54943101,54944054,54944281,54944685,54945355,54945598,54945689,54945733,54946537,54947335,54947626,54948743,54949175,54949299,54951195,54952111,54952125,54952454,54952802,54952908,54953228,54953271,54953616,54953743,54953786,54954361,54955234,54955276,54955452,54956102,54956302,54956524,54957441,54958093,54958612,54958657,54959539,54960200,54960232,54961395,54961779,54963082,54963372,54963408,54963639,54963815,54964689,54965063,54965379,54965403,54966815,54967488,54967510,54968076,54968081,54968196,54968239,54969422,54969789,54970456,54971834,54971882,54972082,54972669,54972783,54973325,54973834,54974478,54975131,54976041,54976055,54976456,54976562,54976610,54977310,54977744,54978561,54978611,54978918,54979488,54980766,54980791,54981301,54981658,54981893,54984891,54985613,54986143,54986442,54989731,54990461,54991058,54991179,55001604,55003759,55003952,55004130,55004954,55005578,55007288,55009216,55010275,55010395,55010789,55011582,55012651,55015754,55016412,55016452,55016658,55016778,55017048,55017725,55017757,55018293,55019226,55019286,55020746,55021072,55021707,55021713,55021966,55022071,55022271,55023076,55023157,55023990,55024604,55024810,55025343,55025493,55026431,55027754,55028936,55029086,55029143,55029381,55029804,55031253,55032472,55036002,55036617,55036661,55036790,55036960,55037046,55037644,55038017,55038240,55041089,55041486,55041664,55041920,55042106,55043350,55043648,55043829,55046240,55046350,55047127,55047847,55047917,55048495,55048889,55048929,55048979,55050385,55050577,55050955,55052296,55052722,55052772,55053495,55054314,55056073,55056110,55056224,55056322,55056583,55056650,55057193,55057223,55057374,55057780,55057847,55057883,55060413,55061083,55062425,55062511,55063331,55063668,55063856,55064006,55064153,55064299,55066018,55066119,55066381,55066817,55067084,55067613,55067849,55068064,55068555,55069983,55070065,55070409,55070697,55071022,55071710,55072217,55072565,55072711,55073820,55073941,55075030,55075264,55075986,55076140,55077439,55078107,55078533,55078732,55078850,55079428,55079503,55079637,55080999,55081275,55081403,55081418,55082089,55082788,55082891,55084272,55084281,55084597,55084781,55084866,55085052,55085735,55087305,55088549,55089457,55090568,55090779,55091342,55091501,55093514,55093826,55094251,55094455,55097517,55097588,55097876,55098644,55098734,55099568,55099971,55101324,55101332,55101970,55106473,55107376,55109289,55110765,55111921,55112582,55113234,55113365,55113420,55114722,55115193,55115222,55115319,55116411,55117150,55117300,55117698,55118991,55119860,55120196,55120269,55120881,55121502,55122183,55122335,55122732,55123068,55123618,55124518,55125001,55125768,55126644,55127719,55128187,55128207,55129891,55130105,55130475,55131676,55131813,55131926,55132280,55132478,55133247,55134528,55134555,55134976,55135157,55136627,55136631,55137038,55137366,55138675,55141105,55141897,55142040,55142222,55142232,55142784,55143627,55144255,55144373,55144646,55145173,55146332,55146453,55146539,55147204,55147410,55147493,55147513,55148131,55149129,55149356,55149784,55149822,55149881,55150431,55150449,55151005,55151325,55151857,55152656,55153039,55153734,55154627,55154687,55155106,55155177,55155706,55156454,55156690,55156711,55158529,55159078,55159313,55160757,55161381,55161443,55161971,55162774,55162849,55162991,55162992,55163053,55165285,55166750,55167656,55168947,55168967,55169028,55169565,55170405,55171183,55171745,55173436,55173784,55173851,55174017,55174146,55175329,55176723,55177185,55178331,55178413,55179276,55179751,55179947,55181230,55181265,55181471,55184110,55185720,55185869,55187099,55187720,55187747,55188622,55189286,55189364,55189418,55189535,55189832,55189859,55190040,55190381,55190501,55190680,55191284,55191892,55192789,55195420,55196333,55196765,55197525,55200948,55201539,55201567,55202835,55203176,55203811,55207070,55208283,55208575,55208741,55209004,55212310,55212443,55213155,55213593,55215465,55215593,55218556,55220412,55221419,55222161,55222367,55225717,55228246,55228279,55230198,55231641,55231790,55232218,55234312,55234783,55234795,55236727,55237158,55237795,55239478,55239579,55239962,55241372,55241628,55242120,55242240,55242362,55242399,55242677,55243440,55243772,55243844,55244088,55248652,55249403,55250289,55250747,55251102,55251217,55252469,55252748,55252978,55256562,55257020,55257503,55257837,55259308,55259542,55259609,55260195,55260661,55261046,55261920,55262819,55263258,55263462,55265145,55265516,55265755,55266244,55267205,55267295,55267328,55267670,55267713,55268245,55269247,55269480,55269526,55269612,55269737,55269752,55271214,55271826,55271936,55272558,55272785,55273325,55273490,55273876,55274477,55274666,55274707,55274958,55275327,55275826,55276135,55277109,55277318,55277457,55277496,55278476,55278675,55278767,55279664,55280384,55281486,55282057,55282271,55283821,55284614,55284912,55285280,55286191,55286429,55286635,55286658,55287578,55287590,55287657,55288336,55289688,55289690,55289697,55292550,55293002,55294011,55294281,55294447,55294899,55295159,55295411,55295707,55297870,55297904,55298433,55299056,55299289,55299778,55299851,55299904,55300031,55300636,55301242,55302129,55303161,55305841,55305959,55306405,55307435,55308385,55308549,55308814,55310602,55311178,55312368,55312377,55312745,55313068,55313577,55313649,55313968,55314382,55314939,55315476,55315546,55315742,55318608,55318912,55319434,55319773,55319998,55320202,55321001,55321219,55321518,55322431,55322447,55323598,55323760,55323904,55324462,55324548,55324633,55324779,55324782,55325781,55326645,55327575,55329374,55329391,55329933,55329982,55331207,55331682,55331795,55333075,55333383,55333551,55334633,55334790,55335327,55336102,55336669,55337318,55337900,55338187,55338642,55338927,55339238,55341193,55342946,55342961,55343000,55344289,55346217,55347529,55347648,55348562,55348880,55349016,55349256,55349895,55350043,55350584,55350636,55351148,55351753,55352337,55353225,55354328,55354356,55354471,55356123,55356383,55356936,55357644,55358084,55358106,55358824,55359322,55359638,55359714,55360031,55360071,55360595,55361049,55361431,55361474,55361503,55362987,55363197,55363467,55363710,55364230,55365543,55365647,55366642,55366673,55367178,55367533,55368510,55369933,55370719,55371158,55372150,55372724,55372799,55373360,55373392,55375881,55376419,55376564,55377454,55379355,55379594,55380144,55380531,55381635,55382636,55382962,55383169,55384170,55384330,55384530,55384580,55386496,55386787,55386941,55388390,55389422,55392071,55392110,55392640,55392886,55393018,55395086,55395200,55396185,55397098,55400178,55400293,55400336,55400753,55402789,55403485,55404087,55407138,55407319,55408983,55410135,55412073,55413071,55413505,55413622,55414097,55415318,55416057,55417078,55417117,55417870,55418357,55418773,55419805,55420799,55421319,55421337,55422476,55422525,55424187,55424557,55425107,55425670,55428980,55431318,55431498,55431519,55431746,55432298,55432538,55433522,55433805,55434174,55434504,55435344,55435346,55436030,55436211,55436256,55437168,55438175,55438652,55438703,55439086,55439656,55440850]}}
    вопрос как спарсить users?!
     
  11. Ins3t

    Ins3t Харьковчанин

    Joined:
    18 Jul 2009
    Messages:
    942
    Likes Received:
    428
    Reputations:
    139
  12. GoldenEagle

    GoldenEagle New Member

    Joined:
    4 Aug 2015
    Messages:
    8
    Likes Received:
    0
    Reputations:
    0
  13. #colorblind

    #colorblind Elder - Старейшина

    Joined:
    31 Jan 2014
    Messages:
    598
    Likes Received:
    220
    Reputations:
    36
    А в чем проблема парсить ручками? pos, delete, copy...
     
    ralaed77 likes this.
  14. GoldenEagle

    GoldenEagle New Member

    Joined:
    4 Aug 2015
    Messages:
    8
    Likes Received:
    0
    Reputations:
    0
    проблема
     
  15. crystalbit

    crystalbit Elder - Старейшина

    Joined:
    6 Jun 2008
    Messages:
    217
    Likes Received:
    89
    Reputations:
    8
    Специально для тебя)
    Code:
    function getBetween(src: String; a: String; b: String): String;
    var
      p: Integer;
    begin
      p:=Pos(a, src)+Length(a);
      Result:=Copy(src, p, PosEx(b, src, p)-p);
    end;
    и юзаешь
    Code:
    строкаДляЮзеровЧерезЗапятую:=getBetween(str, '"users":[', ']');
    Где в str у тебя этот json. Дальше в массив, если надо, сам. Думаю, в гугле есть ответ
     
  16. triblekill

    triblekill Member

    Joined:
    21 Aug 2011
    Messages:
    329
    Likes Received:
    64
    Reputations:
    0
    Здравствуйте собственно такой вопрос: как определить какие именно Checkbox выбраны у меня их три checkbox1, checkbox2, checkbox3?
     
  17. FunOfGun

    FunOfGun Elder - Старейшина

    Joined:
    5 Sep 2012
    Messages:
    391
    Likes Received:
    70
    Reputations:
    124
  18. triblekill

    triblekill Member

    Joined:
    21 Aug 2011
    Messages:
    329
    Likes Received:
    64
    Reputations:
    0
    Нет это итак понятно как сделать чтобы не писать
    PHP:
    checkbox1.Checkedcheckbox2.Checkedcheckbox3.checked checkbox[i].Checked ошибка
     
  19. #colorblind

    #colorblind Elder - Старейшина

    Joined:
    31 Jan 2014
    Messages:
    598
    Likes Received:
    220
    Reputations:
    36
    Это где вас так учили к компонентам обращаться?

    PHP:
    var
      
    eTCheckBox;
      
    cbNamestring;
      
    iinteger;
    begin
      Memo1
    .Clear;
      
    cbName:='CheckBox';
      for 
    i:= 1 to 3 do begin
        e 
    := (FindComponent(cbName+IntToStr(i)) as TCheckBox);
        if (
    <> nil) and (e.Checked)
        
    Then Memo1.Lines.Add('CheckBox'+inttostr(i)+' checked')
        Else 
    Memo1.Lines.Add('CheckBox'+inttostr(i)+' NOT checked')
      
    end;
    end;
     
  20. crystalbit

    crystalbit Elder - Старейшина

    Joined:
    6 Jun 2008
    Messages:
    217
    Likes Received:
    89
    Reputations:
    8
    Считаю следующий вариант более правильным:
    Code:
    for i:=0 to ComponentsCount-1 do begin
      if (Components[i] is TCheckBox) then begin
        if (Components[i] as TCheckBox).Checked then
          Memo1.Lines.Add((Components[i] as TCheckBox).Name+' is checked')
        else
          Memo1.Lines.Add((Components[i] as TCheckBox).Name+' is not checked');
      end; {if}
    end; {for}
    Это если компоненты сразу на форме. Если, например, на панели, то обращаться как Panel1.ComponentsCount и Panel1.Components, например
     
Loading...