I suspected it might be an old bug, but I’m restricted to the IUP and Lua 
versions associated with the software for which I’m writing plugins – at least 
I have a workaround which might help others who encounter the same issue.

 

Helen

 

From: Antonio Scuri <antonio.sc...@gmail.com> 
Sent: 21 April 2019 15:49
To: IUP discussion list. <iup-users@lists.sourceforge.net>
Subject: Re: [Iup-users] Dialogs Callback SHOW_CB and CLOSE_CB seem to be 
interfering with each other

 

  Hi,

 

  I changed your sample just to add more print info, and it is working here. 
See attached. I suspect this could be an old bug already fixed in previous 
versions. IUP 3.11.2 has more than 4 years now...

 

  Here is the output:

 

D:\tecgraf\iup\bin\Win64\Lua51>lua5.1 \Downloads\close_show.lua

SHOW_CB state=0

CLOSE_CB

SHOW_CB state=4

destroy

 

Best,

Scuri

 

 

Em qui, 18 de abr de 2019 às 13:53, <helen.wri...@atiras.com 
<mailto:helen.wri...@atiras.com> > escreveu:

I have a dialog with both close_cb and show_cb defined. Environment is Windows 
10, Lua 5.1, IUP 3.11.2 (I can’t upgrade).

 

When the Dialog is closed using the Close Window X, the sequence of events is:

 

close_cb

show_cb (with state = 4)

 

The last line dlg:destroy() is never executed so it appears the dialog is not 
destroyed although it is no longer visible.

 

Removing the show_cb callback allows close_cb to work as it should.

 

What am I doing wrong?

 

==========Sample code below ==================

 

 

 

require( "iuplua" )

vbox = iup.vbox { iup.label {title="Label"}, iup.button { title="Test" } }

dlg = iup.dialog{vbox; title="Dialog"}

dlg.show_cb = function(self, state)

   if state == iup.SHOW then

          print(state) –content of the function is callback to the bug; it just 
has to exist

   end

end

dlg.close_cb = function()

   return iup.CLOSE

end

dlg:show()

if (iup.MainLoopLevel()==0) then
  iup.MainLoop()
end
dlg:destroy()

 

_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net <mailto:Iup-users@lists.sourceforge.net> 
https://lists.sourceforge.net/lists/listinfo/iup-users

_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to