LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-05-2021, 01:23 PM   #1
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
OpenOffice Basic: MsgBox using two columns of text


I wrote a macro set for Apache OpenOffice and LibreOffice. Now I am trying to include a message box with a concise help on my macros. The fragment of the current code looks like this:

Code:
Sub help
	Dim Help as String
	Help = Help & " [Ctrl]+[Shift]+[O]        encode_soft_Or_hard_spaces " & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[H]        big_case_cHanger" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[A]        remove_tAbulators" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[X]        eXchange_double_spaces" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[Z]        killparZ" & chr(13) & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[Insert]  temp" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[PgUp]   help" & chr(13) & chr(13)
	MsgBox Help, 0, "AOO-macro-4.1 "
End Sub
The message box looks like this:

Click image for larger version

Name:	lq.png
Views:	50
Size:	8.3 KB
ID:	36312

The problem is that I formatted the text displayed in proportional font using spaces. As a result, the macro names in the right column are not aligned. I tried hard to find a solution by searching the Internet and various manuals on OpenOffice Basic, but to no avail.

Can I display two columns of text in the message box and align the right column?
 
Old 05-05-2021, 01:52 PM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Just a thought. How about a tab, i.e. chr(9), as delimiter between two columns?
 
1 members found this post helpful.
Old 05-05-2021, 03:48 PM   #3
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
I tried the following variants:

• single text strings, including tabulators;
• two text strings separated by one or more chr(9).

The result was the same: all tabs are the same width, and I could not find an option to insert tab stops into the macro.

I also tried:

• multiple spaces (shown in the previous post);
• many dots (hoping the dot is narrower than the space).

Unfortunately, they are the same width.
 
Old 05-05-2021, 08:57 PM   #4
mimorek
Member
 
Registered: Feb 2013
Distribution: Debian (jessie)
Posts: 42

Rep: Reputation: Disabled
Code:
Sub help
	Dim Help as String
	Help = Help & " [Ctrl]+[Shift]+[O]" + Chr(9) + Chr(9) + Chr(9) + "encode_soft_Or_hard_spaces " & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[H]" + Chr(9) + Chr(9) + Chr(9) + "big_case_cHanger" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[A]" + Chr(9) + Chr(9) + Chr(9) + "remove_tAbulators" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[X]" + Chr(9) + Chr(9) + Chr(9) + "eXchange_double_spaces" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[Z]" + Chr(9) + Chr(9) + Chr(9) + "killparZ" & chr(13) & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[Insert]" + Chr(9) + Chr(9) + "temp" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[PgUp]" + Chr(9) + Chr(9) + "help" & chr(13) & chr(13)
	MsgBox Help, 0, "AOO-macro-4.1 "
End Sub
 
1 members found this post helpful.
Old 05-06-2021, 02:05 AM   #5
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
@mimorek

This is exactly what i described in my previous post:

Quote:
• two text strings separated by one or more chr(9).
The help displayed by your code looks like this:

Click image for larger version

Name:	lq-mimorek.png
Views:	25
Size:	9.3 KB
ID:	36315

It looks even worse than the help displayed by my code because you have used double tabs on the following lines:

Code:
	Help = Help & " [Ctrl]+[Shift]+[Insert]" + Chr(9) + Chr(9) + "temp" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[PgUp]" + Chr(9) + Chr(9) + "help" & chr(13) & chr(13)
instead of using single tabs as I did:

Code:
	Help = Help & " [Ctrl]+[Shift]+[Insert]" & chr(9) & "temp" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[PgUp]" & chr(9) & "help" & chr(13) & chr(13)
You have not tried your code in Apache OpenOffice, have you?
 
Old 05-06-2021, 05:20 AM   #6
mimorek
Member
 
Registered: Feb 2013
Distribution: Debian (jessie)
Posts: 42

Rep: Reputation: Disabled
O, sorry man.
Looks ok on my end.

Click image for larger version

Name:	lobasic.jpg
Views:	31
Size:	30.5 KB
ID:	36317
 
1 members found this post helpful.
Old 05-06-2021, 05:37 AM   #7
mimorek
Member
 
Registered: Feb 2013
Distribution: Debian (jessie)
Posts: 42

Rep: Reputation: Disabled
Code:
Sub help
	Dim Help as String
	Help = Help & " [Ctrl]+[Shift]+[O]" + Chr(9) + Chr(9) + "encode_soft_Or_hard_spaces " & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[H]" + Chr(9) + Chr(9) + "big_case_cHanger" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[A]" + Chr(9) + Chr(9) + "remove_tAbulators" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[X]" + Chr(9) + Chr(9) + "eXchange_double_spaces" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[Z]" + Chr(9) + Chr(9) + "killparZ" & chr(13) & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[Insert]"     + Chr(9) + "temp" & chr(13)
	Help = Help & " [Ctrl]+[Shift]+[PgUp]"       + Chr(9) + "help" & chr(13) & chr(13)
	MsgBox Help, 0, "AOO-macro-4.1 "
End Sub
Click image for larger version

Name:	lobasic2.jpg
Views:	25
Size:	33.6 KB
ID:	36318
 
1 members found this post helpful.
Old 05-06-2021, 01:58 PM   #8
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
@mimorek

OK my friend. Your screenshots from posts #6 and #7 look perfect, so I thanked you twice.

Unfortunately, your code from posts #4 and #7 gives the result that I provided in post #5.

This must be the reason why your results are so different from mine. So we need to talk to find it.

First question: I used Apache Open Office Writer running on Linux. Have you used Apache Open Office Writer or LibreOffice Writer, or something else?
 
Old 05-06-2021, 02:04 PM   #9
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
I'd say the difference is not between Open Office / LibreOffice, but in the typefaces used.

To me, the font in w1k0's screenshots looks like DejaVu Sans, and the font in mimorek's screenshots looks more like Cantarell.

Last edited by shruggy; 05-06-2021 at 02:17 PM.
 
1 members found this post helpful.
Old 05-06-2021, 02:16 PM   #10
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
@shruggy

You may be right, and if you are right you deserve my double thanks for posts #2 and #9.

I am using Apache OpenOffice for Slackware Linux downloaded from http://slackbuilds.org.

Maybe Apache OpenOffice for some other Linux distributions or for Windows, or macOS uses different fonts.

In this case, I need to know if I can change the font used in my version of Apache OpenOffice.

* * *

EDITED: Actually the version available on SlackBuilds is 4.1.7, but I modified the openoffice.org.SlackBuild and use version 4.1.9.

Last edited by w1k0; 05-06-2021 at 02:21 PM.
 
Old 05-06-2021, 02:22 PM   #11
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Cantarell is default UI font for GNOME 3.x. Slackware doesn't have GNOME, what's your DE?
 
1 members found this post helpful.
Old 05-06-2021, 02:29 PM   #12
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
@shruggy

It is a shame, but I have been using Window Maker since 1997, and I love it – no reciprocity (and you probably deserve my third thank you).

* * *

EDITED1: I just added information about my window manager in Slackware and the desktop environment in Mint to my profile. (I have to work hard to keep MATE in Mint in a condition I like).

* * *

EDITED2: I used AfterStep before Window Maker so I must be crazy.

Last edited by w1k0; 05-06-2021 at 02:46 PM.
 
Old 05-06-2021, 02:40 PM   #13
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Well, according to Windows Maker docs it is probably Displayfont (Helvetica by default). You can try changing either this setting or the fontconfig alias for Helvetica. What is the output of fc-match Helvetica? And fc-match sans?

Last edited by shruggy; 05-06-2021 at 02:43 PM.
 
1 members found this post helpful.
Old 05-06-2021, 02:50 PM   #14
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
@shruggy

# fc-match Helvetica
n019003l.pfb: "Nimbus Sans L" "Regular"
# fc-match sans
DejaVuSans.ttf: "DejaVu Sans" "Book"

(You can be a genius, shruggy).

* * *

EDITED1:

Quote:
You can try changing either this setting or the fontconfig alias for Helvetica.
This is not my problem, but the problem of the users of my AOO-macro-4.1. I try to provide them with the best code I can, but I cannot check all the window managers and desktop environments to give a hint of the correct font.

* * *

EDITED2:

By the way, there is no Cantarell font in my system.

Last edited by w1k0; 05-06-2021 at 03:09 PM.
 
Old 05-06-2021, 05:13 PM   #15
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
@shruggy

I have installed the gnome-common and cantarell-fonts package from SlackBuilds. Then I changed the font in WPrefs from Trebuchet MS to Cantarell.

Unfortunately, after these changes, the help window looks exactly the same as in my post #5 (the right column is not aligned as in the mimorek’s screenshots).

* * *

EDITED: In fact, the window manager seems to be using exactly the same font after these changes.

Last edited by w1k0; 05-06-2021 at 05:34 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
merge columns from multiple files in a directory based on match of two columns prasanthi yanamala Linux - Newbie 2 11-12-2015 10:11 AM
SQL statements howto -- 3 columns input but 2 columns output fhleung Programming 3 11-29-2012 10:45 AM
Map 1 CSV's columns to matching columns in another CSV 2legit2quit Programming 7 10-27-2011 08:53 AM
[SOLVED] AWK: add columns while keep format for other columns cristalp Programming 3 10-13-2011 06:14 AM
msgbox and time measuring sytax under ubuntu cyb3rdawn Programming 1 05-22-2008 04:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration