How can I control the call of a window/class within the shellmenu ?
Changing the default button at runtime
Passing more than one parameter to a window
How can I change the layout of the VO-browser ?
How can I enable the horizontal scrollbar in a listbox ?
How can I force a SingleLineEdit-control to gain focus ?
How can I disable the close-button (X) AND Alt-F4 in a Window ?
Using TrashCan to delete files
A function to get all marked items in a listbox as array
How can I scroll programmatically to the top/bottom of a Listview/Listbox ?
How to make a window the topmost window (stay always on top).
Expand the progressbar range beyond WORD value
Highlight the currently selected tab page in a tabcontrol
Double append with DBFCDX-driver
If you habe problems removing libraries( especially bBrowser)
Tips
How can I control the call of a window/class
within the shellmenu
Create a shellwindow method from which you could call your
window/class. Within that method you are able to control the init- and the
show-method, and even pass a parameter.
example:
Method OpenMyWindow class MyShellWindow
Local oWindow as MyWindow
oWindow:=MyWindow{oShell}
//MyWindow{oShell,x} or
oWindow:=MyWindow{oShell,,,x} - for DataWindows, where x could be a
parameter
oWindow show() // or oWindow:show(SHOWZOOMED)
Instead of inserting directly your window-class in your shellmenu, use
this method in your menu.
top
Changing the default button at runtime
I always use these 2 lines at the same time:
oControl:SetStyle(BS_DEFPUSHBUTTON)
SendMessage(Owner:Handle(),DM_SETDEFID,Self:ControlID,0L)
(where Self:ControlID=ID generated by VO)
top
Passing more than one parameter to a window
Use the uExtra variable created by VO and pass an array
Example:
oWindow:=MyWindow{self,aArray} // or oWindow:=MyWindow{self,,,aArray} -
for datawindows
oWindow show()
In the postinit-method pick up that variable:
aMyArray:=uExtra // check also for the existence of uExtra, the length
of the array......
If you don't want to pass the owner as the first parameter (MyWindow{SELF,...},
you can pass SELF as the last parameter:
MyWindow{,,,SELF} in order to know the starting class and react accordingly.
How can I change the layout of the VO-browser ?
You can play around with:
SELF:browser:enableGrid(FALSE) - to hide the grid
CntAttribClear(SELF:browser:handle(),CA_VERTFLDSEP) - to hide the vertical
grid lines
CntRowHtSet(SELF:Browser:handle(),1,0) - to modify the row spacing
top
How can I enable the horizontal scrollbar in a listbox ?
Use this :
cTemp:=Replicate("X",64) // 64 or other value = max length of the
line
SendMessage(SELF:oDCMyListBox:handle(),LB_SETHORIZONTALEXTENT, ;
DWORD(SELF:SizeText(cTemp):Width),0)
InvalidateRect(SELF:oDCMyListBox:handle(),NULL,TRUE)
top
How can I
force a SingleLineEdit-control to gain focus ?
Sometimes, while showing a window, a SingleLineEdit-control does not get
the focus with SetFocus()
Use this to simulate (in a postinit-method) a mouseclick:
PostMessage(SELF:oDCMYSLE:handle(),WM_LBUTTONDOWN,0,0)
PostMessage(SELF:oDCMYSLE:handle(),WM_LBUTTONUP,0,0)
top
How can I disable the close-button (X) AND Alt-F4 in a Window ?
1) In a postinit-method:
LOCAL oSysMenu AS SystemMenu
// disable close menu (X)
oSysMenu:=SELF:EnableSystemMenu(TRUE)
EnableMenuItem(oSysMenu:Handle(),6,_OR(_OR(MF_DISABLED,;
MF_GRAYED),MF_BYPOSITION))
2) Method Dispatch(oEvent) class MyDialog
If oEvent:Message== WM_SYSCOMMAND
If oEvent:wParam==SC_CLOSE
return 1L
Endif
Endif
return SUPER:dispatch(oEvent)
Using TrashCan (poubelle) to delete files
FUNCTION FileDelete(cFile AS STRING) AS LOGIC PASCAL
// suppression d'un fichier -> poubelle
LOCAL struSHFileOpStruct IS _WINSHFILEOPSTRUCT
LOCAL lSuccess AS LOGIC
struSHFileOpStruct.pFrom:=StringAlloc(cFile+_chr(0))
struSHFileOpStruct.wFunc:=FO_DELETE
struSHFileOpStruct.fFlags:=_or(FOF_ALLOWUNDO,FOF_SILENT,;
FOF_NOCONFIRMATION,FOF_FILESONLY)
lSuccess:=(SHFileOperation(@struSHFileOpStruct)=0)
MemFree(struSHFileOpStruct.pFrom)
RETURN lSuccess
A function to get all marked items in a listbox as array
FUNCTION GetMarkedItem (oListBox AS OBJECT) AS ARRAY
LOCAL i,nL AS DWORD
LOCAL aItem AS ARRAY
nl:=oListBox:selectedCount
aItem:=ArrayNew(nL)
IF nL>0
aItem[1]:=oListbox:getItem(oListBox:FirstSelected())
FOR i:=2 UPTO nL
aItem[i]:=oListbox:getItem(oListBox:NextSelected())
NEXT
ENDIF
RETURN aItem
FUNCTION AJoin(a1 AS ARRAY,a2 AS ARRAY) AS ARRAY
* join 2 arrays to one
* usage: AJoin(aTarget,aAdd)
LOCAL nL1,nL2,nL3,x,a AS DWORD
nL1:=ALen(a1)
nL2:=ALen(a2)
nL3:=nL1+nL2
ASize(a1,nL3)
a:=nL1+1 // start for 2nd array
FOR x:=a UPTO nL3
a1[x]:=a2[x-nL1]
NEXT
RETURN a1
FUNCTION aRemove( aTarget AS ARRAY , nPos AS DWORD ) AS ARRAY
// remove one element of an array at nPosition
LOCAL aTemp AS ARRAY
aTemp := AClone( aTarget )
aTemp := ADel( aTemp , nPos )
aTemp := ASize( aTemp , ALen( aTemp ) - 1 )
RETURN aTemp
How can I scroll programmatically to the top/bottom of a Listview/ListBox ?
PostMessage( SELF:oDCMyListView:Handle(), WM_VSCROLL, SB_TOP, 0 )
or
PostMessage( SELF:oDCMyListView:Handle(), WM_VSCROLL, SB_BOTTOM, 0 )
How to make a window the topmost window (stay always on top).
METHOD AlwaysOnTop() CLASS MyWindow
SetWindowPos(SELF:handle(), HWND_TOPMOST, ;
SELF:origin:x, SELF:origin:y,
SELF:size:width, SELF:size:height,0)
RETURN NIL
Expand the progressbar range beyond WORD value
(The standard range is limited to WORD value = 65535)
DEFINE PBM_SETRANGE32:= (WM_USER+6)
CLASS MyProgressBar inherit ProgressBar
ASSIGN Range (oNewRange) CLASS MyProgressBar
SendMessage(SELF:handle(),PBM_SETRANGE32,DWORD(_CAST,oNewRange:min),;
LONG(_CAST,oNewRange:max))
RETURN oRange:=oNewRange
Highlight the currently selected tab page in a tabcontrol
When there are many tab pages in a tabcontrol, the currently selected tab page is not always noticeable.
The current tab page can be highlighted:
add 2 methods and 1 define to your Window-class:
METHOD TabSelectionChanging(oControlNotifyEvent) CLASS
MyClass
SUPER:TabselectionChanging(oControlNotifyEvent)
SendMessage(oControlNotifyEvent:Control:handle(),TCM_HIGHLIGHTITEM,;
TabCtrl_GetCurFocus(oControlNotifyEvent:control:handle()),0L)
RETURN NIL
METHOD TabSelect(oControlNotifyEvent) CLASS MyClass
SUPER:TabSelect(oControlNotifyEvent)
SendMessage(oControlNotifyEvent:Control:handle(),TCM_HIGHLIGHTITEM,;
TabCtrl_GetCurFocus(oControlNotifyEvent:control:handle()),1L)
RETURN NIL
DEFINE TCM_HIGHLIGHTITEM:=(TCM_FIRST+51)
(The variables enclosed in < > are all string variables to define in your module)
local cMsg as String
cMsg:="mailto:"+<Email
adresse>+"?subject="+<Subject>+"&body="+<Text>
ShellExecute(MyWindow:handle(),PSZ("open"),PSZ(cMsg),PSZ(""),PSZ(""),SW_SHOWNORMAL)
Double append with DBFCDX-driver
If you notice a double append (records appear twice after an append, you probably are using structural indexes with a VO generated server.
(structural index: the index name = file name , example: clients.dbf, clients.cdx).
In this case instantiating the dbserver opens already the index and the init() method opens the index a second time.
Change your server.init() method or better, make changes in your cavoded.tpl (cavo..bin directory) in the following way:
locate the line "IF oFSIndex:Find()" and add an if condition:
IF oFSIndex:Find()
IF Empty( SELF:OrderInfo( DBOI_FULLPATH ) ) .or. xDriver= "DBFNTX" <------ add this line
lTemp := SELF:SetIndex( oFSIndex )
ENDIF
ENDIF
If you habe problems removing libraries( especially bBrowser)
Remove the icons from the Application properties and try again.
Happy playing !
Camille Kater
| Visual Objects | |
| Willie Moore | http://www.wmconsulting.com/ |
| Fab's Homepage | http://www.fabtoys.net/ |
| Michael Ferbers Homepage | http://ourworld.compuserve.com/homepages/FerberMichael/ |
| The Visual Objects Knowledge Base (KnowVO) | http://www.knowvo.com/ |
| JR-INFO | http://www.rayonline.com/jrinfo/ |
| Ralf's Homepage | http://www.ralfk.de/ |
| Electric People International - Default Home Page | http://www.electricpeople.com/ |
| Buro de Wilg Software | http://www.wilg.nl/ |
| DataPro | http://www.dproinc.com/ |
| SAS software | http://www.sas-software.nl/ |
| Piko Computing Consultants | http://www.piko.com.au/ |
| VOCAGER GmbH | http://www.vocager.de/ger/index.html |
| Karl Heinz Rauscher | http://people.freenet.de/KHRauscher/ |
| C. Killet Softwareentwicklung | http://www.killetsoft.de/geogr.htm |
| Sven Ebert | http://www.ebertonline.de/ |
| VO tools (Joachim Bieler) | http://www.votools.com/german/index.htm |
| Ivo Wessel | http://www.visual-objects.com |
| Wolgang Riedmann | http://www.riedmann.it/cavo/index.htm |
| SoftwareObjectives | http://www.softwareobjectives.com.au/vo/ |
| Funcky | http://www.funcky.com/Start.Asp |
|
VO and Clipper NewsGroups |
|
| CA-Clipper | comp.lang.clipper |
| CA-VO | comp.lang.clipper.visual-objects |
| Discussion regarding database technologies | comp.databases.theory |
| General database discussions | comp.databases |
|
Other |
|
| API-guide | http://www.allapi.net/ |