Author Topic: Code-Formatter PB 10  (Read 158591 times)

0 Members and 1 Guest are viewing this topic.

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #45 on: November 17, 2011, 04:53:55 PM »
Hello,
 have now added a new button to do so. Auserd I have some things changed in the source code
 
Hi Paul can not do that in line 770 as the Phoenix overwrites
Code: [Select]
      SetWindowText hWndChild, $TEXTBTN3
      SetWindowText hWndChild, $TEXTBTNFORMAT
      SetWindowText hWndChild, $CANCEL



It had the added in Form1.inc

Code: [Select]
FUNCTION Form1_OnCreate _
  ( _
  BYVAL hWnd        AS DWORD, _ ' window handle
  BYVAL lptcs       AS DWORD, _ ' address of CREATESTRUCT structure
        lMsgResult  AS LONG _   ' value returned to message
  ) AS LONG
  IF LEN(fo.fspecin)= 0 OR LEN(fo.fspecout) = 0 THEN
    Control_Disable GetDlgItem (hWnd, %IDC_FORM1_TEXTBTNFORMAT)

  END IF

  SetWindowText GetDlgItem(hWnd, %IDC_FORM1_TEXTBTN3), $TEXTBTN3
  SetWindowText GetDlgItem(hWnd, %IDC_FORM1_TEXTBTNFORMAT), $TEXTBTNFORMAT
  SetWindowText GetDlgItem(hWnd, %IDCANCEL), $CANCEL



END FUNCTION

regards Peter
« Last Edit: December 26, 2011, 10:21:00 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #46 on: November 17, 2011, 05:11:28 PM »
Peter,

Ok, I thought there was a better/different way but couldn't think of it at the time.
I didn't remember which parts Phoenix overwrites and which parts are user changeable.

Your way is better and opens up the possiblilty to redo ALL the buttons/labels in other languages
if you want to.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #47 on: November 17, 2011, 07:20:56 PM »
Hello,
 've done something a little more fine tuning.
 Program have donated an icon, I've also removed minor bugs in the program.



regards Peter
« Last Edit: December 26, 2011, 10:21:22 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #48 on: November 17, 2011, 08:07:30 PM »
Peter,

I'm seeing something odd in the output file.

No matter which bak option I choose the program doesn't create a bak in my specified directory.
It is ignoring my output directory & file name. Keeps saying that it can't find the file.
Who cares? This file will be WRITTEN.

But it keeps overwriting my input file with the formatted output.
And with it NOT creating a backup  there is a chance that my input file will be lost.

Just found over 60 fmt*.tmp files in my TEMP directory. Why are they still there?




« Last Edit: November 17, 2011, 08:11:02 PM by Paul Elliott »

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #49 on: November 17, 2011, 08:13:35 PM »
Hello Paul
 I also do not like the formatting to 100%, but I can not break, and work simultaneously on one hundred sites. Times tomorrow would only do it with Bak file with time stamp. Was hoping you can help me a bit! Because the formatting is still a huge mistake that I have described two days ago in Forum

 regards Peter

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #50 on: November 17, 2011, 08:20:20 PM »
I have not noticed because the temporary file will look but the morning after

regards Peter

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #51 on: November 17, 2011, 08:41:13 PM »
Something very odd going on here ( maybe some setup on my computer but no clue what  ).

I can not get a msgbox or messagebox to display.
as in
msgbox "some message"
or
MessageBox %NULL,"backup of " & fo.fspecin, "bkup", %MB_OK

I've tried both right after backing up ( remarked out the IF so it always does it )
 and after opening for output.
Nothing shows.

Will switch back to PB WINApi to see if it changes.


Nope, not a hint of a messagebox on screen either way.
Very strange.


« Last Edit: November 17, 2011, 08:47:06 PM by Paul Elliott »

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #52 on: November 17, 2011, 08:47:33 PM »
Try adding %MB_TOPMOST to the flags. Maybe that solves your problem :-).

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #53 on: November 17, 2011, 09:22:32 PM »
Found at least part of the problem.

I was looking in the main BAS file where the DoFormat function is called.

BUT it is also called from over in Form1.inc under a button click.

Plus the file names are set & reset & reset & set to the other all over the place.

Sorry but I am NOT debugging this.  I will wait on Peter to straighten it out.
Too many options and I'm tired ( been up 12 hours already today ).

I'll check back in tomorrow.


Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #54 on: November 18, 2011, 12:51:13 PM »
Peter,

Sorry about the nasty last response. I was tired and it had not been a good day.

I'll help as much as I can. It would help if you start putting modification comments at the beginning
of the source ( at least the main BAS but the form1.inc would be a good place also).

Now would be a good time to create a 2nd UDT with the variables needed to handle formatting
between the lines and the handles that are not user modifiable. If it's not on your user entry
pages then move it to this 2nd UDT. No need to save this 2nd UDT. BUT please zero it out when
entering DoFormat so you can run multiple files in 1 run of the program.

And somewhere in there, it would clean things up if you delete the temp file after you copy it to
the OUTPUT file name. It's not needed any more at that point.


I need to find a better source file comparer. I've been using ExamDiff but it's having problems
syncing up when there are lots of changes. Maybe I'll have to check on a source-code-control
system. No sure yet.


Offline Norbert Spoerl

  • Newbie
  • *
  • Posts: 37
  • User-Rate: +1/-0
Re: Code-Formatter PB 10
« Reply #55 on: November 18, 2011, 02:29:28 PM »
Hello Paul,

>>>
I need to find a better source file comparer.
<<<
-> http://kdiff3.sourceforge.net/


Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #56 on: November 18, 2011, 03:28:07 PM »
Norbert,

Thanks. I like it and it syncs up much better than others that I've tried.

I had made many changes to field names and re-arranged the UDT and changed several routines
and it made the changes appear with no problem.

I think I'll uninstall the 2 others that are on my system and just use this one.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #57 on: November 18, 2011, 05:31:04 PM »
Hello,
 Today I've since added the following resolved problem Bak function!

Code: [Select]

SUB CopyBak()
  LOCAL p, f, fout, d, t AS STRING

  f = PATHNAME$(NAME, fo.fspecin)
  IF fo.backup THEN
    IF fo.backupTimeStamp = 0 THEN
       p = PATHNAME$(PATH, fo.fspecin)
       fout = p + f + ".BAK"

        CopyFile fo.fspecin, (fout), 0
       ELSE
         p = PATHNAME$(PATH, fo.fspecin) + "BAK"
         IF ISFOLDER(p) = 0 THEN
            MKDIR p
            p = p + "\"
         END IF
         d = Built.DateString
         REPLACE "." WITH "_" IN d
         t = Built.TimeString
         REPLACE ":" WITH "_" IN t
                 
         CopyFile fo.fspecin, p + "\" + f + "_"+ d + " " + t + " .BAK", 0


       END IF
   END IF
END SUB

« Last Edit: December 26, 2011, 10:22:32 AM by Peter Weis »

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #58 on: November 18, 2011, 06:26:29 PM »
Halo Paul,
  but you wanted to help me or something, DoFormat still needs many improvements
 regards Peter

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #59 on: November 18, 2011, 06:48:44 PM »
Hallo Peter,

du hast ein Code angehängt. Arbeitet da jetzt noch jemand dran oder ist das erstmal dein Endstand?

Is actually somebody working on the Code or do we have some soert of FINAL?