Subject Msgbox
From Mustansir Ghor <mustan31@hotmail.com>
Date Sun, 12 Jul 2020 00:28:30 -0400
Newsgroups dbase.getting-started

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