IF I change the caption ( you can click the button right of the mouse on control to edit the caption)
and then I move the control it not save the caption I changed
Why ?
- Code: Select all Expand view
#include "FiveWin.ch"
static oSay[1]
static cIniFile
FUNCTION TEST()
Local oDlg
cIniFile := cFilePath(GetModuleFileName( GetInstance() ) ) + "TESSERA.MEM"
cImpresa := GetIni( cIniFile, "IMPRESA", "Caption","<< Empresa >>")
cImFont := GetIni( cIniFile, "IMPRESA", "Font","Arial|0|-19|700|0|.F.|.F.")
cImColorpane := GetIni( cIniFile, "IMPRESA", "COLORPANE","")
cImColortext := GetIni( cIniFile, "IMPRESA", "COLORTXT","")
cImpresax := GetIni( cIniFile, "IMPRESA", "ASSEX","")
cImpresay := GetIni( cIniFile, "IMPRESA", "ASSEY","")
cImpresizex := GetIni( cIniFile, "IMPRESA", "SIZEX","")
cImpresizey := GetIni( cIniFile, "IMPRESA", "SIZEX","")
DEFINE DIALOG oDlg SIZE 680,520 ;
TITLE "Tessera 1.00"
ACTIVATE DIALOG oDlg;
ON INIT ( BuildControls( oDlg))
RETURN NIL
FUNCTION BuildControls(oWnd)
@ 3, 2 SAY oSay[1] PROMPT cImpresa OF oWnd DESIGN SIZE 250, 24 TRANSPARENT
oSay[1]:lWantClick = .T.
BringWindowToTop( oSay[1]:hWnd )
oSay[1]:SetFocus()
oSay[1]:bRClicked = { | nRow, nCol | LabelInspect(oSay[1], nRow, nCol,"IMPRESA" ),;
Save_Control(oSay[1], nRow, nCol,"IMPRESA")}
RETURN NIL
FUNCTION LabelInspect( oCtrl, nRow, nCol, cSection)
local oMenu
MENU oMenu POPUP
MENUITEM "&CAPTION" ACTION (EditTitle( oCtrl ),;
SetIni(cIniFile,cSection,"Caption",oCtrl:GetText()))
ENDMENU
ACTIVATE MENU oMenu AT nRow, nCol OF oCtrl
RETURN NIL
static function EditTitle( oWnd )
local oDlg, oGet, cOldTitle := PadR( oWnd:cCaption, 100 )
DEFINE DIALOG oDlg TITLE "Dialog title" SIZE 600, 110
oWnd:cCaption = PadR( oWnd:cCaption, 100 )
@ 1, 1 GET oGet VAR oWnd:cCaption OF oDlg SIZE 285, 12 ;
ON CHANGE oWnd:SetText( AllTrim( oGet:GetText() ) )
@ 2, 18 BUTTON "&Conferma" OF oDlg ACTION oDlg:End()
@ 2, 25 BUTTON "&Annulla" OF oDlg ACTION ( oWnd:SetText( cOldTitle ), oDlg:End() )
ACTIVATE DIALOG oDlg CENTERED
return nil
/*_____________________________________________________________________________*/
FUNCTION SetIni( cIni, cSection, cEntry, xVar )
LOCAL oIni
DEFAULT cIni := oApp:cIniFile
INI oIni FILE cIni
SET SECTION cSection ;
ENTRY cEntry ;
TO xVar ;
OF oIni
ENDINI
RETURN nil
/*_____________________________________________________________________________*/
FUNCTION GetIni( cIni, cSection, cEntry, xDefault )
LOCAL oIni
LOCAL xVar := xDefault
DEFAULT cIni := oApp:cIniFile
INI oIni FILE cIni
GET xVar ;
SECTION cSection ;
ENTRY cEntry ;
DEFAULT xDefault ;
OF oIni
ENDINI
RETURN xVar
/*_____________________________________________________________________________*/
Function Save_Control(oCtrl, nRow, nCol,cSection)
SetIni(cIniFile,cSection,"CAPTION",oCtrl:GetText())
SetIni(cIniFile,cSection,"ASSEX",oCtrl:ntop)
SetIni(cIniFile,cSection,"ASSEY",oCtrl:nleft)
SetIni(cIniFile,cSection,"COLORPANE",oCtrl:nclrpane)
SetIni(cIniFile,cSection,"COLORTXT",oCtrl:nclrtext)
SetIni(cIniFile,cSection,"SIZEX",oCtrl:nwidth)
SetIni(cIniFile,cSection,"SIZEY",oCtrl:nHeight)
return nil