Page 1 of 1
[21 Aug 2008] Event after closing the file requester?
Posted: Sat Jun 13, 2020 5:31 pm
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
[22 Aug 2008] Re: Event after closing the file requester?
Posted: Sat Jun 13, 2020 5:31 pm
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
[22 Aug 2008] Re: Event after closing the file requester?
Posted: Sat Jun 13, 2020 5:31 pm
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
[22 Aug 2008] Re: Re: Event after closing the file requester?
Posted: Sat Jun 13, 2020 5:31 pm
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