You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using FileDialog I would like to handle the event when the user close the dialog through Cancel button or Alt-F4. Basically any way that is not selecting a file. The problem is I cannot find any event that is fired when I close the dialog this way. It is needed so I can set the open state back to false.
How can I handle this use case?
To Reproduce
Sample code
constFileLoader=()=>{const[open,setOpen]=useState(false);constonButtonClick=useEventHandler({clicked: ()=>{setOpen(true);}},[]);constonFileEvent=useEventHandler({// this one work, when the user select a filefileSelected: (file)=>{setOpen(false);console.log(file);},// I tried all of these and none workedfinished: (event)=>{setOpen(false);console.log("close");},accept: ()=>{console.log("accept");},reject: ()=>{console.log("reject");},open: ()=>{console.log("open");},Close: ()=>{console.log("close");}},[]);return(<View><Buttonon={onButtonClick}>Select file</Button><FileDialogopen={open}on={onFileEvent}/></View>);};
Desktop (please complete the following information):
OS: Ubuntu 18.04
NodeGUI version : not directly installed, it is a dependency of React NodeGUI
React NodeGUI version: 0.13.0
React: 17.0.2
The text was updated successfully, but these errors were encountered:
I am debugging the issue and the problem seems to be no event is fired when I close the dialog through Cancel button (logExceptions not called in class EventWidget extends Component_1.Component in node_modules/@nodegui/nodegui/dist/lib/core/EventWidget.js).
Not sure is it related to the #373 issue (another issue of mine)
I'm not sure is it actual right now, but I managed same issue like this
const[files,setFiles]=useState([]);constchooseFileButtonHandler=useEventHandler<QPushButtonSignals>({clicked: ()=>{constfileDialog=newQFileDialog();fileDialog.exec();constselectedFiles=fileDialog.selectedFiles();if(fileDialog.result()!==0){// 0 = user closed the dialog, 1 = user selected filesetFiles(selectedFiles)}}},[]);return(<View><Buttonon={chooseFileButtonHandler}text='Chose file'/></View>);
Describe the bug
When using FileDialog I would like to handle the event when the user close the dialog through Cancel button or Alt-F4. Basically any way that is not selecting a file. The problem is I cannot find any event that is fired when I close the dialog this way. It is needed so I can set the open state back to false.
How can I handle this use case?
To Reproduce
Sample code
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: