Hi Paul,
Jellyfish has a feature called "Format Selection to Colums".
It was based on a little tool I once wrote, "ColForm.bas":
http://www.powerbasic.com/support/pbforums/showthread.php?t=23671
I noticed that the FireFly Visual Designer editor does not have this functionality.
I kinda miss it. Would you consider putting that on the wishlist for the FF code editor?
Meanwhile, I am using it via "User Tools", but it would be cleaner if it was integrated.
Thanks for considering this.
Kind regards
Eddy
That look very nice. Could you tell me how you use it via the 'User Tools'
Regards,
Marc
Hi Eddy,
I tried to compile your tool, but I get errors under PB9.
Rolf, me too.
There's no value established for: %MOD_CONTROL which specifies the Key Shift-state:
'Equates for Key states
%NOSHIFT = 0
%ALT = 1
%CTRL = 2
%SHFT = 4
so I put in: %MOD_CONTROL = 6 'CTRL + SHFT
'take these out from inside the SUB: "FormatTheText"
%SmallDelay = 200 'small delay between keypresses. Otherwise some programs can't open the clipboard
%HotkeyReleaseDelay = 500 'wait until sure that user has released hotkey combination, increase for slow users..;-)
I put both changes just before: #Include "win32api.inc"
and it compiled. Rune the .exe and leave the little window open, switch to a text file and try it. Go back to the little window when you're done and want to unload the app.
Did a quick test. It runs, but text is not aligning as expected. I may have unexpected values for tabs or some such. Will investigate over the weekend. (The more I check code, the further behind I'm getting in my "real work" today!)
-John
I guess we would have to assign another hotkey then Ctrl Q. FF3 uses Ctrl-Q for closing the project.
Hi all,
The original code, "ColForm.bas" was programmed for PBDll 6.0 I think. A few minor modifications are needed for PBWin 9.x.
Move the constants out of the function as John already mentioned.
Also, %MOD_CONTROL is defined in DDT.inc or IMM.inc.
I modified "ColForm.bas" for use as a User Tool in FF. Basically, I simply removed the GUI and the global hotkey.
Source code, compiled exe and a screenshot of the User Tool dialog are store in attached zip file.
How to use in FireFly:
* Set this compiled exe as a User Tool, and assign a shortcut key combination to it. You need to do this only once.
* To format a few lines of code:
- Select the lines of code that you want to format,
- Press the shortcut key combination to invoke this tool. The text is copied, formatted and pasted again in the editor.
That's it ....
Kind regards
Eddy
Thanks a lot, Eddy.