- conheça também:
acronsoft
acrondesign
DeveloperFlex - Soluções para Desenvolvedores Visual DataFlex
contato@developerflex.com.br | (55 11) 4378-1115
A classe cWsProcurarLookupButton está definida no pacote cWsProcurarLookupButton.pkg.
A classe cWsProcurarLookupButton é uma subclasse da classe cWsGenericLookupButton do MenuFlex e herda todas as propriedades, eventos e métodos existentes nesta classe.
As classes cWsCancelarLookupButton, cWsOkLookupButton e cWsProcurarLookupButton são classes especializadas que foram criadas para serem usadas única e exclusivamente em uma Lookup.
A utilização destas classes proporciona a eliminação de código redundante, uma vez que várias propriedades que costumeiramente são configuradas nos botões da Lookup já são configuradas com valores padrões.
O exemplo abaixo mostra o código de uma Lookup "tradicional" sem a utilização destas classes:
CD_Popup_Object Customer_sl is a dbModalPanel
Set Border_Style to Border_Thick
Set Minimize_Icon to False
Set Label to "Customer List"
Set Size to 134 238
Set Location to 4 5
Set piMinSize to 97 174
Object Customer_DD is a Customer_DataDictionary
End_Object // Customer_DD
Set Main_DD to Customer_DD
Set Server to Customer_DD
Object oSelList is a dbList
Set Main_File to Customer.File_Number
Set Ordering to 1
Set Size to 106 227
Set Location to 6 6
Set peAnchors to anAll
Set pbHeaderTogglesDirection to True
Begin_Row
Entry_Item Customer.Customer_Number
Entry_Item Customer.Name
End_Row
Set Form_Width 0 to 38
Set Header_Label 0 to "Number"
Set Form_Width 1 to 183
Set Header_Label 1 to "Customer Name"
End_Object // oSelList
Object oOK_bn is a Button
Set Label to "&Ok"
Set Location to 116 77
Set peAnchors to anBottomRight
Procedure OnClick
Send OK To oSelList
End_Procedure
End_Object // oOK_bn
Object oCancel_bn is a Button
Set Label to "&Cancel"
Set Location to 116 130
Set peAnchors to anBottomRight
Procedure OnClick
Send Cancel To oSelList
End_Procedure
End_Object // oCancel_bn
Object oSearch_bn is a Button
Set Label to "&Search..."
Set Location to 116 183
Set peAnchors to anBottomRight
Procedure OnClick
Send Search To oSelList
End_Procedure
End_Object // oSearch_bn
On_Key Key_Alt+Key_O Send KeyAction To oOk_bn
On_Key Key_Alt+Key_C Send KeyAction To oCancel_bn
On_Key Key_Alt+Key_S Send KeyAction To oSearch_bn
CD_End_Object // Customer_sl
Abaixo o código de uma Lookup utilizando estas classes:
Cd_Popup_Object Modulo_sl is a cWsDbModalPanel
Object oModulo_DD is a Modulo_DataDictionary
End_Object
Set Main_DD to oModulo_DD
Set Server to oModulo_DD
Set Location to 4 5
Set Size to 132 291
Set piMinSize to 132 291
Set Label to "Lista de módulos"
Object oSelList is a cWsDbList
Set Size to 105 280
Set Location to 5 5
Set peAnchors to anAll
Set peResizeColumn to rcAll
Set pbHeaderTogglesDirection to True
Set Auto_Server_State to True
Begin_Row
Entry_Item Modulo.Id_Modulo
Entry_Item Modulo.Ds_Modulo
End_Row
Set Main_File to Modulo.File_number
Set Form_Width 0 to 48
Set Header_Label 0 to "Código"
Set Form_Width 1 to 221
Set Header_Label 1 to "Descrição"
End_Object // oSelList
Object oOKButton is a cWsOkLookupButton
Set Location to 113 129
End_Object // oOkButton
Object oCancelarButton is a cWsCancelarLookupButton
Set Location to 113 182
End_Object // oCancel_bn
Object oProcurarButton is a cWsProcurarLookupButton
Set Location to 113 235
End_Object // oSearch_bn
On_Key Key_Alt+Key_O Send KeyAction to oOKButton
On_Key Key_Alt+Key_C Send KeyAction to oCancelarButton
On_Key Key_Alt+Key_P Send KeyAction to oProcurarButton
Cd_End_Object
Nota-se que a utilização destas classes proporciona a eliminação de 5 linhas de código em cada objeto Button, totalizando 15 linhas de código por Lookup. Portanto, em uma aplicação que possua 200 lookups seriam eliminadas 3.000 linhas de código e se obteria uma pequena diminuição no tamanho do programa compilado.