1. John Fauss
  2. PowerBuilder
  3. Thursday, 23 September 2021 01:15 AM UTC

A recent post included some PowerScript code, and I thought I would pass along a tip for pasting code snippets that produces a slightly more readable result than simply pasting code into the website's text editor.

The toolbar contains a button to assist with including a source code sample:

 

When selected, a dialog window appears, where you can paste your code sample. Here's what the upper portion of that dialog looks like:

Please note three things: (1) A drop-down selection is available for you to choose the source language you are including (it defaults to PowerBuilder, as you can see). Ten other languages are available, including C# if you are posting code taken from SnapDevelop. (2) The tab setting is fixed at eight characters, as shown above. I wish it was a smaller value (like 3 or 4) or controllable, but it's not. (3) A monospaced font will be used so that lines of code will align (notwithstanding the overtly large tab setting).

I manually edit the pasted code snippet to replace the expanded tab characters with three spaces, to make it more readable, but that's optional, of course.

Here's the result of including the above code sample (I did NOT replace the tab characters, so that you can see the results):

If dw_1.RowCount() > 0 Then
	// If this Data Object already contains data, clear out all of the data.
	dw_1.Reset()
End If
dw_1.InsertRow(0)

You can see how the code fragments are colorized in much the same way as in the PowerScript Editor.

To edit a code sample you've already added, click the source code sample to highlight it, then click the "Insert/Edit Code Sample" toolbar button and the same dialog window will appear with the code in it.

Bonus Tip! The toolbar button to the immediate left of the "Insert/Edit Code Sample" button with the "eye" icon displays a Preview of your posting prior to you submitting it. The preview is an approximation, not a fully-faithful rendering, but it gives you an idea as to how your posting will appear when it is submitted.

I look forward to seeing your posts!

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 27 December 2021 21:06 PM UTC
  2. PowerBuilder
  3. # 1

Another tip on this:

If you want to change anything in the Code sample, after having saved your post, then edit your reply and click on the code block. After that, click again on the "Insert/Edit code Sample" icon.

That will allow you to do any changes.

regards.

Comment
There are no comments made yet.
Juan Pedro Sanz Diez Accepted Answer Pending Moderation
  1. Friday, 5 November 2021 11:15 AM UTC
  2. PowerBuilder
  3. # 2

Great! I will do in next posts.

thank you very much.

Comment
There are no comments made yet.
Ashutosh Varshney Accepted Answer Pending Moderation
  1. Friday, 24 September 2021 14:58 PM UTC
  2. PowerBuilder
  3. # 3

Thank You John! That is a great tip. 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 23 September 2021 14:29 PM UTC
  2. PowerBuilder
  3. # 4

Can someone please pin this post as a "featured question" so it'll appear at the top of the Q&A for some time?

TIA

Comment
  1. Miguel Leeuwe
  2. Friday, 24 September 2021 03:49 AM UTC
Thank you, whoever pinned this!
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 23 September 2021 12:07 PM UTC
  2. PowerBuilder
  3. # 5
Comment
  1. Miguel Leeuwe
  2. Monday, 22 November 2021 08:42 AM UTC
Hi Ossama, you're asking in the wrong post. Not sure what this is about.

regards
  1. Helpful 1
  1. ossama ahmed
  2. Monday, 22 November 2021 09:52 AM UTC
dear Mr.Miguel

i just want to generate QR Code in the printing invoice . how can i do it?

this is my question

regards
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 22 November 2021 09:57 AM UTC
You should ask your Q&A question in a new post or in one of the other two that you already have. you should not just randomly pick any post to ask any question that has nothing to do with the post.

Also you should give a lot more information of what you want to do exactly.

regards
  1. Helpful 1
There are no comments made yet.
Glenn Scamman Accepted Answer Pending Moderation
  1. Thursday, 23 September 2021 01:34 AM UTC
  2. PowerBuilder
  3. # 6

Thanks John!  I figured there was a quick tool for that, but I tried the "tools" menu and chose "source code" and that just shows the html version of a post, and then I gave up.

Comment
  1. John Fauss
  2. Thursday, 23 September 2021 04:28 AM UTC
You're welcome, Glenn!
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.