Subject Re: Turn Off Windows Theme
From Mervyn Bick <invalid@invalid.invalid>
Date Mon, 9 Jul 2018 22:07:34 +0200
Newsgroups dbase.getting-started
Attachment(s) set_systemTheme_false.prg

On 2018-07-09 3:42 PM, Michael wrote:
> I wam upgrading all my legacy Visual Dbase 7.5 to Dbase 11 and maybe even Windows 12. The biggest issue I have is that the default setting for all controls is the Windows Theme is set to TRUE and all my buttons are greyed out.
>
> This may not sound like much but I have over 400,000 lines of code with hundreds of forms and buttons and will take me a year to convert them all to FALSE so my software can retail the custom colours and Labels set throughout the software.
>
> How can I turn windows theme off or set DBASE controls to have Windows Theme turns off?
>
> Anyone?

As Rich has suggested a little dBASE program will make short work of
this.  First though you need to create a custom form with the
systemTheme property set false.  Then you need to create a .cc file
containing custom pushbutton, grid and whatever other controls you have
used also with the systemTheme property set false.

****** systemtheme_false.cfm ******
class systemtheme_falseCForm of FORM custom
    with (this)
         systemTheme = false
    endwith
endclass
***********

******** mypb.cc ************
class mypb(parentObj) of PUSHBUTTON(parentObj) custom
        with(this)
        systemTheme = false
        endwith
  endclass

  class mygrid(parentObj) of  GRID(parentObj) custom
        with(this)
        systemTheme = false
        endwith
  endclass

// any other classes you may need
*****************************

The little example program attached only deals with pushbuttons and
grids.  If you change names of the .cfm and .cc files and of the custom
objects you will, of course need to edit the program accordingly.

It goes without saying that you should make sure you have an up-to-date
backup copy of all your source files safely tucked away before you try this.

Mervyn.






_app.allowyieldonmsg = true
aDir = new array()
aDir1 = new array()
aDir1.dir("*.wfm")
for n = 1 to aDir1.size/5
   aDir.add(aDir1[n,1])
next
nFileCount = 0
for n = 1 to aDir.size
     cFileIn = aDir[n]
     cFileOut = "out"+aDir[n]
     if not file("out"+aDir[n])
          nFilecount ++
          fIn = new file()
          fIn.open(cFileIn)
          fOut = new file()
          fOut.create(cFileOut,"RW")
          if n%10 = 0
               ??'*'
          endif
          do while not fIn.eof()
               _app.executemessages()
               cRead = fIn.readln()
               if 'class'$lower(cRead) and 'of form'$lower(cRead)
                    cRead = stuff(cRead,at('of form',lower(cRead)),7,' of systemtheme_falseCform from systemtheme_false.cfm')
                    fOut.puts(cRead)
                    cRead= '       set procedure to mypb.cc  additive'
                    fOut.puts(cRead)            
               elseif  'systemtheme'$lower(cRead) and 'true'$lower(cRead) //will probably never be executed as true is default whch is not streamed out
                    cRead = stuff(cRead,at('true',lower(cRead)),4,'false ')
                    fOut.puts(cRead)          
               elseif 'new pushbutton'$lower(cRead)
                    cRead =  stuff(cRead,at('new pushbutton',lower(cRead)),14,'new mypb ')
                    fOut.puts(cRead)
               elseif 'new grid'$lower(cRead)
                    cRead =  stuff(cRead,at('new grid',lower(cRead)),8,'new mygrid ')
                    fOut.puts(cRead)
                    // add other ontrols as necessary with each one in it's own elseif section.
               else
                    fOut.puts(cRead)
               endif
          enddo
          fIn.close()
          fOut.close()
          new file().delete(cFileIn)
          new file().rename(cFileOut,cFileIn)
     endif
next

?  nFileCount+' .wfm files processed'