Try running the code below. It creates a form and adds all the various types of baseclass controls to it. Then it adds a grid and adds a column for each control type. For each control it adds tooltips and custom mouse pointers.

 

Move your mouse over the various controls.

 

Notes:

“OleControl” won’t work because it needs more information (the control type, like TreeView or Web Control) and puts up a dialog. I tried using SYS(2335) to suppress User Interface, but that won’t work in design time, where there must be UI (otherwise how do you interact with it?). Other baseclasses don’t work because they don’t have the right properties (like “Empty” and “Collection’)

 

I noticed that I couldn’t change the forecolor of the columnheader. A little investigation (MSDN docs) reveals that the color changes only if Windows XP Visual Styles is turned off. With them enabled, the header is drawn by Windows, and not Fox.

 

CLEAR ALL

CLEAR

 

nFields=ALANGUAGE(aa,3)

ADEL(aa,27) && remove OleControl because it prompts user with dialog

nFields=nFields-1

LIST MEMORY LIKE aa

 

PUBLIC oForm as Form

oForm=CREATEOBJECT("Myform")

oForm.left=50

oForm.AllowOutput= .F.

oForm.Height=400

oForm.width=MIN(SYSMETRIC(1)-oForm.left,1900)   && my screen is 2048 X 1536

oForm.Themes= .F. && so header color works

oForm.visible=1

nCnt=0

nWidth=80

nPerLine=12

nHeight=50

cPicPath=HOME()+"graphics\cursors\"

nCurs=ADIR(aCurs,cPicPath+"*.cur")

 

CREATE CURSOR foo (name c(10))

COPY STRUCTURE EXTENDED TO t.dbf

*!*   USE t

*!*   LIST STRUCTURE

*!*   RETURN

USE t EXCLUSIVE

ZAP

 

FOR i =1 TO nFields

      INSERT INTO t (field_name,field_type,field_len,field_dec,field_null) values;

            ("fld"+TRANSFORM(i),"C",3,0,.t.)

ENDFOR

*Use Null because Null can be valid controlsource for control

CREATE foo FROM t

INSERT INTO foo (fld1,fld2) VALUES ("One",null)

INSERT INTO foo (fld1,fld2) VALUES ("Two",null)

 

GO TOP

 

FOR i = 1 TO nFields

      TRY

            nCnt=i-1    && start at 0

            oForm.AddObject("ox"+TRANSFORM(nCnt),aa[i])    

            ox=EVALUATE("oForm.ox"+TRANSFORM(nCnt))

            WITH ox

                  .top=INT(nCnt / nPerLine)*nHeight

                  .left=(nCnt% nPerLine)*nWidth

                  .Height=nHeight

                  .Width=nWidth

                  .ToolTipText=TRANSFORM(i)+" "+aa[i]

                  .visible=1

                  .MousePointer=99

*                 .MouseIcon=cPicPath+"4way03.cur"

                  .MouseIcon=cPicPath+aCurs[1+nCnt% nCurs,1]

                 

            ENDWITH

      CATCH TO oEx

            oForm.AddObject("lbl"+TRANSFORM(nCnt),"Label")

            oLbl=EVALUATE("oForm.lbl"+TRANSFORM(nCnt))

            WITH oLbl as Label

                  .top=INT(nCnt / nPerLine)*nHeight

                  .left=(nCnt% nPerLine)*nWidth

                  .Height=nHeight

                  .Width=nWidth

                  .ToolTipText=TRANSFORM(i)+" "+aa[i]

                  .ForeColor=255

                  .Caption=aa[i]

                  .visible=1

            ENDWITH

            ?i,aa[i],oEx.message

      ENDTRY

ENDFOR

?"Now grid"

oForm.addobject("oG","Grid")

WITH oForm.oG as Grid

      .ColumnCount=nFields

      .top=200

      .width=oForm.width

      .visible=1

      .Anchor=15

      FOR i = 1 TO nFields

            oCol=EVALUATE(".Column"+TRANSFORM(i))

            WITH oCol as Column

                  .Sparse=.f.

                  .Header1.ToolTipText=TRANSFORM(i)+" "+aa[i]

                  .Header1.caption=aa[i]

                  TRY

                        .addobject("ox",aa[i])

                        .CurrentControl="ox"

                        .ox.visible=1

                        .ox.ToolTipText=TRANSFORM(i)+" "+aa[i]

                        .ox.mousepointer=99

                        .ox.MouseIcon=cPicPath+aCurs[1+i% nCurs,1]

*                       .ox.MouseIcon=cPicPath+"4way05.cur"

                  CATCH TO oEx

                        TRY

                              oCol.Header1.Forecolor=255    && doesn't work if themes off

                              oCol.Header1.FontItalic=.t.

                              oCol.Header1.FontBold=.t.

                        CATCH

                        ENDTRY

                        ?i,aa[i],oEx.message

                  ENDTRY

            ENDWITH

      ENDFOR     

ENDWITH

 

DEFINE CLASS MyForm AS Form

      ShowTips=.t.

ENDDEFINE