//--------------------------------------------------------------------------- __fastcall TCFin1003A::TCFin1003A(TComponent* Owner) : TForm(Owner,1) { this->BorderStyle = bsDialog; this->BorderIcons = TBorderIcons() << biSystemMenu; this->Caption = "Senha"; this->Position = poDesktopCenter; this->ClientHeight = 68; this->ClientWidth = 185; pLabel = new TLabel(this); pLabel->Parent = this; pLabel->Caption = "&Senha:"; pLabel->SetBounds(10,12,36,13); pEdtPdw = new TEdit(this); pEdtPdw->Parent = this; pEdtPdw->PasswordChar = '*'; pEdtPdw->SetBounds(48,8,120,21); pLabel->FocusControl = pEdtPdw; pBtOK = new TButton(this); pBtOK->Parent = this; pBtOK->Caption = "&OK"; pBtOK->Default = true; //pBtOK->ModalResult = mrOk; pBtOK->OnClick = &BtOKClick; pBtOK->SetBounds(13,38,75,22); pBtCancel = new TButton(this); pBtCancel->Parent = this; pBtCancel->Caption = "&Cancelar"; pBtCancel->Cancel = true; pBtCancel->ModalResult = mrCancel; pBtCancel->SetBounds(97,38,75,22); }
//--------------------------------------------------------------------------- void __fastcall TFrm1010::ShowAppForms() { SfgForm *AppForm; TForm *form = new TForm(Application); TStringAlignGrid *grdAppForms = new TStringAlignGrid(form); form->ClientHeight = 154; form->ClientWidth = 402; form->BorderStyle = bsDialog; form->BorderIcons = TBorderIcons() << biSystemMenu; form->Caption = "Escolher Programa"; form->Position = poDesktopCenter; grdAppForms->Parent = form; grdAppForms->ColCount = 4; grdAppForms->DefaultRowHeight = 18; grdAppForms->AlignCol[1] = alCenter; grdAppForms->AlignCell[1][0] = alCenter; grdAppForms->AlignCell[2][0] = alCenter; grdAppForms->Cells[1][0] = "Programa"; grdAppForms->Cells[2][0] = "Título"; grdAppForms->Cells[3][0] = "Módulo"; grdAppForms->ColWidths[0] = 14; grdAppForms->ColWidths[1] = 74; grdAppForms->ColWidths[2] = 190; grdAppForms->ColWidths[3] = 100; grdAppForms->Align = alClient; grdAppForms->OnDblClick = &grdAppFormsDblClick; grdAppForms->Options = grdAppForms->Options << goColSizing << goRowSelect; grdAppForms->RowCount = 2; for (int i=0; i<AppForms->Count;i++) { AppForm = (SfgForm*)AppForms->Items[i]; if (i > 0) grdAppForms->RowCount++; grdAppForms->Cells[1][i+1] = AppForm->FormClass; grdAppForms->Cells[2][i+1] = AppForm->FormTitle; switch(AppForm->FormModule) { case APP_MODULO_ESTOQUE: grdAppForms->Cells[3][i+1] = "Estoque"; break; case APP_MODULO_COMPRAS: grdAppForms->Cells[3][i+1] = "Compras"; break; case APP_MODULO_VENDAS: grdAppForms->Cells[3][i+1] = "Vendas"; break; case APP_MODULO_FINANCAS: grdAppForms->Cells[3][i+1] = "Finanças"; break; default: grdAppForms->Cells[3][i+1] = "Padrão"; } } grdAppForms->SortColumn(1,true); grdAppForms->Row = 1; form->ShowModal(); delete form; }
//--------------------------------------------------------------------------- __fastcall TCFin1003B::TCFin1003B(TComponent* Owner, String sMsg) : TForm(Owner,1) { this->BorderStyle = bsDialog; this->BorderIcons = TBorderIcons() << biSystemMenu; this->Caption = "Cliente em Atraso"; this->Position = poDesktopCenter; Image = new TImage(this); Image->Name = "Image"; Image->Parent = this; Image->Picture->Icon->Handle = LoadIcon(0, IDI_EXCLAMATION); Image->SetBounds(6, 6, 32, 32); ClienteMsg = new TLabel(this); ClienteMsg->Name = "ClienteMsg"; ClienteMsg->Parent = this; ClienteMsg->WordWrap = false; ClienteMsg->AutoSize = true; ClienteMsg->SetBounds(44, 6, 100, 16); ClienteMsg->Font->Color = clRed; ClienteMsg->Font->Style = TFontStyles() << fsBold; ClienteMsg->Caption = sMsg; LiberaMsg = new TLabel(this); LiberaMsg->Name = "LiberaMsg"; LiberaMsg->Parent = this; LiberaMsg->WordWrap = false; LiberaMsg->AutoSize = true; LiberaMsg->SetBounds(44, ClienteMsg->Top + ClienteMsg->Height + 6, 100, 16); LiberaMsg->Font->Color = clBlue; LiberaMsg->Font->Style = TFontStyles() << fsBold; LiberaMsg->Caption = "Novas vendas para o mesmo estão sujeitas a aprovação."; pBtLibera = new TButton(this); pBtLibera->Parent = this; pBtLibera->Caption = "&Liberar"; pBtLibera->Default = true; pBtLibera->ModalResult = mrOk; pBtCancel = new TButton(this); pBtCancel->Parent = this; pBtCancel->Caption = "&Cancelar"; pBtCancel->Cancel = true; pBtCancel->ModalResult = mrCancel; pBtCancel->SetBounds(44+((ClienteMsg->Width > LiberaMsg->Width)? ClienteMsg->Width - 96: LiberaMsg->Width - 96),45,100,23); pBtLibera->SetBounds(pBtCancel->Left-104,45,100,23); this->ClientWidth = pBtCancel->Left + pBtCancel->Width + 6; this->ClientHeight = pBtCancel->Top + pBtCancel->Height + 6; MessageBeep(MB_ICONSTOP); }
//--------------------------------------------------------------------------- __fastcall TCFin1003C::TCFin1003C(TComponent* Owner, String sMsg) : TForm(Owner,1) { this->BorderStyle = bsDialog; this->BorderIcons = TBorderIcons() << biSystemMenu; this->Caption = "Cliente Bloqueado"; this->Position = poDesktopCenter; Image = new TImage(this); Image->Name = "Image"; Image->Parent = this; Image->Picture->Icon->Handle = LoadIcon(0, IDI_ERROR); Image->SetBounds(6, 6, 32, 32); ClienteMsg = new TLabel(this); ClienteMsg->Name = "ClienteMsg"; ClienteMsg->Parent = this; ClienteMsg->WordWrap = false; ClienteMsg->AutoSize = true; ClienteMsg->SetBounds(44, 6, 100, 16); ClienteMsg->Font->Color = clRed; ClienteMsg->Font->Style = TFontStyles() << fsBold; ClienteMsg->Caption = sMsg; LiberaMsg = new TLabel(this); LiberaMsg->Name = "LiberaMsg"; LiberaMsg->Parent = this; LiberaMsg->WordWrap = false; LiberaMsg->AutoSize = true; LiberaMsg->SetBounds(44, ClienteMsg->Top + ClienteMsg->Height + 6, 100, 16); LiberaMsg->Font->Color = clBlue; LiberaMsg->Font->Style = TFontStyles() << fsBold; LiberaMsg->Caption = "Novas vendas para o mesmo somente com aprovação da gerência."; pBtOK = new TButton(this); pBtOK->Parent = this; pBtOK->Caption = "&OK"; pBtOK->Default = true; pBtOK->ModalResult = mrOk; pBtOK->SetBounds(44+((ClienteMsg->Width > LiberaMsg->Width)? ClienteMsg->Width - 70: LiberaMsg->Width - 70),45,75,23); this->ClientWidth = pBtOK->Left + pBtOK->Width + 6; this->ClientHeight = pBtOK->Top + pBtOK->Height + 6; MessageBeep(MB_ICONSTOP); }
//--------------------------------------------------------------------------- bool __fastcall InputDialog(const UnicodeString ACaption, const UnicodeString APrompt, UnicodeString & Value, UnicodeString HelpKeyword, TStrings * History, bool PathInput, TInputDialogInitialize OnInitialize) { bool Result = False; TInputDialogToken Token; TForm * Form = new TForm(GetFormOwner(), 0); // bypass the VCL streaming (for Salamander) try { // salam needs to override this in UseSystemSettings Form->Position = poOwnerFormCenter; SetCorrectFormParent(Form); UseSystemSettingsPre(Form); // this is what TCustomForm.Loaded does // Note that this is not needed as due to use of an alternative constructor above // we are already set to default font // See TMessageForm::Create for contrary Form->Font->Assign(Application->DefaultFont); Form->ParentFont = true; Token.OnInitialize = OnInitialize; Token.PathInput = PathInput; TNotifyEvent OnShow; ((TMethod *)&OnShow)->Data = &Token; ((TMethod *)&OnShow)->Code = InputDialogShow; Form->OnShow = OnShow; Form->Canvas->Font = Form->Font; Form->BorderStyle = bsDialog; Form->Caption = ACaption; Form->ClientWidth = ScaleByTextHeightRunTime(Form, 275); Form->ClientHeight = ScaleByTextHeightRunTime(Form, 102); if (!HelpKeyword.IsEmpty()) { Form->HelpKeyword = HelpKeyword; Form->BorderIcons = TBorderIcons(Form->BorderIcons) << biHelp; } TLabel * Prompt = new TLabel(Form); Prompt->Parent = Form; Prompt->AutoSize = True; Prompt->Left = ScaleByTextHeightRunTime(Form, 10); Prompt->Top = ScaleByTextHeightRunTime(Form, 13); Prompt->Caption = APrompt; TEdit * Edit; THistoryComboBox * HistoryCombo; if (History == NULL) { Edit = new TEdit(Form); Edit->Parent = Form; Edit->Text = Value; Edit->SelectAll(); Edit->MaxLength = 255; Token.Data.Edit = Edit; Token.EditControl = Edit; } else { HistoryCombo = new THistoryComboBox(Form); HistoryCombo->Parent = Form; HistoryCombo->Text = Value; HistoryCombo->SelectAll(); HistoryCombo->Items = History; HistoryCombo->MaxLength = 255; HistoryCombo->AutoComplete = false; Token.EditControl = HistoryCombo; } Token.EditControl->Left = Prompt->Left; Token.EditControl->Top = ScaleByTextHeightRunTime(Form, 30); Token.EditControl->Width = ScaleByTextHeightRunTime(Form, 255); Prompt->FocusControl = Token.EditControl; int ButtonTop = ScaleByTextHeightRunTime(Form, 66); int ButtonSpace = ScaleByTextHeightRunTime(Form, 6); TButton * Button; Button = new TButton(Form); Button->Parent = Form; Button->Caption = Vcl_Consts_SMsgDlgOK; Button->ModalResult = mrOk; Button->Default = True; int ButtonHeight = ScaleByTextHeightRunTime(Button, Button->Height); int ButtonWidth = ScaleByTextHeightRunTime(Button, Button->Width); int ButtonsStart; if (HelpKeyword.IsEmpty()) { ButtonsStart = (Form->ClientWidth / 2) - ButtonWidth - (ButtonSpace / 2); } else { ButtonsStart = (Form->ClientWidth / 2) - (3 * ButtonWidth / 2) - ButtonSpace; } Button->SetBounds(ButtonsStart, ButtonTop, ButtonWidth, ButtonHeight); Button = new TButton(Form); Button->Parent = Form; Button->Caption = Vcl_Consts_SMsgDlgCancel; Button->ModalResult = mrCancel; Button->Cancel = True; Button->SetBounds(ButtonsStart + ButtonWidth + ButtonSpace, ButtonTop, ButtonWidth, ButtonHeight); if (!HelpKeyword.IsEmpty()) { Button = new TButton(Form); Button->Parent = Form; Button->Caption = Vcl_Consts_SMsgDlgHelp; Button->ModalResult = mrNone; Button->SetBounds(ButtonsStart + 2 * (ButtonWidth + ButtonSpace), ButtonTop, ButtonWidth, ButtonHeight); TNotifyEvent OnClick; ((TMethod*)&OnClick)->Code = InputDialogHelp; Button->OnClick = OnClick; } UseSystemSettingsPost(Form); if (Form->ShowModal() == DefaultResult(Form)) { if (History != NULL) { HistoryCombo->SaveToHistory(); History->Assign(HistoryCombo->Items); Value = HistoryCombo->Text; } else { Value = Edit->Text; } Result = true; } } __finally { delete Form; } return Result; }