hi,
to us a Codepage it must be REQUEST before
i have a Array of Codepage but if not REQUEST i want to "disable" it
but how find out which HB_CODEPAGE_xxx have been REQUEST
ChangeCodePage( cPathcFile, cAlias, oBrw )
ChangeCodePage( cPathcFile, , oBrw )
ChangeCodePage( , , ::oGrid )
ChangeCodePage()
USE (cDBF) EXCLUSIVE CODEPAGE SP_cWinCodepage()
MEMVAR BFcolor, BGcolor
MEMVAR oFontDefault, bGradient
FUNCTION ChangeCodePage( cPathcFile, cAlias, oBrw, nIcoLarge, nIcoSmall )
LOCAL oWnd
LOCAL ii, iMax
LOCAL oGrid, aItem, oBrwDBF
LOCAL aCDP := Get_cdpSelect()
LOCAL nStart := 0
LOCAL cDrive := SPACE( 80 )
LOCAL bAction := { | x | nil }
LOCAL cMsg := ""
LOCAL aHeader := {}
LOCAL nRec := RECNO()
LOCAL lExit := .F.
DEFAULT nIcoLarge := 256 // 32
DEFAULT nIcoSmall := 32 // 16
nStart := ASCAN( aCDP, { | e | TRIM( e[ LANG_CODEPAGE ] ) == TRIM( SP_cWinCodepage() ) } )
IF EMPTY( nStart )
nStart := 1
ENDIF
fwlog nStart, PROCNAME( 2 ), PROCLINE( 2 ), cPathcFile, cAlias, oBrw, nIcoLarge, nIcoSmall
* #define use_win
#ifdef use_win
DEFINE WINDOW oWnd FROM 0, 0 TO 1024, 470 PIXEL TITLE "Codepage" ICON "A1MAIN" COLOR BFcolor, BGcolor NOMINIMIZE NOMAXIMIZE
oGrid := TGrid() :New( 0, 0,, bAction, oWnd, ;
BFcolor, BGcolor, .T., .F., ;
470, 1024, cMsg, nIcoLarge, nIcoSmall )
AADD( aHeader, { "Country", 250, LVCFMT_LEFT, "C" } )
AADD( aHeader, { "Codepage", 200, LVCFMT_LEFT, "C" } )
oGrid:aHeader := aHeader
oGrid:aSource := aCDP
oGrid:CreateHeaderColumn()
iMax := LEN( aCDP )
FOR ii := 1 TO iMax
aItem := { aCDP[ ii ] [ 1 ], aCDP[ ii ] [ 6 ] }
LV_ADDITEM( oGrid:hLv, aItem )
NEXT
oGrid:Setfocus()
IF !EMPTY( nStart )
LV_SETITEMSELECT( oGrid:hLv, nStart )
ENDIF
oGrid:bClick := { | nItem | DoSetNewCP( cPathcFile, aCDP[ nItem ] [ 6 ], cAlias, oBrw, @lExit ), oWnd:End() }
oWnd:oClient := oGrid
#else
DEFINE DIALOG oWnd TITLE "Codepage" SIZE 1024, 470 PIXEL COLOR BFcolor, BGcolor // FONT oFontDefault
@ 0, 0 XBROWSE oBrwDBF SIZE 1024, 470 PIXEL OF oWnd ;
DATASOURCE aCDP ;
COLUMNS 1, 6 ;
FONT oFontDefault ;
COLOR BFcolor, BGcolor ;
CELL LINES NOBORDER AUTOCOLS AUTOSORT FASTEDIT
oBrwDBF:lRecordSelector := .F.
oBrwDBF:bClrHeader := { || { BFcolor, BGcolor } }
oBrwDBF:bClrGrad := bGradient
oBrwDBF:bClrStd := { || { IF( ( oBrwDBF:cAlias )->( DELETED() ), ;
CLR_GRAY, BFcolor ), BGcolor } }
// oBrwDBF:bClick := { | nItem | DoSetNewCP( cPathcFile, aCDP[ nItem ] [ 6 ], cAlias , , @lExit ), oWnd:End() }
oBrwDBF:CreateFromCode()
oWnd:oClient := oBrwDBF
#endif
oWnd:bKeyDown := { | nKey, nFlag | IF( nKey = VK_ESCAPE, ( lExit := .T., oWnd:End() ), nil ) }
oWnd:bResized := { | nType, nWidth, nHeight | oWnd:SetSize( 470, 1024 ) }
#ifdef use_win
END WINDOW
ACTIVATE WINDOW oWnd ON INIT MakeTop( oWnd, oGrid ) CENTER VALID lExit
#else
END DIALOG
ACTIVATE DIALOG oWnd ON INIT MakeTop( oWnd, oBrwDBF ) CENTER
#endif
IF VALTYPE( oBrw ) = "O"
oBrw:Refresh()
IF !EMPTY( cAlias )
DBGOTO( nRec )
ENDIF
ENDIF
RETURN NIL
STATIC PROCEDURE DoSetNewCP( cPathcFile, cCodepage, cAlias, oBrw, lExit )
LOCAL cVia
IF EMPTY( cAlias )
hb_CDPSELECT( TRIM( cCodepage ) )
IF VALTYPE( oBrw ) = "O"
oBrw:Refresh()
ENDIF
ELSE
IF SP_cInxExt() = "CDX"
cVia := "DBFCDX"
ELSE
cVia := "DBFNTX"
ENDIF
CLOSE
IF SP_lShared()
USE (cPathcFile) VIA (cVia) NEW SHARED ALIAS (cAlias) CODEPAGE TRIM(cCodepage)
ELSE
USE (cPathcFile) VIA (cVia) NEW EXCLUSIVE ALIAS (cAlias) CODEPAGE TRIM(cCodepage)
ENDIF
ENDIF
SP_cWinCodepage( TRIM( cCodepage ) )
lExit := .T.
RETURN
STATIC FUNCTION Get_cdpSelect()
LOCAL aCDP := {}
AADD( aCDP, { "Bulgarian ", "866 ", "BG866 ", "cp866 ", "866 ", "BG866 " } )
AADD( aCDP, { "Bulgarian ", "ISO-8859-5 ", "BGISO ", "iso8859-5 ", "ISO-8859-5 ", "BGISO " } )
AADD( aCDP, { "Bulgarian ", "MIK ", "BGMIK ", "bg-mik ", "MIK ", "BGMIK " } )
AADD( aCDP, { "Bulgarian ", "Windows-1251", "BGWIN ", "cp1251 ", "Windows-1251", "BGWIN " } )
AADD( aCDP, { "Croatian ", "437 ", "HR437 ", " ", "437 ", "HR437 " } ) // no
AADD( aCDP, { "Croatian ", "852 ", "HR852 ", " ", "852 ", "HR852 " } )
AADD( aCDP, { "Croatian ", "Windows-1250", "HR1250", " ", "Windows-1250", "HRWIN " } )
AADD( aCDP, { "Czech ", "852 ", "CS852 ", "cp852 ", "852 ", "CS852 " } )
AADD( aCDP, { "Czech ", "ISO-8859-2 ", "CSISO ", "iso8859-2 ", "ISO-8859-2 ", "CSISO " } )
AADD( aCDP, { "Czech ", "KAM ", "CSKAM ", "kamenicky ", "KAM ", "CSKAM " } ) // no
AADD( aCDP, { "Czech ", "Windoes-1250", "CSWIN ", "cp1250 ", "Windoes-1250", "CSWIN " } )
AADD( aCDP, { "English ", "437 ", "EN ", " ", "437 ", "EN " } )
AADD( aCDP, { "French ", "850 ", "FR ", " ", "850 ", "FR850 " } )
AADD( aCDP, { "German OEM ", "850 ", "DE ", " ", "850 ", "DE850 " } )
AADD( aCDP, { "German ANSI ", "ISO-8859-1 ", "DEWIN ", "cp1252 ", "ISO-8859-1 ", "DEWIN " } )
AADD( aCDP, { "Greek ", "737 ", "EL ", "cp737 ", "737 ", "EL737 " } )
AADD( aCDP, { "Greek ", "Windows-1253", "ELWIN ", "cp1253 ", "Windows-1253", "ELWIN " } )
AADD( aCDP, { "Hungarian (ntxhu852) ", "852 ", "HU852 ", " ", "852 ", "HU852C" } )
AADD( aCDP, { "Hungarian (sixhu852) ", "852 ", "HU852S", " ", "852 ", "HU852 " } )
AADD( aCDP, { "Hungarian (ntxhu852) ", "ISO-8859-2 ", "HUISO ", " ", "CWI-2 ", "HUCWI " } ) // ?
AADD( aCDP, { "Hungarian (sixhu852) ", "ISO-8859-2 ", "HUISOS", " ", "ISO-8859-2 ", "HUISO " } )
AADD( aCDP, { "Hungarian (ntxhu852) ", "Windows-1250", "HUWIN ", " ", "Windows-1250", "HUWIN " } )
AADD( aCDP, { "Hungarian (sixhu852) ", "Windows-1250", "HUWINS", " ", " ", "HUWINS" } ) // ?
AADD( aCDP, { "Italian ", "437 ", "IT437 ", " ", "437 ", "IT437 " } )
AADD( aCDP, { "Italian ", "850 ", "IT850 ", " ", "850 ", "IT850 " } )
AADD( aCDP, { "Italian ", "ISO-8859-1b ", "ITISB ", "iso8859-1b", "ISO-8859-1b ", "ITISB " } )
AADD( aCDP, { "Italian ", "ISO-8859-1 ", "ITISO ", " ", "ISO-8859-1 ", "ITISO " } )
AADD( aCDP, { "Lithuanian ", "Windows-1257", "LT ", "cp1257 ", "Windows-1257", "LTWIN " } )
AADD( aCDP, { "Polish ", "852 ", "PL852 ", " ", "852 ", "PL852 " } )
AADD( aCDP, { "Polish ", "ISO-8859-2 ", "PLISO ", " ", "ISO-8859-2 ", "PLISO " } )
AADD( aCDP, { "Polish ", "Mazowia ", "PLMAZ ", "mazovia ", "Mazowia ", "PLMAZ " } )
AADD( aCDP, { "Polish ", "Windows-1250", "PLWIN ", " ", "Windows-1250", "PLWIN " } )
AADD( aCDP, { "Portuguese ", "850 ", "PT850 ", " ", "850 ", "PT850 " } )
AADD( aCDP, { "Portuguese ", "ISO-8859-1 ", "PTISO ", " ", "ISO-8859-1 ", "PTISO " } )
AADD( aCDP, { "Russian ", "866 ", "RU866 ", " ", "866 ", "RU866 " } )
AADD( aCDP, { "Russian ", "KOI-8 ", "RUKOI8", "koi-8 ", "KOI-8 ", "RUKOI8" } )
AADD( aCDP, { "Russian ", "Windows-1251", "RU1251", " ", "Windows-1251", "RU1251" } )
AADD( aCDP, { "Serbian ", "Windows-1251", "SRWIN ", " ", "Windows-1251", "SRWIN " } )
AADD( aCDP, { "Slovak ", "852 ", "SK852 ", " ", "852 ", "SK852 " } )
AADD( aCDP, { "Slovak ", "ISO-8859-2 ", "SKISO ", " ", "ISO-8859-2 ", "SKISO " } )
AADD( aCDP, { "Slovak ", "Kamenicky ", "SKKAM ", " ", "Kamenicky ", "SKKAM " } ) // no
AADD( aCDP, { "Slovak ", "Windows-1250", "SKWIN ", " ", "Windows-1250", "SKWIN " } )
AADD( aCDP, { "Slovenian ", "437 ", "SL437 ", " ", "437 ", "SL437 " } ) // no
AADD( aCDP, { "Slovenian ", "852 ", "SL852 ", " ", "852 ", "SL852 " } )
AADD( aCDP, { "Slovenian ", "ISO-8859-2 ", "SLISO ", " ", "ISO-8859-2 ", "SLISO " } )
AADD( aCDP, { "Slovenian ", "Windows-1250", "SLWIN ", " ", "Windows-1250", "SLWIN " } )
AADD( aCDP, { "Spanish ", "850 ", "ES ", " ", "850 ", "ES850 " } )
AADD( aCDP, { "Spanish ", "ISO-8859-1 ", "ESWIN ", " ", "ISO-8859-1 ", "ESWIN " } )
AADD( aCDP, { "Spanish Modern ", "ISO-8859-1 ", "ESMWIN", " ", "ISO-8859-1 ", "ESMWIN" } )
AADD( aCDP, { "Swedish ", "850 ", "SV850 ", " ", "850 ", "SV850 " } )
AADD( aCDP, { "Swedish (Clipper) ", "437 ", "SVCLIP", " ", "437 ", "SV437C" } )
AADD( aCDP, { "Swedish ", "ISO-8859-1 ", "SVWIN ", " ", "ISO-8859-1 ", "SVWIN " } )
AADD( aCDP, { "Turkish ", "857 ", "TR857 ", "cp857 ", "857 ", "TR857 " } )
AADD( aCDP, { "Turkish ", "Windows-1254", "TRWIN ", "cp1254 ", "Windows-1254", "TRWIN " } )
AADD( aCDP, { "Ukrainian ", "866 ", "UA866 ", " ", "866 ", "UA866 " } )
AADD( aCDP, { "Ukrainian ", "KOI-8U ", "UAKOI8", "koi-8u ", "KOI-8U ", "UAKOI8" } )
AADD( aCDP, { "Ukrainian ", "Windows-1251", "UA1251", " ", "Windows-1251", "UA1251" } )
AADD( aCDP, { "UTF-8 ", "UTF8 ", "UTF8 ", " ", " ", "UTF8 " } )
AADD( aCDP, { "UTF-8 BOM ", "UTF8EX ", "UTF8EX", " ", " ", "UTF8EX" } )
// not exact identify
AADD( aCDP, { "Czech ", "CS852C ", " ", " ", " ", "CS852C" } )
AADD( aCDP, { "Czech ", "CSKAMC ", " ", " ", " ", "CSKAMC" } )
AADD( aCDP, { "German ", "DE850M ", " ", " ", " ", "DE850M" } )
AADD( aCDP, { "German ", "DEISO ", " ", " ", " ", "DEISO " } )
AADD( aCDP, { "Danmark ", "DK865 ", " ", " ", " ", "DK865 " } )
AADD( aCDP, { "Greek ", "EL437 ", " ", " ", " ", "EL437 " } )
AADD( aCDP, { "Greek ", "ELISO ", " ", " ", " ", "ELISO " } )
AADD( aCDP, { "Spanish ", "ES850C ", " ", " ", " ", "ES850C" } )
AADD( aCDP, { "Spanish ", "ES850M ", " ", " ", " ", "ES850M" } )
AADD( aCDP, { "Spanish ", "ESISO ", " ", " ", " ", "ESISO " } )
AADD( aCDP, { "Finnland ", "FI850 ", " ", " ", " ", "FI850 " } )
AADD( aCDP, { "French ", "FR850C ", " ", " ", " ", "FR850C" } )
AADD( aCDP, { "French ", "FR850M ", " ", " ", " ", "FR850M" } )
AADD( aCDP, { "French ", "FRISO ", " ", " ", " ", "FRISO " } )
AADD( aCDP, { "French ", "FRWIN ", " ", " ", " ", "FRWIN " } )
AADD( aCDP, { "Hebrew ", "HE862 ", " ", " ", " ", "HE862 " } )
AADD( aCDP, { "Hebrew ", "HEWIN ", " ", " ", " ", "HEWIN " } )
AADD( aCDP, { "Croatian ", "HRISO ", " ", " ", " ", "HRISO " } )
AADD( aCDP, { "Icelandic ", "IS850 ", " ", " ", " ", "IS850 " } )
AADD( aCDP, { "Icelandic ", "IS861 ", " ", " ", " ", "IS861 " } )
AADD( aCDP, { "Italian ", "IT850M ", " ", " ", " ", "IT850M" } )
AADD( aCDP, { "Italian ", "ITWIN ", " ", " ", " ", "ITWIN " } )
AADD( aCDP, { "Lithuanian ", "LT775 ", " ", " ", " ", "LT775 " } )
AADD( aCDP, { "Nederland ", "NL850 ", " ", " ", " ", "NL850 " } )
AADD( aCDP, { "Nederland ", "NL850M ", " ", " ", " ", "NL850M" } )
AADD( aCDP, { "Norway ", "NO865 ", " ", " ", " ", "NO865 " } )
AADD( aCDP, { "Portuguese ", "PT860 ", " ", " ", " ", "PT860 " } )
AADD( aCDP, { "Romanian ", "RO852 ", " ", " ", " ", "RO852 " } )
AADD( aCDP, { "Romanian ", "ROISO ", " ", " ", " ", "ROISO " } )
AADD( aCDP, { "Romanian ", "ROWIN ", " ", " ", " ", "ROWIN " } )
AADD( aCDP, { "Russian ", "RUISO ", " ", " ", " ", "RUISO " } )
AADD( aCDP, { "Slovak ", "SK852C ", " ", " ", " ", "SK852C" } )
AADD( aCDP, { "Slovak ", "SKKAMC ", " ", " ", " ", "SKKAMC" } )
AADD( aCDP, { "Slovenian ", "SL646 ", " ", " ", " ", "SL646 " } )
AADD( aCDP, { "Serbian ", "SR646 ", " ", " ", " ", "SR646 " } )
AADD( aCDP, { "Serbian ", "SR646C ", " ", " ", " ", "SR646C" } )
AADD( aCDP, { "Swedish ", "SV850M ", " ", " ", " ", "SV850M" } )
AADD( aCDP, { "Turkish ", "TRISO ", " ", " ", " ", "TRISO " } )
AADD( aCDP, { "Ukrainian ", "UA1125 ", " ", " ", " ", "UA1125" } )
AADD( aCDP, { "UTF16LE ", "UTF16LE ", " ", " ", " ", "UTF16LE" } )
RETURN ASORT( aCDP,,, { | aX, aY | aX[ 1 ] + aX[ 2 ] < aY[ 1 ] + aY[ 2 ] } )
FUNCTION SP_lShared( lValue )
STATIC lShared := .T.
IF PCOUNT() > 0
lShared := lValue
ENDIF
RETURN lShared
FUNCTION SP_cWinCodepage( cValue )
STATIC cWinCodepage := "DEWIN"
IF PCOUNT() > 0
cWinCodepage := cValue
ENDIF
RETURN cWinCodepage
? Empty( HB_FuncPtr( cCodePage ) )
nageswaragunupudi wrote:
- Code: Select all Expand view
? Empty( HB_FuncPtr( cCodePage ) )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 51 guests