MOVE a SAY CONTROL

MOVE a SAY CONTROL

Postby Silvio.Falconi » Thu Sep 26, 2013 11:24 am

I create a control and I can move with design clausole
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





 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: MOVE a SAY CONTROL

Postby MaxP » Thu Sep 26, 2013 1:30 pm

You can try these changes

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", @cImpresa ),;
                                            Save_Control(oSay[1], nRow, nCol,"IMPRESA")}
    RETURN NIL

    FUNCTION LabelInspect( oCtrl, nRow, nCol, cSection, cImpresa)
     local oMenu
       MENU oMenu POPUP
     MENUITEM "&CAPTION" ACTION (EditTitle( oCtrl, @cImpresa ),;
                                        SetIni(cIniFile,cSection,"Caption",oCtrl:GetText()))
     ENDMENU
     ACTIVATE MENU oMenu AT nRow, nCol OF oCtrl
    RETURN NIL



     static function EditTitle( oWnd, cImpresa )

       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 (cImpresa:=oGet:GetText(),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    
 


Saluti
Massimo
User avatar
MaxP
 
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm

Re: MOVE a SAY CONTROL

Postby Silvio.Falconi » Thu Sep 26, 2013 2:36 pm

thanks you massimo , are you a new user ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: MOVE a SAY CONTROL

Postby MaxP » Thu Sep 26, 2013 2:44 pm

No,
I am a user of Fivewin since 1998
User avatar
MaxP
 
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 95 guests