Subject Re: Msgbox
From Mustansir Ghor <mustan31@hotmail.com>
Date Sun, 12 Jul 2020 10:55:44 -0400
Newsgroups dbase.getting-started

Dear Andy

Asante Asante Asante Sana

A sunday to feel great

Regards
Mustansir

Andy Taylor Wrote:

> Mustansir,
>
> Used the attached instead.
> The one I posted earlier had the trouble lies ahead line active... doh!
>
> Andy
>
> Andy wrote:
> >
> > I suspect that it executes much more than one time in every case...
> > The attached form shows what you\\\'re dealing with..  I have used the three radiobuttons and the function RBOption which I have made \\\"safe\\\" by commenting out all code.
> > The problem is that radioButton onGotFocus events fire at least twice which the form demonstrates if you click on Rx or Synmed.
> >
> > If you then throw in a messagebox that takes focus away from the radiobutton during the onGotFocus event of the button then you can see that you\\\'re heading for multiple unexpected calls.
> > Just uncomment the new line in RBOption marked trouble lies ahead and resign yourself to having to get out of an endless loop because focus returns to ScriptPro all the time.
> >
> > The solution is not to use the onFocus event of the radiobutton but the onChange event instead.
> >
> > Regards,
> > Andy
> >  
> > > Hi All
> > >
> > > I am somehow facing same problem as Gaetano De Luisi.
> > >
> > > I have following function that gets executed twice, if I select \\\"No\\\" in the msgbox(). For \\\"Yes\\\" option it responds normal that is executes only once.
> > >
> > >   function RBoption()
> > >          if form.qtempsal.rowset.count()>0
> > >           if msgbox(\\\"Current Data will be removed, Are you sure\\\",\\\"Cancel Current Transaction\\\",36)=6
> > >            form.qtempsal.active=false
> > >            form.dlocal.emptytable(\\\"tempsal\\\")
> > >            form.qtempsal.active=true
> > >           endif
> > >          endif
> > >          do case
> > >           case form.rbscript.value or form.rbsynmed.value
> > >            form.qpstore.sql = \\\"select * from pstore where name not in (\\\'Front Store\\\')\\\"
> > >           case form.rbrx.value
> > >            form.qpstore.sql = \\\"select * from pstore where name in (\\\'Safe 1\\\',\\\'Safe 2\\\')\\\"
> > >          endcase  
> > >          form.cbloc.datasource=form.qpstore.rowset.fields[\\\"NAME\\\"]
> > >                  
> > >         return
> > >
> > >
> > > The function is called by following three events which are 3 radio buttons objects
> > >
> > >  function RBRX_onGotFocus()
> > >        form.erx.visible=true
> > >                  class::rboption()
> > >                  ?\\\"Rx\\\"
> > >                  form.escancode.setfocus()
> > >       return
> > >
> > >
> > >    function RBSCRIPT_onGotFocus()
> > >            form.erx.visible=false
> > >       class::rboption()
> > >                 ?\\\"script\\\"
> > >                 form.escancode.setfocus()
> > >       return
> > >
> > >
> > >    function RBSYNMED_onGotFocus()
> > >            form.erx.visible=false
> > >       class::rboption()
> > >                 ?\\\"synmed\\\"
> > >                 form.escancode.setfocus()
> > >                 
> > >       return
> > >
> > > The 3 radio buttons objects are
> > >
> > >   this.RBSCRIPT = new RADIOBUTTON(this)
> > >    with (this.RBSCRIPT)
> > >       onGotFocus = class::RBSCRIPT_ONGOTFOCUS
> > >       height = 1.0909
> > >       left = 10.0
> > >       top = 3.6818
> > >       width = 10.7143
> > >       text = \\\"ScriptPro\\\"
> > >       group = true
> > >       value = true
> > >    endwith
> > >
> > >    this.RBSYNMED = new RADIOBUTTON(this)
> > >    with (this.RBSYNMED)
> > >       onGotFocus = class::RBSYNMED_ONGOTFOCUS
> > >       height = 1.0909
> > >       left = 24.0
> > >       top = 3.6818
> > >       width = 10.7143
> > >       text = \\\"SynMed\\\"
> > >    endwith
> > >
> > >    this.RBRX = new RADIOBUTTON(this)
> > >    with (this.RBRX)
> > >       onGotFocus = class::RBRX_ONGOTFOCUS
> > >       height = 1.0909
> > >       left = 37.0
> > >       top = 3.6818
> > >       width = 5.7143
> > >       text = \\\"Rx\\\"
> > >    endwith
> > >
> > >
> > > I do not know if there is problem with msgbox or radio buttons events
> > >
> > > Any assistance on this as 3 hrs of debugging could not help.
> > >
> > > Regards
> > > Mustansir
> >
> >
>
>