Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Display filenames with double click opening the file
Message
From
19/09/2005 07:01:15
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01050800
Message ID:
01050802
Views:
24
Thanks,
But what I am looking for is visible if you create new form in outllok and add an attachemnt to it.
You'll see a hyperlink in the attachment control with an icon and the filename next to it.
That's what I want to accomplish <g>

Peter

>>Hi
>>i need to display filenames on a screen with the capability of double clicking on the filename which in turn should open the file like outlooks attachment control
>>
>>can that be done in VFP?
>>
>>Thanks
>>
>>Peter
>
>Yes it is. But you must decide what control you will use to display filenames: TreeView, Grid, ListBox?
>Here a simple code (w/o any error handling, just the idea how to do it:
>
>oForm = CREATEOBJECT("Form1")
>oForm.Show()
>READ EVENTS
>
>
>**************************************************
>*-- Form:         form1 (d:\all_zapl\test.scx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   09/19/05 01:16:07 PM
>*
>DEFINE CLASS form1 AS form
>
>
>    Top = 0
>    Left = 0
>    Height = 620
>    Width = 635
>    DoCreate = .T.
>    Caption = "Form1"
>    Name = "Form1"
>
>
>    ADD OBJECT olecontrol1 AS olecontrol WITH ;
>        Top = 26, ;
>        Left = 16, ;
>        Height = 390, ;
>        Width = 308, ;
>        OleClass = "MSComctlLib.TreeCtrl.2",;
>        Name = "Olecontrol1"
>
>
>    ADD OBJECT grid1 AS grid WITH ;
>        ColumnCount = 1, ;
>        Height = 193, ;
>        Left = 13, ;
>        Panel = 1, ;
>        Top = 423, ;
>        Width = 437, ;
>        Name = "Grid1", ;
>        Column1.Width = 397, ;
>        Column1.Name = "Column1"
>
>
>    ADD OBJECT list1 AS listbox WITH ;
>        Height = 390, ;
>        Left = 336, ;
>        Top = 26, ;
>        Width = 284, ;
>        Name = "List1"
>
>
>    ADD OBJECT command1 AS commandbutton WITH ;
>        Top = 433, ;
>        Left = 467, ;
>        Height = 27, ;
>        Width = 84, ;
>        Caption = "Get folder", ;
>        Name = "Command1"
>
>
>    PROCEDURE shellexec
>        LPARAMETERS lcFileName
>        IF .NOT. EMPTY(lcFileName) .AND. NOT EMPTY(SYS(2000,lcFileName))
>           DECLARE INTEGER ShellExecute IN SHELL32.DLL INTEGER nWinHandle,;
>                                                       STRING cOperation,;
>                                                       STRING cFileName,;
>                                                       STRING cParameters,;
>                                                       STRING cDirectory,;
>                                                       INTEGER nShowWindow
>            result = ShellExecute(0, 'Open', ALLTRIM(lcFileName) , '', '', 1)
>            DO CASE
>               CASE result ==  0         && The system is out of memory or resources.
>                    msg = "The system is out of memory or resources"
>               CASE result ==  2         && Bad Association (for example, invalid URL)
>                    msg = "Bad Association (for example, invalid URL)"
>               CASE result == 29         && Failure to load application
>                    msg = "Failure to load application"
>               CASE result == 30         && Application is busy
>                    msg = "Application is busy "
>               CASE result == 31         && No application association
>                    msg = "No application association for" + JUSTEXT(lcFileName)+" file types"
>           ENDCASE
>           IF INLIST(result, 0, 2, 29, 30, 31)
>              MessageBox(msg, 0 + 64, "View")
>           ENDIF
>        ENDIF
>    ENDPROC
>
>
>    PROCEDURE Load
>        CREATE CURSOR GridRowSource (FileName C(50))
>    ENDPROC
>
>    PROCEDURE Init
>        BINDEVENT(thisform.Grid1.Column1.Text1,"DblClick",thisform,"GridDblClick")
>    ENDPROC
>
>    PROCEDURE olecontrol1.DblClick
>        *** ActiveX Control Event ***
>        IF this.SelectedItem.Key # "MAINFOLDER_TREE"
>           thisform.ShellExec(this.SelectedItem.Text)
>        ENDIF
>    ENDPROC
>
>
>
>    PROCEDURE list1.DblClick
>        thisform.ShellExec(this.Value)
>    ENDPROC
>
>    PROCEDURE GridDblClick
>        thisform.ShellExec(GridRowSource.FileName)
>    ENDPROC
>
>    PROCEDURE command1.Click
>        LOCAL lcFolderName, lnFileNum, lnCount
>        lcFolderName = ADDBS(GETDIR([],[Open],[Select folder to open],64))
>        IF NOT EMPTY(lcFolderName)
>           lnFileNum = ADIR(laFiles,lcFolderName+[*.*])
>           thisform.Olecontrol1.Nodes.Clear()
>           thisform.Olecontrol1.Nodes.Add(,1,"MAINFOLDER_TREE",lcFolderName)
>           thisform.List1.Clear()
>           SELECT GridRowSource
>           ZAP
>           thisform.Grid1.Refresh()
>           FOR lnCount = 1 TO lnFileNum
>               thisform.Olecontrol1.Nodes.Add("MAINFOLDER_TREE",4,TRANSFORM(lnCount)+"_",lcFolderName + laFiles[lnCount,1])
>               thisform.List1.AddItem(lcFolderName +laFiles[lnCount,1])
>               INSERT INTO GridRowSource VALUES (lcFolderName + laFiles[lnCount,1])
>          NEXT
>          thisform.List1.ListIndex = 1
>          SELECT GridRowSource
>          GO TOP
>          thisform.Olecontrol1.SelectedItem =  thisform.Olecontrol1.Nodes([1_])
>          thisform.Refresh()
>        ENDIF
>    ENDPROC
>
>    PROCEDURE DESTROY
>        UNBINDEVENTS(thisform.Grid1.Column1.Text1)
>        CLEAR EVENTS
>    ENDPROC
>
>ENDDEFINE
>*
>*-- EndDefine: form1
>**************************************************
>
Peter Cortiel
Previous
Reply
Map
View

Click here to load this message in the networking platform