{"id":335,"date":"2008-05-19T02:11:19","date_gmt":"2008-05-19T02:11:19","guid":{"rendered":"http:\/\/6teen.ru\/?p=94"},"modified":"2008-05-19T02:11:19","modified_gmt":"2008-05-19T02:11:19","slug":"8899","status":"publish","type":"post","link":"http:\/\/pblog.ru\/lab\/?p=335","title":{"rendered":"\u0414\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e \u0441 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c"},"content":{"rendered":"<p>\u0414\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e \u0441 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c<br \/>\n<!--more--><\/p>\n<pre class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:580px; height:320px; overflow:auto\"><div>\u0414\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e \u0441 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c\n\nfunction InputCombo(const ACaption, APrompt: string; const AList: TStrings): string;\n\nfunction GetCharSize(Canvas: TCanvas): TPoint;\nvar\nI: Integer;\nBuffer: array[0..51] of Char;\nbegin\nfor I := 0 to 25 do Buffer[I] := Chr(I + Ord('A'));\nfor I := 0 to 25 do Buffer[I + 26] := Chr(I + Ord('a'));\nGetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));\nResult.X := Result.X div 52;\nend;\n\nvar\nForm: TForm;\nPrompt: TLabel;\nCombo: TComboBox;\nDialogUnits: TPoint;\nButtonTop, ButtonWidth, ButtonHeight: Integer;\nbegin\nResult := '';\nForm := TForm.Create(Application);\nwith Form do\ntry\nCanvas.Font := Font;\nDialogUnits := GetCharSize(Canvas);\nBorderStyle := bsDialog;\nCaption := ACaption;\nClientWidth := MulDiv(180, DialogUnits.X, 4);\nPosition := poScreenCenter;\nPrompt := TLabel.Create(Form);\nwith Prompt do\nbegin\nParent := Form;\nCaption := APrompt;\nLeft := MulDiv(8, DialogUnits.X, 4);\nTop := MulDiv(8, DialogUnits.Y, 8);\nConstraints.MaxWidth := MulDiv(164, DialogUnits.X, 4);\nWordWrap := True;\nend;\nCombo := TComboBox.Create(Form);\nwith Combo do\nbegin\nParent := Form;\nStyle := csDropDownList;\n\/\/Style := csDropDown;\nItems.Assign(AList);\nItemIndex := 0;\nLeft := Prompt.Left;\nTop := Prompt.Top + Prompt.Height + 5;\nWidth := MulDiv(164, DialogUnits.X, 4);\nend;\nButtonTop := Combo.Top + Combo.Height + 15;\nButtonWidth := MulDiv(50, DialogUnits.X, 4);\nButtonHeight := MulDiv(14, DialogUnits.Y, 8);\nwith TButton.Create(Form) do\nbegin\nParent := Form;\nCaption := '\u0412\u044b\u0431\u0440\u0430\u0442\u044c';\nModalResult := mrOk;\ndefault := True;\nSetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth,\nButtonHeight);\nend;\nwith TButton.Create(Form) do\nbegin\nParent := Form;\nCaption := '\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c';\nModalResult := mrCancel;\nCancel := True;\nSetBounds(MulDiv(92, DialogUnits.X, 4), Combo.Top + Combo.Height + 15,\nButtonWidth, ButtonHeight);\nForm.ClientHeight := Top + Height + 13;\nend;\nif ShowModal = mrOk then\nbegin\nResult := Combo.Text;\nend;\nfinally\nForm.Free;\nend;\nend;\n\n\/\/\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\nprocedure TForm1.Button1Click(Sender: TObject);\nvar\nList: TStringList;\nbegin\nList := TStringList.Create;\ntry\nList.Add('\u0421\u0442\u0440\u043e\u043a\u04301');\nList.Add('\u0421\u0442\u0440\u043e\u043a\u04302');\nList.Add('\u0421\u0442\u0440\u043e\u043a\u04303');\nLabel1.Caption := InputCombo('Input Combo', 'Caption', List);\nfinally\nList.Free;\nend;\nend;\n<\/div><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e \u0441 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[437,448],"tags":[670,695,873,994],"_links":{"self":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/335"}],"collection":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=335"}],"version-history":[{"count":0,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/335\/revisions"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=335"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}