Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I want to write code by hacking form
Message
From
22/04/2008 16:11:10
 
 
To
18/04/2008 12:28:03
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01311701
Message ID:
01312488
Views:
22
you suggestions helped me to do what i was expected . thank you.
for exemple vista doesn't activate the title bar of forms.
Sergey Berezniker corrected it with this code in the init of the form :

activate window (this.name) in screen noshow

the problem , if you have about 400 forms in the project you will spend all time.

this is the code to do that.
set safety off
dimension tab(1)
set memowidth to 300

*** look for forms directory
xl=getdir()
close databases all
set exclusive on

xlp=xl+"*.scx"
xx=adir(tabb,xlp)

for i=1 to xx
   xform=fullpath(tabb(i,1))
   wait window nowait xform + "[ "+alltrim(str(i))+" / "+alltrim(str(xx))+" ]"
   use (xform) in 0

   xtab=juststem(alltrim(xform))
   select (xtab)
   locate for lower(baseclass)="form"
   if found()
      xcode=lower(alltrim(methods))
      xlig=atcline("procedure init",xcode)
   
      if xlig=0	&& no code in init then ad code
     
         text TO xcodinit NOSHOW
PROCEDURE init
*** for form caption with vista
ACTIVATE WINDOW (THIS.Name) IN SCREEN NOSHOW
thisform.refresh
ENDPROC
         ENDTEXT
         xcode=xcode+xcodinit
      else
         **there code in init so insert it
         xdeb=""
         store 0 to _mline             && Reset _MLINE to zero
         xnb=atcline("procedure init",xcode)

         for count = 1 to xnb && Loop for # of lines in memo field
            xl= mline(xcode, 1, _mline)      && Display each line
         next
         xdeb=xdeb+substr(xcode,1,_mline)
         xcode=substr(xcode,_mline+1)

         text TO xcodinit NOSHOW
*** for form caption with vista
activate window (this.name) in screen noshow
thisform.refresh
***
         ENDTEXT
         xdeb=xdeb+xcodinit

         if !empty(xdeb)
            xcode=xdeb+xcode
         endif
      endif

      select (xtab)
      replace methods with xcode
   endif
endfor

close databases all
if xx>0
 compile form *.scx
endif
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform