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

0 Members and 1 Guest are viewing this topic.

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #90 on: November 21, 2011, 03:45:11 PM »
Dominic,

Thanks. That's cleared up some things I couldn't understand.

As far as I knew, the big push for this version of the program was to handle the new items
in PB v10. But at first all I saw were some MACROs switching between ANSI & UNICODE.
Which were not needed to handle the data files ( only plain BAS code usable by the IDE and
compiler ... NO UNICODE there ). And not needed in any of the existing functions of the program
and I couldn't see any need of them for future functions dealing with the programs main
purpose. They might have been useful in some way dealing with a GUI to handle setting/saving
the formatting options if the GUI needed to handle UNICODE. But as it is, I just don't see any
advantage to the program as it sits.

But I'll continue to do what I can to help.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #91 on: November 21, 2011, 10:48:14 PM »
Hi Paul,

 if you have time could sometimes look here. Here's another mistake! Have code formatter can go through and that's come out here

original code
Code: [Select]
FUNCTION CodeFormatter_InitApplication _
  ( _
  BYVAL hInstance AS DWORD, _ ' handle of current instance
  BYVAL lParam    AS LONG _   ' address of command line
  ) AS LONG

  LOCAL lpszcmdline AS WSTRINGZ PTR                     '20.11.2011 Muss Bei PowerBasic 10 WStringz Ptr
  LOCAL filenum AS LONG
  LOCAL ztext , zOut AS XASCIZ * %MAX_PATH
  DIM Built AS GLOBAL IPOWERTIME

code Formatter
Code: [Select]
FUNCTION CodeFormatter_InitApplication _
   (_
   BYVAL hInstance AS DWORD, _                   ' handle of current instance
   BYVAL lParam AS LONG _                        ' address of command line
   ) AS LONG

  LOCAL lpszcmdline AS WSTRINGZ PTR                     '20.11.2011 Muss Bei PowerBasic 10 WStringz Ptr
  LOCAL filenum AS LONG
*ERR LOCAL  0 but need  5
  LOCAL  AS XASCIZ * %MAX_PATH
*ERR LOCAL  0 but need  4       

I'm still working with Progress bar in status bar

regards Peter

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #92 on: November 22, 2011, 02:28:16 AM »
Peter,

Simple fix.  Add fo.ascolumn = 40  after you  GET fo in FUNCTION CodeFormatter_InitApplication.

Better fix.  Add the ascolumn variable to the Options page.

Small variable that got lost in the shuffle.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #93 on: November 22, 2011, 12:37:07 PM »
Hi Paul,
  ascolumn inserted in the Options page :)

 regards Peter
« Last Edit: December 26, 2011, 10:37:41 AM by Peter Weis »

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #94 on: November 22, 2011, 01:04:55 PM »
Peter,

Close but ascolumn goes with split variables and should be next to it. and entry disabled when
split variables is unchecked.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #95 on: November 22, 2011, 10:16:48 PM »
Hi Paul,
Here again an update that disabled split variable!

Did not have much time today!

regards Peter
« Last Edit: December 26, 2011, 10:37:58 AM by Peter Weis »

Offline Paul Elliott

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

Not bad but I would have just inserted the As Column ( or Column AS ) below the split variable
check box and bumped the fields below it down. That way you wouldn't have had to increase
the tab/dialog size.

Did you realize that you can get the program's command line  via COMMAND$ and get a plain
string? No mucking about with wasciiz ptr. not sure if there is any difference in the result as
you're only dealing with 1 field ( source file name ).

Just to be doing something, I worked up a DDT version starting with PBForms and manually adding
controls to the tab pages. Not very difficult but I admit that Phoenix does a lot of the work for you.
Biggest trouble was putting in the event code & copying/modifying the Phoenix event functions.
Got most of it converted except for the progress bar and a few controls on the 2nd tab page.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #97 on: November 23, 2011, 10:38:57 PM »
Hallo Paul,

Quote
Not bad but I would have just inserted the As Column ( or Column AS ) below the split variable
check box and bumped the fields below it down. That way you wouldn't have had to increase
the tab/dialog size.

IDE have reprogrammed again, hope you like it better

Quote
Did you realize that you can get the program's command line  via COMMAND$ and get a plain
string? No mucking about with wasciiz ptr. not sure if there is any difference in the result as
you're only dealing with 1 field ( source file name ).


But already I get the pointer function of delivered, why should I then command can generate a string again! Command reads out the pointer and generates a string!

Quote
Just to be doing something, I worked up a DDT version starting with PBForms and manually adding
controls to the tab pages. Not very difficult but I admit that Phoenix does a lot of the work for you.
Biggest trouble was putting in the event code & copying/modifying the Phoenix event functions.
Got most of it converted except for the progress bar and a few controls on the 2nd tab page.

Hi Paul, it remains open to you all the way! You can reprogram it to DDT! Send me the code but then! I want to watch it!

In addition, today I have the function reprogrammed DoFormat, possessions disappear all Goto I do not like in programs and I also have changed the format of local variables Variable Split who is turned on. The format has not voted namely

regards Peter


« Last Edit: December 26, 2011, 10:38:31 AM by Peter Weis »

Offline Paul Elliott

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

Old way or new way the GUI works. Just make sure you have the tab order matching the
natural order of the controls on screen.

Personally I like/use GOTOs to simplify a big block of code. For me it is much easier to make
major changes when needed without trying to figure out all the gotcha's when several levels
of if/then deep.

If you're going to indent the variables make sure you indent them correctly for all the functions/
methods/whatevers in a Class. And does that change the Column AS ? Because if you get
too many levels deep you will probably not have enough room between the variable and
the AS type.

I've noticed a couple errors in my splitting routine but am not sure it would fit in with your
programming structure now.
1) if there is something like   DIM A(1, 4) as LONG needs extra processing.
2) and  LOCAL a, b, c as LONG, d, e, f AS DWORD also need more work.
I got no responses either good/bad when I posted the code so I didn't do any further
work on this program. I made my changes in my program that all it does is split the
variables.

I don't really think posting my DDT version would do anything but confuse people.
I left out everything but the basic clicking/text changing code. No re-sizing or other
things taken care of by Phoenix. And haven't even looked at the progress bar other than
to disable the simple one used in the original program.

I finally found out why you added the extra check for #PBFORM. It really only matters when
it is in the middle of a procedure.
I don't know if there are other keywords that need the same treatment or not.

Keep going.


Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #99 on: November 24, 2011, 11:06:40 PM »
Hi Paul,

have new version. Can retrieve backup.
I answer your questions tomorrow!

Do not worry keep working :)
« Last Edit: December 26, 2011, 10:38:51 AM by Peter Weis »

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #100 on: November 25, 2011, 08:26:21 AM »
Hi Paul,

Quote
Just make sure you have the tab order matching the
natural order of the controls on screen.

I want to give the program a lot of possibilities. While many controls are needed. Tab Order point, I then finally one!


Quote
Personally I like/use GOTOs to simplify a big block of code. For me it is much easier to make
major changes when needed without trying to figure out all the gotcha's when several levels
of if/then deep.

It must always decide themselves whether to use goto! I use it for 20 years not only in an emergency who can not be done differently. If Then blocks can be read much better.
Quote

If you're going to indent the variables make sure you indent them correctly for all the functions/
methods/whatevers in a Class. And does that change the Column AS ? Because if you get
too many levels deep you will probably not have enough room between the variable and
the AS type.

The function DoFormat is simply not mature! They should only is the entire function, class method should read all read AS variable, and put it in the beginning of the function! Then there are no space problems with AS

Quote
I've noticed a couple errors in my splitting routine but am not sure it would fit in with your
programming structure now.
1) if there is something like   DIM A(1, 4) as LONG needs extra processing.
2) and  LOCAL a, b, c as LONG, d, e, f AS DWORD also need more work.
I got no responses either good/bad when I posted the code so I didn't do any further
work on this program. I made my changes in my program that all it does is split the
variables.

There are certainly still many errors in the split routine. Send me your. Have you already written one above approach.
 So all read from file function. Could work by Function End Function then to be used only for the Collection Class

Quote
I finally found out why you added the extra check for #PBFORM. It really only matters when
it is in the middle of a procedure.
I don't know if there are other keywords that need the same treatment or not.

There are many exceptions, the determined, we must note. But which are to come up with the times already! We will solve this already, because I'm sure! The function DoFormat is bad but we still need to work to find ways

regards Peter

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #101 on: November 25, 2011, 01:51:22 PM »
Peter,

Sorry. I understand that English is not your primary language. But some of your responses don't
make sense to me.

1) I think it get it.
2) Personally I have an extreme dislike of nesting so many levels deep. it is only understandable
when fully documented on each level.
3) not sure I understand. an additional problem occurs when tab is set to 8 and very long variable
names are used.
4) only the 2 that I know of and I've run several source files from the PB forums thru it. and indenting
for Class Method variables which I only saw for the first time a couple weeks ago and have admitted
that I know nothing about & my programs might not work with that code.
but did not understand at all the 2nd line.
5) seems to me as you add more exceptions that the nesting level ( and complexity ) also expands.



Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1037
  • User-Rate: +30/-4
    • it-berater
Re: Code-Formatter PB 10
« Reply #102 on: November 25, 2011, 03:03:21 PM »
Peter, i offer you tranlation here. Write it in german and drope me a note then I'll translate it for you into english.

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 326
  • User-Rate: +15/-4
Re: Code-Formatter PB 10
« Reply #103 on: November 25, 2011, 07:13:20 PM »
Hi Paul,
my English is very bad! But I think that we already manage! And who it was not supposed to go I take Theo's supply!

Greetings Peter

Offline Paul Elliott

  • Full Member
  • ***
  • Posts: 164
  • User-Rate: +40/-32
Re: Code-Formatter PB 10
« Reply #104 on: November 26, 2011, 12:58:25 PM »
Peter,

At least you're making an attempt. I can only speak English. Took 2 classes of French in school but
was never able to "think" in French.

Over the years, I've dealt with French, Spanish, Portugese, Italian and Singaporian people  and was always
amazed at their ability to not only speak English but to understand the culture.  Sorry to say I still
haven't learned anough of the culture of those people to understand some of their comments.