[21 Aug 2008] Event after closing the file requester?

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
User avatar
Clyde
Posts: 351
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

[21 Aug 2008] Event after closing the file requester?

Post by Clyde »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 21 Aug 2008 22:21:10 +0200

Hi there!

I have a question: Can my hollywood script somehow recognize, when the file requester that I have opend with "FileRequest()" is being closed? I know, I have a string (empty or not) in the return value, but in order to alter my SCUILib string box I need an event or sth that tells the string box to update its content with the return value of FileRequest().

Thanks a lot in advance!

Greetings Micha
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
Allanon
Posts: 742
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

[22 Aug 2008] Re: Event after closing the file requester?

Post by Allanon »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 22 Aug 2008 07:39:20 -0000

Hi Michael, you don't need an event because the FileRequest will stop the script execution until it is closed, look at this is quick example, I'm assuming that you will use a button to pop-up the file requester, so in your code you have to define a function to link to this button that will pop-up the requester and will update the string box:

Code: Select all

Function PopFileRequester()
     Local temp = FileRequest("Select a file...")
     If temp = "" Then Return
     ; ** That's all you need to update the string box! **
     scui.Set("FileString", { Value = temp }, 1)
EndFunction
After that you need to define the button related to the above function and the stringbox:

Code: Select all

scui.NewObject( #IFOCLASS_BUTTON ,
                 "GetFile_Button",
                 { x = 10, y = 10 },
                 { x = 20, y = 18 },
                 nil,
                 { Values = { "Select a File" }},
                 { OnPushed = PopFileRequester } )

scui.NewObject( #IFOCLASS_STRINGBOX ,
                 "FileString",
                 { x = 10, y = 35 }, { x = 250, y = 18 },
                 nil,
                 { Values = { "-- Empty --" },
                   InputType = #GETKEY_ALL,
                   MaxLen = 255 },
                 { OnChange = PopFileRequester } )
This should work, if I have understood well what you are asking ;)

Regards, Fabio
----------------------------
[Allanon] Fabio Falcucci | GitHub (leaving) | Gitea (my new house) | My Patreon page | All my links
User avatar
Allanon
Posts: 742
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

[22 Aug 2008] Re: Event after closing the file requester?

Post by Allanon »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 22 Aug 2008 07:44:00 -0000

In the StringBox definition remove the event assignment, it's not needed:

{ OnChange = PopFileRequester } and replace it with 'nil'

I've copied right but pasted too much ^^

Fabio
----------------------------
[Allanon] Fabio Falcucci | GitHub (leaving) | Gitea (my new house) | My Patreon page | All my links
User avatar
Clyde
Posts: 351
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

[22 Aug 2008] Re: Re: Event after closing the file requester?

Post by Clyde »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 22 Aug 2008 09:49:16 +0200

Hi Fabio,

thanks a lot! Yeah, you are pretty right! I could have come to this solution as well ... :-/ Sometimes I seem to think too complicated. :-/ But nevertheless, I am really glad that you helped out and it works now. :-)

PS: Have a look at SDB forum ... :-)

Greetings and thanks again, Micha
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
Locked