Splitting code across lines?

Everything else that doesn't fall into one of the other PB categories.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

could you show me an example?
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Yes, macros sound interesting.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

A macro as a way to handle split lines? If so, please please show!

Or a macro as an abbreviation for long strings of code, that is, put the long strings in a macro and then use the macro in the code?
Dare2 cut down to size
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Wow, we three Aussies really want it bad! :)
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

PB wrote:Wow, we three Aussies really want it bad! :)
:lol:

And also the split lines!
Dare2 cut down to size
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

a macro to basically shorten code. not for multilines. ;)

How "dynamic" do you need it ? Otherwise id suggest you simply wrap them into teh Macro and call it. Otherwise this will take some thinking ( which i have to do after work later.. gah 4am and i cant sleep ... prolly fricken meds :/


Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

If there was an option in the IDE to enable Scintilla word wrap then this would possibly solve this problem.

All the code that would be needed is:

Code: Select all

ScintillaSendMessage(gadget,#SCI_SETHSCROLLBAR,#False)
ScintillaSendMessage(gadget,#SCI_SETWRAPMODE,#SC_WRAP_WORD)
ScintillaSendMessage(gadget,#SCI_SETWRAPVISUALFLAGS,#SC_WRAPVISUALFLAG_END)
If the marker at the end of the wrapped line looked confusing then maybe it should be at the front with:

Code: Select all

SC_WRAPVISUALFLAG_START
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

DoubleDutch wrote:All the code that would be needed is:

Code: Select all

ScintillaSendMessage(gadget,#SCI_SETHSCROLLBAR,#False)
ScintillaSendMessage(gadget,#SCI_SETWRAPMODE,#SC_WRAP_WORD)
ScintillaSendMessage(gadget,#SCI_SETWRAPVISUALFLAGS,#SC_WRAPVISUALFLAG_END)
I am afraid it's not that easy ...
Some highlighting code must also be modified (at least in jaPBe : adding these few lines is not enough).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

ImageThe happiness is a road...
Not a destination
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Kwaï chang caïne wrote:NETMAESTRO shares a good solution :wink:
http://www.purebasic.fr/english/viewtop ... sc&start=0
Very nice, but in case of error the compiler would report a 'wrong' error line I guess.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

I don't know.
You know me, i'm a baby programmer :cry:
But this code works at the moment.
ImageThe happiness is a road...
Not a destination
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Some highlighting code must also be modified
I did a couple of tests on my stuff and it appears to be completely transparent to the application. Its all done at draw time (it reports as being the same line # and everything).

On the line number column display, it skips lines that are continued.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

in case of error the compiler would report a 'wrong' error line I guess
Very true, and I'm currently experimenting with making another add-on tool that responds to a keypress that will convert the reported line to the correct one.
BERESHEIT
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

I made a slight patch for the PureBasic editor here:

http://www.purebasic.fr/english/viewtop ... 962#225962

It seems to work ok, but be careful - you never know!
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
rtamely
New User
New User
Posts: 6
Joined: Tue Jul 15, 2008 8:38 pm
Location: RTAmely

Very Long Source Statement.

Post by rtamely »

I am new in PB, and I found an issue that I could not break down a long source statement very unconfortable. But not a big issue. I suggest that in source editor screen, those long statement can be seen continuous breaking down like in the rtf editor. but internally it continue as a single long statement.

Thanks
Post Reply