Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamic Current Control on Grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00274650
Message ID:
00274728
Vues:
32
Thanks to all that helped me come up with the solution. For anyone interested, here's the final code. The large button has a picture of note pad with the word NOTES next to it. The small button just has a picture of the note pad. The "YES" version of the note pad has lines across the page to represent writing and the "NO" version just has a blank page. So it's real obvious to the user whether or not there are any existing notes.

*-- Class Definition of NOTES Button (large)
DEFINE CLASS commandbutton_notes AS commandbutton_
Height = 20
Width = 55
FontSize = 8
Picture = "graphics\notes.bmp"
DisabledPicture = "graphics\notes_dis.bmp"
Caption = ""
TabStop = .F.
r_cfield = ""
r_ccaptionexpr = ""
r_ctitleexpr = ""
r_lallowedit = .T.
r_cyespicture = "graphics\notes.bmp"
r_cnopicture = "graphics\notesno.bmp"
Name = "commandbutton_notes"
r_lforceno = .F.
r_lforceyes = .F.

PROCEDURE Refresh
WITH This
LOCAL l_cFile
l_cFile = LEFT(.r_cField, AT('.', .r_cField)-1)
IF NOT EOF(l_cFile) AND NOT EMPTY(.r_cCaptionExpr)
.Caption = EVALUATE(.r_cCaptionExpr)
ENDIF
.Picture = IIF(EMPTY(EVALUATE(.r_cField)), .r_cNoPicture, .r_cYesPicture)
ENDWITH
ENDPROC

PROCEDURE Click
WITH This
ThisForm.lSkipActivate = .t.
LOCAL l_cField, l_cTitle, l_cEdit, l_cFile
l_cFile = LEFT(.r_cField, AT('.', .r_cField)-1)
IF NOT EOF(l_cFile)
l_cEdit = IIF(.r_lAllowEdit, '', 'NOEDIT')
l_cField = .r_cField
l_cTitle = IIF(EMPTY(.r_cTitleExpr), 'Notes', EVALUATE(.r_cTitleExpr)) + ;
IIF(.r_lAllowEdit, '', ' (Display Only)')
DEFINE WINDOW notes AT 0,0 SIZE 10,60 ;
TITLE l_cTitle ;
SYSTEM CLOSE FLOAT GROW ZOOM NOMINIMIZE ;
FONT 'Arial', 8
MOVE WINDOW notes CENTER
MODIFY MEMO &l_cField &l_cEdit WINDOW notes
RELEASE WINDOW notes
ENDIF
This.Refresh()
ENDWITH
ENDPROC

PROCEDURE Init
DODEFAULT()
WITH This
IF .r_lForceNo
.r_cYesPicture = .r_cNoPicture
.Picture = .r_cNoPicture
ENDIF
IF .r_lForceYes
.r_cNoPicture = .r_cYesPicture
.Picture = .r_cYesPicture
ENDIF
ENDWITH
ENDPROC
ENDDEFINE

*-- Class Definition of NOTES Button (small)
DEFINE CLASS commandbutton_notes_sm AS commandbutton_notes
Width = 21
Picture = "graphics\notes_sm.bmp"
DisabledPicture = "graphics\notes_sm_dis.bmp"
r_cnopicture = "graphics\notesNo_sm.bmp"
r_cyespicture = "graphics\notes_sm.bmp"
Name = "commandbutton_notes_sm"
ENDDEFINE

*-- Definition for the Column in the grid on the form
Column7.FontSize = 8, ;
Column7.ControlSource = "fsiship.notes", ;
Column7.CurrentControl = "cmdNotesYes", ;
Column7.Width = 35, ;
Column7.Sparse = .F., ;
Column7.DynamicCurrentControl = "IIF(EMPTY(fsiship.notes),'CmdNotesNo', 'CmdNotesYes')", ;
Column7.Name = "Column7"

ADD OBJECT junk.grdship.column7.header1 AS header WITH ;
FontSize = 8, ;
Alignment = 2, ;
Caption = "Notes", ;
Name = "Header1"

ADD OBJECT junk.grdship.column7.cmdnotesyes AS commandbutton_notes_sm WITH ;
Top = 40, ;
Left = 45, ;
FontSize = 8, ;
r_cfield = "fsiship.notes", ;
r_lforceyes = .T., ;
Name = "cmdNotesYes"

ADD OBJECT junk.grdship.column7.cmdnotesno AS commandbutton_notes_sm WITH ;
Top = 40, ;
Left = 21, ;
r_cfield = "fsiship.notes", ;
r_lforceno = .T., ;
Name = "cmdNotesNo"
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform