FAQ [Controls] |
On this page are placed the answers to questions which I cruelly (or easy) found, I do not think, that the answers are exhausting, and if you will find, that something not conform to your representations, let's discuss and we shall find the best decisions... Besides frequently answer can depend on the version as OS and Visual FoxPro, to check up all on all versions and platforms for me simply excessively. Initially this list was only for VFP 5.0, while now it only VFP 7.0/8.0, I could somewhere and miss a mention of the version, and if you will find discrepancies, inform me, please. |
Q: How to return the value numerical code from ComboBox with two fields (symbolical name, numerical code) for record with numerical field in the table, i.e. when the given tables for ComboBox are subordinated of some parental table with a numerical code field?а
Q: How I can display the subordinated set of records in Grid for some record in the parental table, if a source of the data for Grid is View?а
Q: How to add CheckBox and ComboBox as displayed elements of columns in Grid?а
Q: I would like on click of the mouse on heading of a column Grid to change an active index at a source. To change the index is carried out, but I thus lose the current record. How I need to make, that the record the after changed of an index remained former?а
LOCAL lnRecNo lnRecNo = IIF(!EOF(), RECNO(), 0) ThisForm.DataEnvironment.cursor1.Order = "Column_Order" *-- or SET ORDER TO TAG Column_Order WITH This.Parent.Parent .ActivateCell(1, .ActiveColumn) IF lnRecNo # 0 GO (lnRecNo) ELSE GO TOP ENDIF .Refresh() ENDWITHSee also "PRB: Incremental Search with Grid Causes Screen Flicker" in MSDN
Q: At me the record in Grid does not deleted, explain please, as I should make it correctly.а
... WITH ThisForm IF VARTYPE(.ActiveControl) = "O"; AND .ActiveControl.BaseClass == "Grid"; AND !INLIST(CURSORGETPROP("Buffering"), 4, 5); AND !.ActiveControl.DeleteMark *-- Grid with DeleteMark = .F. and buffering record has a problem *-- at delete of record, it is necessary temporarily *-- to establish property DeleteMark = .T. LOCAL loGrid loGrid = .ActiveControl loGrid.DeleteMark = .T. ENDIF ENDWITH lnRecNo = RECNO() DELETE llError = !TABLEUPDATE(.T.) IF TYPE("loGrid") = "O" loGrid.DeleteMark = .F. ENDIF ...See also: http://support.microsoft.com/kb/q191641/
Q: How in object Grid to remove (to hide from the screen), and later to restore, on a former place, column (object Column)? Thus, it is necessary that at removal column was replaced with the right column.а
WITH This.Parent IF .Visible .Visible = .F. .Width = 0 ELSE .Visible = .T. .Width = 75 && -- or former size ** -- from the previously created array-property of your form ENDIF ENDWITH
Q: I want to add the data in ComboBox, so to have two columns, I do not have joined(attached) source of the data, the data I would like to add from the program, but at me nothing it turns out. How it can be made?а
Q: I place on the form ActiveX-components ImageList and add to it Images. I place on the same form of ActiveX-components Toolbar. I put in it the reference on ImageList and then I complete editing Toolbara. I open it again, but reference - none. What do with it?а
#DEFINE tbrDefault 0 #DEFINE tbrCheck 1 #DEFINE tbrButtonGroup 2 #DEFINE tbrSeparator 3 #DEFINE tbrPlaceholder 4 #DEFINE tbrDropDown 5 #DEFINE MAXBUTTONS 2 LOCAL lcCurKey, loButton, lnCntImg, lnCntBtn lnCntImg = 0 WITH ThisForm.MyToolbar1.Object .ImageList = ThisForm.MyImageList.Object WITH .Buttons FOR lnCntBtn = 1 TO MAXBUTTONS lnCntImg = lnCntImg+1 lcCurKey = SYS(2015) .Add(,lcCurKey) loButton = .Item(.Count) WITH loButton .Image = lnCntImg * ... etc ENDWITH loButton = NULL ENDFOR ENDWITH ENDWITHPay attention on two moments:
Q: It's impossible at me call UDF in ControlSource of a column Grid in the form.а
Q: I want to show value of a memo-field of the table in a column Grid, however at me the word Memo is mapped only, and I need value. How it can be made?а
Q: I want a multiple-line headers of columns in Grid. What it is possible to make?а
Q: In application I use ActiveX control, I create distribution by using VFP Setup Wizard. After installation on the customer I receive an error: OLE error code 0x80040112: Appropriate license for this class not found. Whether it is possible to overcome it?а
Q: I have Windows NT, I try to do printing from RichTextBox Control, but it's not possible from CommonDialog Control to receive device context hDC property to transmit to first (in method SelPrint). In other words: whether it is possible to introduce an information from RichTextBox Control to printing?а
#DEFINE C_DRVNAME "winspool" DECLARE LONG CreateDC IN Gdi32.dll ; STRING @ lpszDriver, ; &&// driver name STRING @ lpszDevice, ; &&// device name STRING @ lpszOutput, ; &&// not used; should be NULL STRING @ lpInitData &&// optional printer data LOCAL nCntPrn LOCAL ARRAY laPrinters[1,2] nCntPrn = APRINTERS(laPrinters) IF nCntPrn = 0 RETURN .F. ENDIF LOCAL lcPrinter, lhDC lcPrinter = laPrinters[1,1] lhDC = CreateDC(C_DRVNAME, lcPrinter, NULL, NULL) IF lhDC = 0 RETURN .F. ENDIF ThisForm.Olecontrol1.Object.SelPrint(lhDC) CLEAR DLLSC_DRVNAME as I have understood from MSDN CreateDC() for Windows 95/98 there should be NULL. However at me NT too, and therefore "winspool"
Q: Whether I somehow can insert Internet Explorer into the VFP-form?а
#DEFINE C_URL "http://vfpdmur.narod.ru/" &&- Insert your URL here RELEASE ox PUBLIC ox ox = CreateObject("MyInternetExplorer") IF TYPE('ox') = 'O' AND !ISNULL(ox) WITH ox .oWeb.Navigate(C_URL,,"_self") IF !.Visible .Visible = .T. ENDIF ENDWITH ELSE MESSAGEBOX("Error in CreateObject('MyInternetExplorer')", 16, 'Error') ENDIF DEFINE CLASS MyInternetExplorer AS form ADD OBJECT oWeb AS CWebExp Caption = "My Internet Explorer" PROCEDURE Init WITH ThisForm .Width = SYSMETRIC(21)*3/4 .Height = SYSMETRIC(22)*3/4 .Resize() ENDWITH ENDPROC PROCEDURE Resize ThisForm.oWeb.resize() ENDPROC ENDDEFINE DEFINE CLASS CWebExp AS olecontrol OleClass = "Shell.Explorer" PROCEDURE Resize WITH This .Width = ThisForm.Width - 1 .Height = ThisForm.Height - 1 ENDWITH ENDPROC PROCEDURE Refresh NODEFAULT ENDPROC ENDDEFINE
Q: The h-file with definition of constants for Excel 2000 is necessary Where it is possible to take?а
Q: SelectOnEntry on MouseClick for TextBox how to do?а
Q: It is impossible to use DayBold() in ActivX Comctl2.MonthView.2, returns "Function argument value, type, or count is invalid (Error 11)". How to overcome?а
WITH ThisForm.Olecontrol1.Object FOR lnCnt = 1 TO 42 .DayBold(TTOC(.VisibleDays(lnCnt))) = .T. ENDFOR ENDWITH
а |