Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Editable grid control, like Excel, in a dialog
#1
Is it possible to include an excel block as a control in a dialog ?

I am looking to create an editable grid...
#2
Possible if you have Office ActiveX controls installed. An example is in one of recent forum topics.

Also there are many grid controls on the Internet. I tried several free controls in the past. Some are ActiveX controls, some not.

Inside QM I use a grid control that I created using SysListView32 as base control. Several are used in Options, one in accessible object event logging dialog. Supports editing, check boxes, combo boxes, buttons. It also can be used in macros, but not in exe.
#3
There is a freeware com SCGrid. Looks nice. I was unable to load it into a dialog.
Can you please show me a barebone dialog with this component. I will take it on from there.

Much appreciated !


Attached Files
.zip   SCGrid.zip (Size: 165.75 KB / Downloads: 436)
#4
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

typelib prjSCGrid {28FDFE2B-68C4-11D4-92BF-8364E6807441} 13.8

if(!ShowDialog("DlgSCGrid" &DlgSCGrid 0)) ret

;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ActiveX 0x54000000 0x0 8 8 176 82 "prjSCGrid.SCGrid"
;END DIALOG
;DIALOG EDITOR: "" 0x2010700 "*" ""


ret
;messages
sel message
,case WM_INITDIALOG
,prjSCGrid.SCGrid sc3._getcontrol(id(3 hDlg))
,;sc3._setevents("sc3___SCGrid")
,
,ARRAY(VARIANT) a.create(2 2)
,a[0 0]="a"; a[1 0]="b" ;;first row
,a[0 1]="c"; a[1 1]="d"
,sc3.LoadFromArray(a -1)
,sc3.RowMode(2)=3 ;;editable
,
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

At first register it using the type libraries dialog or some other method.
#5
I registered the control in Windows but keep getting "cannot load type library" in QM ??

Also, if I use the .ocx path and typelib it, then LoadFromArray shows as an invalid function.
#6
The code is for scgrid version 13.8. Your scgrid version is 4.1. It also does not have LoadFromArray function. But 13.8 grid also is much bigger - 868 KB. If you want to use 4.1, replace the type library declaration and remove LoadFromArray line.
#7
Well...I was able to get my hands on ver 6.01 which has LoadFromArray.
So, I am able to display/edit the grid and capture events now. Just a quick question on the same :
1. Which function of this control will display the column titles...they come up just blank
2. There is a font member function in it. How do I assign a font that I create using the following :

Code:
Copy      Help
;/
function $font [size] [weight];;weight: 400 is normal

dll gdi32 #GetObject hgdiobj cbBuffer !*lpvObject
def SYSTEM_FONT 13

LOGFONT lf
GetObject(GetStockObject(SYSTEM_FONT) sizeof(LOGFONT) &lf)
lf.lfPitchAndFamily=0
lf.lfWidth=0
if(size) lf.lfHeight=-MulDiv(size GetDeviceCaps(GetDC(0) LOGPIXELSY) 72)
else lf.lfHeight=0
lf.lfWeight=weight
strncpy(&lf.lfFaceName font 31)

ret CreateFontIndirect(&lf)
#8
Code:
Copy      Help
,stdole.StdFont f._create
,f.Name="Courier New"
,f.Underline=-1
,sc3.Font=f

---

Strange but Text property does not work with data cells but works with headers.

Code:
Copy      Help
,sc3.CaptionEnabled=-1
,sc3.Text(0 0)="A"
,sc3.Text(0 1)="B"
#9
Where to get SCGrid 13.8???
#10
Download current version and replace the typelib line. Should work.


Forum Jump:


Users browsing this thread: 1 Guest(s)