Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - howto handle browse folder,open,save dialog
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

howto handle browse folder,open,save dialog

 Post Reply Post Reply
Author
Message
Developerx View Drop Down
Groupie
Groupie


Joined: 03 March 2011
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote Developerx Quote  Post ReplyReply Direct Link To This Post Topic: howto handle browse folder,open,save dialog
    Posted: 13 June 2012 at 7:05pm

Hello all,

I was just in a mode to share some tips howto use CJ commondialog

3 important things i found after testing open with cj commondialog filters, parenthwnd, and capture if user click cancel instead of OK.

1. important use the parentHWND, look in code ; )
2. Capture if user press cancel , look in code
3. FILTERS , oh those filter often messed up but look in code for using many of them

----------------------------------------------------------------------------------

' EXAMPLE
'Create 2 buttons, with .caption ...
'name them  cmdbrowseinput and   cmdbrowseouputdir
'add flatedit1 and flatedit2

' EXAMPLE how to choose a file
Private Sub cmdbrowseinput_Click()
Dim whataction As Long
Dim filex As String

'important else function correct
CommonDialog1.ParentHwnd = Me.hWnd
'set filters
CommonDialog1.Filter = "html (.html)|.html|" & "htm (*.htm)|*.htm|" _
& "text (*.txt)|*.txt|" & "JPEG (*.jpg)|*.jpg|" & "ALL (*.*)|*.*|"

whataction = CommonDialog1.ShowOpen
filex = CommonDialog1.FileName 'this must come after showsave
If whataction = 2 Then
Me.Caption = "Cancel..."
Else
Me.Caption = "Ready"
'send result to flatedit1
FlatEdit1.Text = filex
End If

End Sub

'Example howto browsefolder correct
Private Sub cmdbrowseouputdir_Click()
Dim whataction As Long
Dim filex As String

CommonDialog1.ParentHwnd = Me.hWnd
whataction = CommonDialog1.ShowBrowseFolder
filex = CommonDialog1.FileName 'this must come after showsave
' Me.Caption = CommonDialog1.FileName


If whataction = 2 Then
Me.Caption = "Cancel..."
Else
Me.Caption = "Ready"
FlatEdit2.Text = filex
End If

End Sub


Example in use

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.140 seconds.