[Gambas-user] re turn value from a form

Rolf-Werner Eilert eilert-sprachen at ...221...
Wed Jan 7 13:49:02 CET 2009


kobolds schrieb:
> in order to get  return value from a form , I create a variable in the form
> 
> in ftest
> public retun_value as boolean =false
> 
> public sub btnOK_click()
>  return_value = true
>  me.close
> end
> 
> public sub btncancel_click()
>   return_value = false
>   me.close
> end
> 
> --------------------------------
> from Fmain 
> public sub btnTest_click()
>  dim m_ftest = new ftest
>  m_ftest.showmodal
>  if m_ftest.return_value = false then
>     ......
>  endif 
> end
> 
> when I run I get error object not found on "if m_ftest.return_value = false
> then"  . my guess is after the ftest close , the ref memory also gone . this
> shouldn't be happen like this right ?
> 
> 

Why don't you do it just the other way round: Make a public variable in 
FMain, write the value into it from ftest before it's closed, so the 
value will still be in the variable within FMain after closing. Or did I 
get you wrong somehow?

This way:



' in ftest:

  public sub btnOK_click()
   FMain.return_value = true
   me.close
  end

  public sub btncancel_click()
    FMain.return_value = false
    me.close
  end
 >
 > --------------------------------
' in FMain
public retun_value as boolean =false

  public sub btnTest_click()
   dim m_ftest = new ftest
   m_ftest.showmodal
   if return_value = false then
      ......
   endif
  end





More information about the User mailing list