ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Forum AtoutFox : Re: toolbar et .exe /.app   

Sujet

rss Flux RSS des derniers messages

Vous devez vous identifier pour pouvoir poser une question ou répondre.

lun. 01 octobre 2012, 06h38
Jean à Grenoble
atoutfox.public.association

Re: toolbar et .exe /.app


dans l'activate de la form modale j'ai ce code

DODEFAULT()
IF ISNULL(ThisForm.otoolbarech) && jme 06/10/2010
   * jme 15/12/2010 toolbar calcul échéances
   ThisForm.otoolbarech = NULL && on efface éventuellement la toolbar déjà en place
   ThisForm.otoolbarech = NEWOBJECT("calc_echeances", "eleves_standard.vcx", "",-1, -1, ThisForm)
   ThisForm.otoolbarech.visible = .T.
   ThisForm.otoolbarech.enabled = .T.
   ThisForm.otoolbarech.SetAll("enabled", .T.) && jme 26/09/2012 pour essai
   ThisForm.otoolbarech.show()
ENDIF && ISNULL(ThisForm.otoolbarech)



le code de la toolbar (que je met en pièce jointe); la table pfmcfhlp sert àernregistrer les préférences de chaque opérateur pour chaque form; ici onn'enregistre que la position.

**************************************************
*-- Class Library:  d:\mau\profess9\eleves9\atoufox.vcx
**************************************************


**************************************************
*-- Class:        calc_echeances (d:\mau\profess9\eleves9\atoufox.vcx)
*-- ParentClass:  toolbar
*-- BaseClass:    toolbar
*-- Time Stamp:   10/01/12 06:31:01 AM
*
DEFINE CLASS calc_echeances AS toolbar


     Caption = "calcul des échéances possibles"
     Height = 82
     Left = 0
     Top = 0
     Width = 348
     ShowWindow = 1
     Themes = .F.
     *-- pointeur sur l'appelant de  cette toolbar
     oorigine = .NULL.
     *-- valeur initiale de This.top
     topini = 0
     *-- veleur initiale de This.left
     leftini = 0
     *-- RECNO() de la ligne correspondante dans la table des positions pfmcfhlp
     pfmcfhlprecno = 0
     Name = "calc_echeances"


     ADD OBJECT lblvaleur AS label WITH ;
         AutoSize = .T., ;
         FontBold = .T., ;
         FontSize = 11, ;
         BackStyle = 0, ;
         Caption = "valeur ", ;
         Height = 20, ;
         Left = 5, ;
         Top = 3, ;
         Width = 51, ;
         Name = "lblvaleur"


     ADD OBJECT txtvaleur AS textbox WITH ;
         FontBold = .T., ;
         FontSize = 11, ;
         Alignment = 3, ;
         Value = 0.00, ;
         Height = 23, ;
         InputMask = "99 999.99", ;
         Left = 55, ;
         Margin = 0, ;
         Top = 3, ;
         Width = 79, ;
         Name = "txtvaleur"


     ADD OBJECT separator1 AS separator WITH ;
         Top = 3, ;
         Left = 141, ;
         Height = 0, ;
         Width = 0, ;
         Name = "Separator1"


     ADD OBJECT lblech AS label WITH ;
         AutoSize = .T., ;
         FontBold = .T., ;
         FontSize = 11, ;
         Caption = "Nbre échéances ", ;
         Height = 20, ;
         Left = 141, ;
         Top = 3, ;
         Width = 122, ;
         Name = "lblech"


     ADD OBJECT spnech AS spinner WITH ;
         FontBold = .T., ;
         FontSize = 11, ;
         Height = 24, ;
         InputMask = "9", ;
         KeyboardHighValue = 4, ;
         KeyboardLowValue = 1, ;
         Left = 262, ;
         Margin = 0, ;
         SpinnerHighValue =   4.00, ;
         SpinnerLowValue =   1.00, ;
         Top = 3, ;
         Width = 53, ;
         Value = 3, ;
         Name = "spnech"


     ADD OBJECT separator2 AS separator WITH ;
         Top = 34, ;
         Left = 5, ;
         Height = 0, ;
         Width = 0, ;
         Name = "Separator2"


     ADD OBJECT lblresultat AS label WITH ;
         FontBold = .T., ;
         FontSize = 13, ;
         Alignment = 2, ;
         Caption = "saisissez une valeur et un nombre", ;
         Height = 22, ;
         Left = 5, ;
         Top = 34, ;
         Width = 308, ;
         Name = "lblresultat"


     *-- calcul !
     PROCEDURE calcul
         LOCAL lnvaleur1, lnvaleur2, lnval, lnnbech

         lnval = This.txtvaleur.value
         lnnbech = This.spnech.Value
         lnvaleur2 = INT(m.lnval / m.lnnbech)
         lnvaleur1 = m.lnvaleur2 + m.lnval - (m.lnvaleur2 * m.lnnbech)
         This.lblresultat.Caption = ALLTRIM(TRANSFORM(m.lnvaleur1, m.pict8p2))+ ;
          IIF(m.lnnbech>1, " puis "+ CHR(47+m.lnnbech)+ " fois "+ALLTRIM(TRANSFORM(m.lnvaleur2, m.pict8p2)), "")
     ENDPROC


     PROCEDURE Destroy
         This.Visible = .F.
         IF This.topini>-1 AND This.leftini>-1 AND USED("pfmcfhlp")
             IF This.Top <> This.topini OR This.Left <> This.leftini
               IF This.pfmcfhlprecno >0 && jme 03/02/2012
                   LOCAL lnselect, lnrecno
                     lnselect = SELECT(0)
                   SELECT pfmcfhlp
                   lnrecno = RECNO()
                   GO This.pfmcfhlprecno
                   REPLACE posxhg WITH This.Top, posyhg WITH This.left
                   GO m.lnrecno
                   SELECT (m.lnselect)
               ENDIF && This.pfmcfhlprecno >0
             ENDIF && This.Top <> This.topini OR This.Left <> This.leftini
         ENDIF && PCOUNT()>2 AND VARTYPE(m.poform)="O"
         RETURN .T.
     ENDPROC


     PROCEDURE Init
         * jme 06/10/2010
         LPARAMETERS pntop AS Number, pnleft AS Number, poform AS Object
         * jme 15/12/2010 si pntop=-1 et pnleft = -1 et si on passe un pointeur sur
         * la form appelante dans poform, alors on cherche (et on enregistrera,
         * les coordonnées de la toolbar dans la table pfmcfhlp
         LOCAL lnselect

         DODEFAULT()
         This.pfmcfhlprecno = 0 && jme 03/02/2012
         IF PCOUNT()>2 AND VARTYPE(m.poform)="O" AND m.pntop=-1 AND USED("pfmcfhlp")
             lnselect = SELECT(0)
           SELECT pfmcfhlp
           IF SEEK(PADR("cech"+m.poform.name,50) + m.poform.operateur_traitant+"C"+ ;
            m.poform.parametre, "pfmcfhlp", "pafo")
             STORE posxhg TO This.Top, This.topini
             STORE posyhg TO This.Left, This.leftini
             This.pfmcfhlprecno = RECNO()
           ELSE
             STORE m.poform.height/2 TO This.Top, This.topini
             STORE m.poform.width - This.Width TO This.Left, This.leftini
             INSERT INTO pfmcfhlp VALUES ("cech"+m.poform.name,m.poform.operateur_traitant, ;
              "C", m.poform.parametre, 0,0, This.Top, This.Left, ;
              "", 0, .F., .F., .F., .F., .F., 0, 0, 0, 0, 0, 0, 0, "", "5", "4","3", "2", "1", ;
              1, 1, 3, 2, 1, .T., .F., {}, {}, DATETIME(), {})
             This.pfmcfhlprecno = RECNO()
           ENDIF && SEEK(PADR(.name,50) + .operateur_traitant)
           SELECT (m.lnselect)
         ELSE
             This.left = MAX(1, m.pnleft)
             * This.left = _screen.Width - This.Width -10
             This.top = MAX(1, m.pntop)
           STORE -1 TO This.topini, This.leftini
         ENDIF && PCOUNT()>2 AND VARTYPE(m.poform)="O"
         This.Visible = .T.
     ENDPROC


     PROCEDURE txtvaleur.InteractiveChange
         This.Parent.calcul()
         DODEFAULT()
     ENDPROC


     PROCEDURE spnech.InteractiveChange
         This.Parent.calcul()
         DODEFAULT()
     ENDPROC


ENDDEFINE
*
*-- EndDefine: calc_echeances
**************************************************


Bonne journée à tous

Jean à Grenoble

Permalink : http://www.atoutfox.org/nntp.asp?ID=0000009844
20 286 messages dans le forum • Liste complète des messages

www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2026.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3