Antonio Linares,
//Bug Redefine ComboBox + oDB:FIELD with ('F' or 'J') in ITEM {'J - Pessoa Jurídica', 'F - Pessoa Física'} ?!
- Code: Select all Expand view RUN
use CLIENTE
// have one Class proper (TDBTable), but exemplify with TDataBase
DataBase oDBCli
? oDBCli:CLI_TIPPES // equal 'F' or 'J' - not is activate correctly element ComboBox (On Init Dlg).
//-----------------------------------------------------------
//Bug, if first Control receive Focus:
...
Redefine COMBOBOX oCbxTipPes ;
VAR oDBCli:CLI_TIPPES ;
ITEMS {'J - Pessoa Jurídica', 'F - Pessoa Física'} ;
ID 4002 ;
OF oFld:aDialogs[1]
Activate Dialog oDlg ;
Center ;
On Init PosCbx(oCbxTipPes,oDBCli:CLI_TIPPES)
// Use only this mode
//-----------------------------------------------------------
// Correct, if variable common:
...
cTipPes:=oDBCli:CLI_TIPPES
Redefine COMBOBOX oCbxTipPes ;
VAR cTipPes ;
ITEMS {'J - Pessoa Jurídica', 'F - Pessoa Física'} ;
ID 4002 ;
OF oFld:aDialogs[1]
Activate Dialog oDlg ;
Center ;
On Init PosCbx(oCbxTipPes,cTipPes)
//-----------------------------------------------------------
// Correct all mode:
...
@02,10 COMBOBOX oCbxTipPes ;
VAR oDBCli:CLI_TIPPES ;
ITEMS {'J - Pessoa Jurídica', 'F - Pessoa Física'} ;
ID 4002 ;
OF oFld:aDialogs[1]
Activate Dialog oDlg ;
Center ;
On Init PosCbx(oCbxTipPes,cTipPes)
//-----------------------------------------------------------
// Set position in oCbx:aItem
//-----------------------------------------------------------
function PosCbx( oCbx, cValue )
local nPos
if oCbx # nil .and. ! EMPTY(cValue)
if (nPos:=ASCAN(oCbx:aItems, {|x| UPPER(cValue) == UPPER(PADR(x,LEN(cValue)))} )) > 0
? 'PosCbx() Find "' + cValue + '" in element ' + ALLTRIM(STR(nPos))
oCbx:Select(nPos)
endif
endif
return nil
//-----------------------------------------------------------
//-----------------------------------------------------------
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 4.50".
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
LANGUAGE LANG_PORTUGUESE,SUBLANG_PORTUGUESE_BRAZILIAN
CDT_CLIENTE DIALOGEX DISCARDABLE 6, 18, 398, 194
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Dialog"
FONT 8, "MS Sans Serif", 0, 0, 1
BEGIN
CONTROL "", 4001, "SysTabControl32", 0x00000000, 0, 20, 396, 144
CONTROL "Cancelar", 4003, "Button", WS_TABSTOP, 344, 172, 45, 15
END
CDT_CLIENTE_GERAL DIALOGEX DISCARDABLE 6, 18, 396, 134
STYLE WS_CHILD|DS_3DLOOK|WS_VISIBLE
CAPTION "Dialog"
FONT 8, "MS Sans Serif", 0, 0, 1
BEGIN
CONTROL "", 4001, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 24, 12, 40, 12
CONTROL "", 4002, "ComboBox", WS_BORDER|CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP, 200, 12, 144, 40
CONTROL "", 4003, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 24, 48, 140, 12
END
CDT_CLIENTE_ENDERECO DIALOGEX DISCARDABLE 6, 18, 396, 134
STYLE WS_CHILD|DS_3DLOOK|WS_VISIBLE
CAPTION "Dialog"
FONT 8, "MS Sans Serif", 0, 0, 1
BEGIN
END
CDT_CLIENTE_FISCAL DIALOGEX DISCARDABLE 6, 18, 396, 134
STYLE WS_CHILD|DS_3DLOOK|WS_VISIBLE
CAPTION "Dialog"
FONT 8, "MS Sans Serif", 0, 0, 1
BEGIN
CONTROL "", 4001, "ComboBox", WS_BORDER|CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP, 112, 28, 168, 44
END
//-----------------------------------------------------------