autoCode5 – the timesaver

autoCode5 – the timesaver

Postby Otto » Thu Sep 24, 2009 2:52 pm

autoCode5 stays in foreground - you can copy & past during coding your local variables to
autoCode5 then press button local and autoCode5 adds the local definition automatically

Best regards,
Otto

Image

Image

Image

Code: Select all  Expand view
#include "FiveWin.ch"
#include "TestMemo.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oGet
   local cText   :=  ""  

   SET _3DLOOK ON

   DEFINE DIALOG oDlg RESOURCE "MEMOEDIT"  Title "autoCode5"

   REDEFINE GET oGet VAR cText MEMO ID ID_MEMO OF oDlg

   oGet:bGotFocus = { || oGet:SetSel( 0, 0 ),;
                         oGet:Goto( oGet:GetLineCount() ),;
                         __Keyboard( Chr( VK_END ) ) }

   REDEFINE BUTTON ID 4002 OF oDlg ACTION ( cText :=  Setlocal( cText ), oGet:refresh() )
    REDEFINE BUTTON ID 4001 OF oDlg ACTION ( cText := "" , oGet:refresh())
   
   ACTIVATE DIALOG oDlg CENTERED ON INIT ( SetWindowPos( oDlg:hWnd, -1, 0, 0, 0, 0, 3 )  )

return nil
//----------------------------------------------------------------------------//

function Setlocal( cText )
    local cTextNew  := ""
    local cLine  := ""
    local nFrom  := 0


      while nFrom < Len( cText )
         cLine = ExtractLine( cText, @nFrom )
         
         if UPPER(left(ALLTRIM(cLine),1)) =  "C"
            cTextNew := cTextNew + "local " + cLine + '  := "" ' + CRLF
         elseif UPPER(left(ALLTRIM(cLine),1)) =  "N"
            cTextNew := cTextNew + "local " + cLine + +  '  := 0' + CRLF
         else
            cTextNew := cTextNew + "local " + cLine + CRLF
         endif
         
         SysRefresh()
      end
 
return ( cTextNew )
//----------------------------------------------------------------------------//


rc-file

Code: Select all  Expand view
#include "..\include\WinApi.ch"
#include "TestMemo.ch"

MEMOEDIT DIALOG DISCARDABLE 18, 18, 187, 113
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU
CAPTION "MemoEditing"
FONT 8, "Arial"
BEGIN
  CONTROL "", 110, "Edit", ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 4, 6, 180, 85
  CONTROL "Clear", 4001, "Button", WS_TABSTOP, 52, 96, 45, 15
  CONTROL "local", 4002, "Button", WS_TABSTOP, 4, 96, 45, 15
END
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: autoCode5 – the timesaver

Postby Antonio Linares » Sat Oct 17, 2009 8:49 pm

Otto,

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: autoCode5 – the timesaver

Postby toninhofwi » Sun Oct 18, 2009 12:40 am

Very interesting, thank you.

Toninho.
toninhofwi
 
Posts: 172
Joined: Tue Oct 18, 2005 10:01 am

Re: autoCode5 – the timesaver

Postby Otto » Tue Mar 30, 2010 8:09 am

AuoCod5 - Smallest Toolbox for Fivewin

... now with new functionality

You can now easily reformat your code.

Best regards,
Otto


Image


Code: Select all  Expand view
#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oGet
   local cText   :=  ""  

   SET _3DLOOK ON

   DEFINE DIALOG oDlg RESOURCE "MEMOEDIT"  Title "autoCode5"

   REDEFINE GET oGet VAR cText MEMO ID 110 OF oDlg

   oGet:bGotFocus = { || oGet:SetSel( 0, 0 ),;
                         oGet:Goto( oGet:GetLineCount() ),;
                         __Keyboard( Chr( VK_END ) ) }
   
   
    REDEFINE BUTTON ID 4003 OF oDlg ACTION ( cText := f_format( cText ), oGet:refresh() )
   REDEFINE BUTTON ID 4002 OF oDlg ACTION ( cText := Setlocal( cText ), oGet:refresh() )
    REDEFINE BUTTON ID 4001 OF oDlg ACTION ( cText := "" , oGet:refresh())
   
   ACTIVATE DIALOG oDlg CENTERED ON INIT ( SetWindowPos( oDlg:hWnd, -1, 0, 0, 0, 0, 3 )  )

return nil
//----------------------------------------------------------------------------//

function Setlocal( cText )
    local cTextNew  := ""
    local cLine  := ""
    local nFrom  := 0


      while nFrom < Len( cText )
         cLine = ExtractLine( cText, @nFrom )
         
         if UPPER(left(ALLTRIM(cLine),1)) =  "C"
            cTextNew := cTextNew + "local " + cLine + '  := "" ' + CRLF
         elseif UPPER(left(ALLTRIM(cLine),1)) =  "N"
            cTextNew := cTextNew + "local " + cLine + +  '  := 0' + CRLF
         else
            cTextNew := cTextNew + "local " + cLine + CRLF
         endif
         
         SysRefresh()
      end
 
return ( cTextNew )
//----------------------------------------------------------------------------//

function f_format( cText )
    local cTextNew  := cText

        cTextNew :=  STRTRAN(cTextNew, "*", " * " )
        cTextNew :=  STRTRAN(cTextNew, "-", " - " )
        cTextNew :=  STRTRAN(cTextNew, " - >", "->" )
       
        cTextNew :=  STRTRAN(cTextNew, ":=", " := " )
        cTextNew :=  STRTRAN(cTextNew, "(", "( " )
        cTextNew :=  STRTRAN(cTextNew, ")", " )" )
       
        cTextNew :=  STRTRAN(cTextNew, "[", "[ " )
        cTextNew :=  STRTRAN(cTextNew, "]", " ]" )
       
        cTextNew :=  STRTRAN(cTextNew, ",", ", " )
        cTextNew :=  STRTRAN(cTextNew, " ,", "," )
       
        cTextNew :=  STRTRAN(cTextNew, "  " , " " )
        cTextNew :=  STRTRAN(cTextNew, "   " , " " )
       
        cTextNew :=  STRTRAN(cTextNew, " ,", "," )
       
        cTextNew :=  STRTRAN(cTextNew, "(  )", "()" )
       
        SysRefresh()

return ( cTextNew )
//----------------------------------------------------------------------------//
 


rc-file

Code: Select all  Expand view

#include "..\include\WinApi.ch"
#include "TestMemo.ch"

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

MEMOEDIT DIALOG DISCARDABLE 18, 18, 187, 113
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU
CAPTION "MemoEditing"
FONT 8, "Arial"
{
  CONTROL "", 110, "Edit", ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 4, 6, 180, 85
  CONTROL "Clear", 4001, "Button", WS_TABSTOP, 136, 96, 45, 15
  CONTROL "local", 4002, "Button", WS_TABSTOP, 4, 96, 45, 15
  CONTROL "Format", 4003, "Button", WS_TABSTOP, 60, 96, 50, 14
}

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: autoCode5 – the timesaver

Postby Otto » Thu Apr 22, 2010 10:49 pm

AutoCode5 with a new feature
Sometimes during designing a new dialog/window I add values to the coordinates.
Now AutoCode can sum these values.
Best regards,
Otto

Image

Image

Image

Code: Select all  Expand view
function f_calc (cText)                                                                    
   local nTemp    := 0                                                                    
   local cTextNew := ""                                                                    
   local cLine    := ""                                                                    
   local nFrom    := 0                                                                    
*----------------------------------------------------------                                
   while nFrom < Len( cText )                                                              
      cLine = ALLTRIM( ExtractLine( cText, @nFrom ) )                                      
      if len(alltrim(cLine)) > 0                                                          
         nTemp  := ( &cLine )                                                              
         cTextNew := cTextNew + "  " + ALLTRIM( str(nTemp ) ) + "  " + CRLF                
      endif                                                                                
      SysRefresh()                                                                        
   end                                                                                    
                                                                                           
return ( cTextNew )                                                                        
                                                                                           
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: autoCode5 – the timesaver

Postby MdaSolution » Fri Apr 23, 2010 6:56 am

Good Mr Otto,
But where I can found testmemo.ch ? thanks
FWH .. BC582.. xharbour
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: autoCode5 – the timesaver

Postby Otto » Fri Apr 23, 2010 7:55 am

Best regards,
Otto
rc-file

Code: Select all  Expand view
#include "c:\FWH\include\winapi.ch"

MEMOEDIT DIALOG DISCARDABLE 18, 18, 187, 134
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU
CAPTION "MemoEditing"
FONT 8, "Arial"
{
  CONTROL "", 110, "Edit", ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 4, 6, 180, 85
  CONTROL "Clear", 4001, "Button", WS_TABSTOP, 136, 96, 45, 15
  CONTROL "local", 4002, "Button", WS_TABSTOP, 4, 96, 45, 15
  CONTROL "Format", 4003, "Button", WS_TABSTOP, 60, 96, 50, 14
  CONTROL "Calc", 4004, "Button", WS_TABSTOP, 60, 112, 50, 14
}

 


prg-file

Code: Select all  Expand view

#include "FiveWin.ch"
#include "autocod5.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oGet
   local cText   :=  ""  

   SET _3DLOOK ON

   DEFINE DIALOG oDlg RESOURCE "MEMOEDIT"  Title "autoCode5"

   REDEFINE GET oGet VAR cText MEMO ID ID_MEMO OF oDlg

   oGet:bGotFocus = { || oGet:SetSel( 0, 0 ),;
                         oGet:Goto( oGet:GetLineCount() ),;
                         __Keyboard( Chr( VK_END ) ) }
 
 
  REDEFINE BUTTON ID 4004 OF oDlg ACTION ( cText := f_calc( cText ), oGet:refresh() )
  REDEFINE BUTTON ID 4003 OF oDlg ACTION ( cText := f_format( cText ), oGet:refresh() )
   REDEFINE BUTTON ID 4002 OF oDlg ACTION ( cText := Setlocal( cText ), oGet:refresh() )
  REDEFINE BUTTON ID 4001 OF oDlg ACTION ( cText := "" , oGet:refresh())
 
   ACTIVATE DIALOG oDlg CENTERED ON INIT ( SetWindowPos( oDlg:hWnd, -1, 0, 0, 0, 0, 3 )  )

return nil
//----------------------------------------------------------------------------//

function Setlocal( cText )
  local cTextNew  := ""
  local cLine  := ""
  local nFrom  := 0


      while nFrom < Len( cText )
         cLine = ExtractLine( cText, @nFrom )
         
         if UPPER(left(ALLTRIM(cLine),1)) =  "C"
          cTextNew := cTextNew + "local " + cLine + '  := "" ' + CRLF
         elseif UPPER(left(ALLTRIM(cLine),1)) =  "N"
          cTextNew := cTextNew + "local " + cLine + +  '  := 0' + CRLF
         elseif left(ALLTRIM(cLine),1) =  "a"
          cTextNew := cTextNew + "local " + cLine + +  '  := {}' + CRLF
         else
          cTextNew := cTextNew + "local " + cLine + CRLF
         endif
         
         SysRefresh()
      end
 
return ( cTextNew )
//----------------------------------------------------------------------------//

function f_format( cText )
  local cTextNew  := cText

    cTextNew :=  STRTRAN(cTextNew, "*", " * " )
  //  cTextNew :=  STRTRAN(cTextNew, "-", " - " )
    cTextNew :=  STRTRAN(cTextNew, " - >", "->" )
   
    cTextNew :=  STRTRAN(cTextNew, ":=", " := " )
    cTextNew :=  STRTRAN(cTextNew, "(", "( " )
    cTextNew :=  STRTRAN(cTextNew, ")", " )" )
   
    cTextNew :=  STRTRAN(cTextNew, "[", "[ " )
    cTextNew :=  STRTRAN(cTextNew, "]", " ]" )
   
    cTextNew :=  STRTRAN(cTextNew, ",", ", " )
    cTextNew :=  STRTRAN(cTextNew, " ,", "," )
    cTextNew :=  STRTRAN(cTextNew, " ;", ";" )
   
    cTextNew :=  STRTRAN(cTextNew, "  " , " " )
    cTextNew :=  STRTRAN(cTextNew, "   " , " " )
   
    cTextNew :=  STRTRAN(cTextNew, " ,", "," )
   
    cTextNew :=  STRTRAN(cTextNew, "(  )", "()" )
   
    cTextNew :=  STRTRAN(cTextNew, "  " , " " )
   
    SysRefresh()

return ( cTextNew )
//----------------------------------------------------------------------------//

function f_calc (cText)
   local nTemp    := 0
   local cTextNew := ""
   local cLine    := ""
   local nFrom    := 0
*----------------------------------------------------------
   while nFrom < Len( cText )
      cLine = ALLTRIM( ExtractLine( cText, @nFrom ) )
      if len(alltrim(cLine)) > 0
         nTemp  := ( &cLine )
         cTextNew := cTextNew + "  " + ALLTRIM( str(nTemp ) ) + "  " + CRLF
      endif
      SysRefresh()
   end

return ( cTextNew )
//----------------------------------------------------------------------------//

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 85 guests