UEStudio and a FIVEWIN EXE to edit source code

UEStudio and a FIVEWIN EXE to edit source code

Postby Otto » Sat Aug 16, 2008 10:03 pm

video:

http://www.atzwanger.com/FWHRAD/FWHRAD.html

I did some test using a UEStudio macro to start a Fivewin program to edit source code with input screens.
Regards,
Otto
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Sun Aug 17, 2008 8:40 am

Dear Otto,

Very good :-)

Could you explain how to create those macros in uestudio ? Thanks!
regards, saludos

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

Postby Otto » Sun Aug 17, 2008 4:05 pm

I am working on a FWH RAD light tool.

This should become a two way tool.

- First you could select from a toolbox a control and insert command syntax into your source code.

Image

- Second you could mark a bit of source code and then a window pops up and you can insert and select “menu driven” attributes belonging to this control.

Image


At the moment I only have TWindow working. Please see the code maybe someone will help to get the other controls ready. If someone take a control to work on please post here.

How does the program work?

You select a control in source code which you would like to work on.
With the help of a macro the selected code is copied to a file.
This file then is compiled with the /p switch in an automatic mode. Here I use a FIVEWIN program with a timer. The source code is attached.
The last line of the ppo file has the code of the control.

For example:
oWnd := TWindow():New(,,,, "FWH 8.05 Transparencies",,, oBrush,,,,, 0, "N/W",,, !.F., !.F., !.F., !.F., .F. )

The Fivewin program makes out of this a window to edit the values similar to the attribute window in VB6. <Save> then saves the Fivewin code back in command style to UEStudio with the help of the clipboard.

For the editing dialogs you only have to use the variables from the new method of the corresponding class and the DEFAULT values are also ready declared in the new method.

In UEStudio <macro> <edit macro>
Here you see the macro:

Image




Regards,
Otto

Code: Select all  Expand view  RUN

#include "FIVEWIN.CH"
#INCLUDE "BOX.CH"
#INCLUDE "FILEIO.CH"
#INCLUDE "INKEY.CH"
#include "Splitter.ch"

#define COLOR_WINDOW        5
#define COLOR_WINDOWTEXT    8

static oWnd
//----------------------------------------------------------------------------//

function Main()
   local oTmr
   local aufruf := "BTN"
   local oTree, oItem1, oItem2, oBmp1, oBmp2, oImageList,oSplit
   local cTxt   := ""

   SetBalloon( .T. )

   DEFINE WINDOW oWnd TITLE "FWH RAD" FROM    50,   50 TO  300,  275 PIXEL
   SETWINDOWPOS( oWnd:hWnd, -1, 0, 0, 0, 0, 3 )

   DEFINE TIMER oTmr  INTERVAL 500 ACTION  (oTmr:DeActivate(),;
      oWnd:Say( 10, 17, Time() ), openWin1(aufruf:="TIMER"), oTmr:Activate() ) of oWnd

   oImageList = TImageList():New()

   oBmp1 = TBitmap():Define( "folder",, oWnd )
   oBmp2 = TBitmap():Define( "fldMask",, oWnd )

   oImageList:Add( oBmp1, oBmp2 )

   oTree = TTreeView():New( 2, 0, oWnd )

   oTree:SetImageList( oImageList )

   oItem1 = oTree:Add( "*Classes" )

   oItem1:Add( "TWindow" )
   oItem1:Add( "TActiveX" )
   oItem1:Add( "TBar" )
   oItem1:Add( "TBitmap" )
   oItem1:Add( "TBrush")
   oItem1:Add( "TBtnBmp")
   oItem1:Add( "TButton")
   oItem1:Add( "TButtonBmp")
   oItem1:Add( "TCheckBox")
   oItem1:Add( "TClipBoard")
   oItem1:Add( "TComboBox")
   oItem1:Add( "TCursor")
   oItem1:Add( "TGet")
   oItem1:Add( "TGroup")
   oItem1:Add( "TIcon")
   oItem1:Add( "TImage")
   oItem1:Add( "TImageList")
   oItem1:Add( "TListBox")
   oItem1:Add( "TListView")
   oItem1:Add( "TMdiChild")
   oItem1:Add( "TMdiFrame")

   oItem2 = oTree:Add( "*FWH" )
   oItem2:Add( "TMetaFile")
   oItem2:Add( "TMeter")
   oItem2:Add( "TMsgBar")
   oItem2:Add( "TMsgItem")
   oItem2:Add( "TMultiGet")
   oItem2:Add( "TOutLook2003")
   oItem2:Add( "TProgress")
   oItem2:Add( "TRadMenu")
   oItem2:Add( "TRadio")
   oItem2:Add( "TReBar")
   oItem2:Add( "TSay")
   oItem2:Add( "TScrollBar")
   oItem2:Add( "TStatusBar")
   oItem2:Add( "TTabControl")
   oItem2:Add( "TTimer")
   oItem2:Add( "TToolBar")
   oItem2:Add( "TTrackBar")
   oItem2:Add( "TTreeView")
   oItem2:Add( "TVbControl")
   oItem2:Add( "TWBrowse")
   oTree:Add( "FiveWin power!" )

   oTree:bLDblClick = { ||  (oTmr:DeActivate(),;
      iif(left(oTree:GetSelText(),1) <> "*",;
      (cTxt:= oTree:GetSelText(),openWin1(aufruf := "BTN", cTxt )), ),; 
      oTmr:Activate())}

   @ 29, 200 SPLITTER oSplit ;
      VERTICAL _3DLOOK ;
      PREVIOUS CONTROLS oTree ;
      SIZE 4, 200 PIXEL ;
      OF oWnd

   ACTIVATE TIMER oTmr

   ACTIVATE WINDOW oWnd ;
      ON RESIZE oSplit:AdjClient()

   oTmr:End()

return nil

function openWin1(aufruf,cTxt)
   local cText
   local cDatei         := "c:\TEMP\text.txt"
   local cTxtFile
   local nFrom
   local cLine          := ""
   local cToken         := ""
   local VariablenListe := ""

   if file(cDatei) = .t.  .or. aufruf = "BTN"

      if aufruf = "TIMER"
         cText := "#include 'FiveWin.ch'" + CRLF + memoread(cDatei)
         FERASE (cDatei)

         memowrit("datei.prg",cText)
         waitrun ("clipper.exe datei.prg /p", 0 )

         cTxtFile = MemoRead( "datei.ppo" )

         nFrom = 1
         while nFrom < Len( cTxtFile )
            cLine = ExtractLine( cTxtFile, @nFrom )
            SysRefresh()
         end
         cToken  := StrToken( cline,2,':' )
         cToken  := STRTRAN(cToken,"=","")

         //oWnd := TWindow():New(,,,, "Timers",,,,,,,,,,,, !.F., !.F., !.F., !.F., .F. )

         cline  := STRTRAN(cline, 'Upper("NONE")' ,'"NONE"')
         cline  := STRTRAN(cline, 'Upper("SINGLE")' ,'"SINGLE"')

         VariablenListe :=  '"' + cToken +   '", "'+ ALLTRIM(StrToken( cline,1,':' ) ) + '",' +;
            StrToken( cline,3,'(' )

      endif

      if aufruf = "BTN"
         VariablenListe := ")"
         cToken:= ALLTRIM(cTxt) + "()"
      endif

      IF ALLTRIM(cToken)="TWindow()"
         msginfo(VariablenListe)

         & ("edit_TWindow(" + VariablenListe)

      else
         msginfo("not supported " + CRLF + cline)
      ENDIF
   endif

return nil

function TextToClip(;
      nTop, nLeft, nBottom, nRight, cTitle, nStyle, oMenu,;
      oBrush, oIcon, coWnd, lVScroll, lHScroll, nClrFore, nClrBack,;
      oCursor, cBorder, lSysMenu, lCaption, lMin, lMax, lPixel,oParent )

   local oClp
   local cText := ;
      "DEFINE WINDOW " + ALLTRIM(coWnd) + " ; " + CRLF  + ;
      "FROM  " + str(nTop) + ", " + STR(nLeft) + " TO " + STR(nBottom) + ", " + STR(nRight) +" ; " + CRLF + ;
      'TITLE "' + ALLTRIM(cTitle) + '" ; ' + CRLF

   if len(ALLTRIM(oBrush))>0
      cText :=  cText + "BRUSH " + ALLTRIM(oBrush) + "  ; " + CRLF
   endif

   if len(ALLTRIM(oCursor))>0
      cText :=  cText + "CURSOR " + ALLTRIM(oCursor) + "  ; " + CRLF
   endif

   if len(ALLTRIM(oMenu))>0
      cText :=  cText + "MENU " + ALLTRIM(oMenu) + "  ; " + CRLF
   endif

   if len(ALLTRIM(oIcon))>0
      cText :=  cText + "ICON " + ALLTRIM(oIcon) + "  ; " + CRLF
   endif

   if len(ALLTRIM(oParent))>0
      cText :=  cText + "OF " + ALLTRIM(oParent) + "  ; " + CRLF
   endif

   if lVScroll =.t.
      cText :=  cText + "VSCROLL " + " ; " + CRLF
   endif

   if lHScroll =.t.
      cText :=  cText + "HSCROLL " + " ; " + CRLF
   endif

   if nClrFore > 0 .or. nClrBack > 0
      cText :=  cText + "COLORS " + str(nClrFore) + " , " + str(nClrBack) + "  ; " + CRLF
   endif

   if lPixel =.t.
      cText :=  cText + "PIXEL " + " ; " + CRLF
   endif

   if len(ALLTRIM(cBorder))>0
      cText :=  cText + "BORDER " + cBorder + "  ; " + CRLF
   endif

   // cText :=  cText +   "<HelpId: HELPID, HELP ID> <nHelpId>  ; " + CRLF +;

   if nStyle > 0
      cText :=  cText + "STYLE " + str(nStyle) + "  ; " + CRLF
   endif

   if lSysMenu = .t.
      cText :=  cText + "NOSYSMENU " + " ; " + CRLF
   endif

   if lCaption =.t.
      cText :=  cText + "NOCAPTION " + " ; " + CRLF
   endif
   if lMin =.t.
      cText :=  cText + "NOICONIZE " + " ; " + CRLF
   endif
   if lMax =.t.
      cText :=  cText + "NOMAXIMIZE " + " ; " + CRLF
   endif

   // "MDICHILD  ; " + CRLF + ;

   cText := ALLTRIM(cText)

   cText := left(cText, (len(cText)-4))

   DEFINE CLIPBOARD oClp OF oWnd
   oClp:Clear()
   oClp:SetText( (cText))

return nil


function edit_TWindow(cObjName,coWnd,nTop, nLeft, nBottom, nRight, cTitle, nStyle, oMenu, oBrush, oIcon,;
      oParent, lVScroll, lHScroll, nClrFore, nClrBack, oCursor, cBorder, lSysMenu,;
      lCaption, lMin, lMax, lPixel)
   local odlg
   local oGet
   local aBorder := {" ","NONE" , "SINGLE" }

   DEFAULT nTop     := 2, nLeft := 2, nBottom := 20, nRight := 70,;
      lVScroll := .f., lHScroll := .f.,;
      nClrFore := GetSysColor( COLOR_WINDOWTEXT ),;
      nClrBack := GetSysColor( COLOR_WINDOW ),;
      nStyle   := 0,;
      cBorder  := "SINGLE", lSysMenu := .t., lCaption := .t.,;
      lMin     := .t., lMax := .t., lPixel := .f., cTitle := "..."

   cTitle:=cTitle + space(150)

   DEFINE DIALOG oDlg RESOURCE "FENSTER"

   REDEFINE GET oGet VAR  coWnd         ID 4002 of oDlg
   REDEFINE GET oGet VAR  cTitle        ID 4009 of oDlg

   REDEFINE GET oGet VAR  nTop          ID 4005 of oDlg PICTURE("9999")
   REDEFINE GET oGet VAR  nLeft         ID 4006 of oDlg PICTURE("9999")
   REDEFINE GET oGet VAR  nBottom       ID 4007 of oDlg PICTURE("9999")
   REDEFINE GET oGet VAR  nRight        ID 4008 of oDlg PICTURE("9999")

   REDEFINE GET oGet VAR  nStyle        ID 4041 of oDlg PICTURE("9999")

   REDEFINE GET oGet VAR  oMenu         ID 4035 of oDlg
   REDEFINE GET oGet VAR  oBrush        ID 4033 of oDlg
   REDEFINE GET oGet VAR  oIcon         ID 4037 of oDlg
   REDEFINE GET oGet VAR  oParent       ID 4038 of oDlg

   REDEFINE CHECKBOX oGet VAR  lVScroll ID 4017 of oDlg
   REDEFINE CHECKBOX oGet VAR  lHScroll ID 4018 of oDlg

   REDEFINE GET oGet VAR  nClrFore      ID 4039 of oDlg
   REDEFINE GET oGet VAR  nClrBack      ID 4040 of oDlg
   REDEFINE GET oGet VAR  oCursor       ID 4034 of oDlg
   REDEFINE COMBOBOX oGet VAR  cBorder   ITEMS aBorder    ID 4027 of oDlg
   REDEFINE CHECKBOX oGet VAR  lSysMenu ID 4028 of oDlg
   REDEFINE CHECKBOX oGet VAR  lCaption ID 4029 of oDlg
   REDEFINE CHECKBOX oGet VAR  lMin     ID 4030 of oDlg
   REDEFINE CHECKBOX oGet VAR  lMax     ID 4031 of oDlg
   REDEFINE CHECKBOX oGet VAR  lPixel   ID 4022 of oDlg
   REDEFINE BUTTONBMP ID IDOK OF oDlg  ACTION (TextToClip(;
      nTop, nLeft, nBottom, nRight, cTitle, nStyle, oMenu,;
      oBrush, oIcon, coWnd, lVScroll, lHScroll, nClrFore, nClrBack,;
      oCursor, cBorder, lSysMenu, lCaption, lMin, lMax, lPixel,oParent ),oDlg:end())

   ACTIVATE Dialog oDlg CENTERED

return nil








Code: Select all  Expand view  RUN
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

FENSTER DIALOGEX DISCARDABLE 6, 18, 350, 290
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION " DEFINE WINDOW"
FONT 8, "MS Reference Sans Serif", 400, 0, 0
BEGIN
  CONTROL "OK", IDOK, "Button", WS_TABSTOP, 284, 4, 45, 15
  CONTROL "Cancel", IDCANCEL, "Button", WS_TABSTOP, 284, 20, 45, 15
  CONTROL " DEFINE WINDOW", 4001, "Static", WS_GROUP, 19, 13, 76, 8
  CONTROL "", 4002, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 89, 11, 52, 12
  CONTROL " MDICHILD", 4003, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 173, 13, 48, 10
  CONTROL "FROM <nTop>, <nLeft> TO <nBottom>, <nRight>", 4004, "Static", WS_GROUP, 26, 68, 176, 8
  CONTROL "", 4005, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 47, 80, 25, 12
  CONTROL "", 4006, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 80, 80, 25, 12
  CONTROL "", 4007, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 125, 80, 25, 12
  CONTROL "", 4008, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 158, 80, 25, 12
  CONTROL "", 4009, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 77, 102, 156, 12
  CONTROL "TITLE", 4010, "Static", WS_GROUP, 37, 102, 40, 8
  CONTROL "BRUSH", 4011, "Static", WS_GROUP, 37, 134, 40, 8
  CONTROL "CURSOR", 4012, "Static", WS_GROUP, 37, 150, 40, 8
  CONTROL "MENU", 4013, "Static", WS_GROUP, 37, 166, 40, 8
  CONTROL "ICON", 4015, "Static", WS_GROUP, 37, 198, 40, 8
  CONTROL "OF", 4016, "Static", WS_GROUP, 37, 118, 40, 8
  CONTROL "VERTICAL SCROLL", 4017, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 58, 36, 84, 10
  CONTROL "HORIZONTAL SCROLL", 4018, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 58, 48, 83, 10
  CONTROL "COLOR", 4019, "Static", WS_GROUP, 35, 224, 28, 8
  CONTROL "<nClrFore>", 4020, "Static", WS_GROUP, 88, 224, 40, 8
  CONTROL "<nClrBack>", 4021, "Static", WS_GROUP, 88, 237, 40, 8
  CONTROL "PIXEL", 4022, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 23, 35, 30, 10
  CONTROL "STYLE", 4023, "Static", WS_GROUP, 24, 256, 40, 8
  CONTROL "HELPID", 4024, "Static", WS_GROUP, 24, 272, 40, 8
  CONTROL "<nHelpId>", 4025, "Static", WS_GROUP, 68, 272, 40, 8
  CONTROL "BORDER", 4026, "Static", WS_GROUP, 143, 138, 40, 8
  CONTROL "", 4027, "ComboBox", WS_BORDER|CBS_DROPDOWNLIST|CBS_SORT|WS_VSCROLL|WS_TABSTOP, 187, 137, 48, 40
  CONTROL "NOSYSMENU", 4028, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 212, 32, 58, 10
  CONTROL "NOCAPTION", 4029, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 212, 44, 52, 10
  CONTROL "NOICONIZE", 4030, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 212, 56, 58, 10
  CONTROL "", 4033, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 77, 134, 40, 12
  CONTROL "", 4034, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 77, 150, 40, 12
  CONTROL "", 4035, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 77, 166, 40, 12
  CONTROL "", 4037, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 77, 198, 40, 12
  CONTROL "", 4038, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 77, 118, 40, 12
  CONTROL "", 4039, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 136, 223, 40, 12
  CONTROL "", 4040, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 136, 236, 40, 12
  CONTROL "", 4041, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 60, 256, 40, 12
  CONTROL "", 4042, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 108, 272, 40, 12
  CONTROL "NoMaximize", 4031, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 212, 68, 48, 10
END

User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby Otto » Sun Aug 17, 2008 6:49 pm

Hello Antonio,

Now I saw the thread about FIVEWIN’s object inspector.

http://forums.fivetechsoft.com/viewtopic.php?t=12187

I think I should better wait for the object inspector before going ahead.
When will this tool be released?
Regards,
Otto
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby Otto » Sun Aug 17, 2008 7:42 pm

Hello Antonio,

I found the code of ObjectInspector.prg.
May I ask you for your help please.
From the ppo file I have all the data which I want to put into the objectInspector.

For example if I mark in the source code the following line and then click on the macro

DEFINE WINDOW oWndlocal TITLE "Object inspector" FROM 10, 10 TO 40, 48

following function is called filled with the values:

Code: Select all  Expand view  RUN
function objectInspector(cObjName,oWnd,nTop, nLeft, nBottom, nRight, cTitle, nStyle, oMenu, oBrush, oIcon, oParent, lVScroll, lHScroll, nClrFore, nClrBack, oCursor, cBorder, lSysMenu, lCaption, lMin, lMax, lPixel)
   local oWndlocal, oBrw

   local aData := { { "A edit", "text",     EDIT_GET },;
                    { "A combobox", "test", EDIT_LISTBOX, { "One", "Two", "Three" } },;
                    { "A dialog", "result", EDIT_BUTTON,  { || MsgYesNo( "Select a value" ) } } }


Could you please suggest a way how bring these variables best into aData ?

Should we have a database for the different objects?

Thanks in advance
Otto


Image
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: Silvio.Falconi and 70 guests