Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
SELECT *, LEFT(descr, 64) AS ShortDescr FROM MyCursor ;
INTO CURSOR MyCursor
PUBLIC go_Form
go_Form = CREATEOBJECT("frmForm")
go_Form.Visible = .T.
go_Form.Show
READ Events
CLOSE ALL
CLEAR ALL
RETURN
*********
DEFINE CLASS frmForm As Form
Width = 960
MinWidth = 960
MaxWidth = 960
Height = 450
MinHeight = 450
AutoCenter = .T.
Caption = "Grids - Editbox versus MemoField"
ShowTips = .T.
Themes = .F.
*********
*!* ADD objects with their procedures
ADD OBJECT lblComment as Label WITH ;
Left = 480 + 12, Top = 24, Height = 36, Width = 480 - 24 - 120, AutoSize = .F., ;
Caption = "Change text in the editbox and click on the corresponding" + CHR(13) + ;
"record to see the adopted changes"
ADD OBJECT edtComment as EditBox WITH ;
Left = 960 - 12 - 120, Top = 24, Width = 120, Height = 84, ControlSource = "csrBanks.mComment"
PROCEDURE edtComment.LostFocus()
Replace csrBanks.mComment WITH ALLTRIM(This.Value)
ENDPROC
ADD OBJECT lstBanks AS ListBox WITH ;
Left = 480 + 12, ;
Top = 126, ;
Width = 480 - 24, ;
Height = 450 - 42 - 150, ;
ItemBackColor = RGB(0, 240, 240), ;
RowSourceType = 6, ;
RowSource = "csrBanks.cString, mComment", ;
ColumnCount = 2, ;
ColumnWidths = "330, 48", ;
Anchor = 15
PROCEDURE lstBanks.Click()
ThisForm.edtComment.Value = csrBanks.mComment
ENDPROC
ADD OBJECT grdEBanks as grdBanks
PROCEDURE grdEBanks.Init()
WITH This
.Column1.Header1.Caption = "Name of Bank"
.Column1.Width = 294
.Column1.ReadOnly = .T.
WITH .Column2
.Header1.Caption = "Comments"
.NewObject("edtComments","EditBox")
.edtComments.BackColor = RGB(0, 240, 240)
.edtComments.Visible = .T.
.CurrentControl = "edtComments"
.Width = 120
.Sparse = .F.
ENDWITH
ENDWITH
ENDPROC
ADD OBJECT grdMBanks as grdBanks WITH ;
Top = 204, ;
Anchor = 30, ;
AllowRowSizing = .F., ;
ToolTipText = "Hoover over Memo to read its content"
PROCEDURE grdMBanks.Init()
WITH This
.Column1.Header1.Caption = "Name of Bank"
.Column1.Width = 294
.Column1.ReadOnly = .T.
WITH .Column2
.Header1.Caption = "Comments"
.DynamicFontItalic = "IIF(EMPTY(mComment), .F., .T.)"
.DynamicFontBold = "IIF(EMPTY(mComment), .F., .T.)"
.Width = 120
ENDWITH
ENDWITH
ENDPROC
ADD OBJECT cmdExit As CommandButton WITH ;
Width = 60, Height = 30, Left = 960 - 12 - 60, Top = 450 - 12 - 30, Caption = "Exit", Anchor = 12
PROCEDURE cmdExit.Click()
ThisForm.Release
CLEAR Events
ENDPROC
*!* ADD code to form's methods
PROCEDURE Init()
DODEFAULT()
This.DoBinds()
ENDPROC
PROCEDURE DoBinds()
LOCAL loColumn, loObject
FOR EACH loColumn IN This.grdEBanks.Columns
FOR EACH loObject IN loColumn.Objects
IF loObject.Baseclass == "Header"
UNBINDEVENTS(loObject)
BINDEVENT(loObject, "Click", This, "HeaderClick")
ENDIF
NEXT
NEXT
ENDPROC
PROCEDURE HeaderClick()
LOCAL ARRAY laEvents[1]
*!* AEVENTS(laEvents, 0)
*!* = MESSAGEBOX("Clicked: " + SYS(1272, laEvents[1]), 64, "Clicked Object", 1500)
*!* loObject = laEvents[1]
WITH This.grdEBanks
.RowHeight = 24
ENDWITH
ENDPROC
PROCEDURE Destroy()
ThisForm.cmdExit.Click()
ENDPROC
PROCEDURE Load()
LOCAL lcText as Character
lcText = "This is a " + CHR(13) + "three line " + CHR(13) + "long text"
CREATE CURSOR csrBanks (cString C(60), mComment M)
INSERT INTO csrBanks VALUES ("Crédit Suisse", lcText)
INSERT INTO csrBanks VALUES ("Deutsche Bank", "")
INSERT INTO csrBanks VALUES ("Crédit Lyonnais", "de gustibus et coloribus non est disputandum")
LOCATE
ENDPROC
ENDDEFINE
**********
DEFINE CLASS grdBanks as Grid
Left = 12
Top = 12
Width = 480 - 24
Height = 180
Anchor = 75
GridLines = 2
HeaderHeight = 21
AllowHeaderSizing = .F.
RowHeight = 18
AllowRowSizing = .T.
BackColor = RGB(0, 240, 240)
ColumnCount = -1
RecordSource = "csrBanks"
ToolTipText = "Stretch RowHeight as desired - Click ColumnHeader to reset"
ENDDEFINE
**********
hth
MarK