Jump to content

Recommended Posts

I knew there was somthing like fileOpenDialog. Thanks

Been playing with it how do you refresh the GuiScreen so that it display the value of the varible in the Input box. I have this so far..

Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)
GuiCreate($Customer, 392,243,-1, -1 , 0x04CF0000)
WinActivate ( $Customer )

$OldDBPath =  GUISetControl("input", $Data, 90, 10, 130, 25)
  GUISetControl("label", "OldDBPath", 20, 10, 60, 20)
    
$Browse1 =  GUISetControl("button", "Browse", 230, 10, 40, 25)


    
  GUISetControl("label", "NewDBPath", 20, 60, 60, 20)
$NewDBPath =  GUISetControl("input", "", 90, 60, 130, 25)

$Apply =  GUISetControl("button", "Update", 210, 190, 80, 40)

  GUISetControl("button", "Exit", 300, 190, 80, 40)

While 1

$N=GuiMsg ()

    IF  GuiRead($N)="Exit" Then Exit

    IF  GuiRead($N)="Browse" Then
  $data = FileOpenDialog("Browse", "C:\Windows\", "Images (*.jpg;*.bmp)", 1 + 4 )
  Endif
    
    IF  $N=18 Then ExitLoop
  

WEND
GUIHide()
Link to post
Share on other sites

Just take the result of your FileOpenDialog command and feed it to the edit box. I've created a small example with a read-only edit field that displays the selection, and a browse button that will update the edit field with the selection:

$ES_READONLY = 0x0800
Opt("GUINotifyMode", 1)

GuiCreate("Example", 300, 40)
  $box = GuiSetControl("input", "", 0, 0, 300, 20, $ES_READONLY)
  $browse = GuiSetControl("button", "browse", 0, 20, 150, 20)
  $exit = GuiSetControl("button", "exit", 150, 20, 150, 20)
GuiShow()

While 1
  $n = GuiMsg()
  Select
    Case $n = $browse
      $file = FileOpenDialog("Choose a file", "", "All (*.*)", 1)
      If @error Then ContinueLoop
      GuiWrite($box, 0, $file);set the text to the chosen file
    Case $n = $exit
      Exit
  EndSelect
WEnd

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to post
Share on other sites

Another note: in your code you tested the return of the GuiMsg command against a number. This is a bad idea since the numbers won't always be the same. It's a much better method to test it agains the return of the GuiSetControl call. That way you can be sure you have the correct control number.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...