autoCode5 then press button local and autoCode5 adds the local definition automatically
Best regards,
Otto



Code: Select all | Expand
#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
#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