Experiment Listbox Print OSX

not perfect, but usable
LB Print Mac

Haven’t tried… but wouldn’t DRAWINTO work using just a few lines of code, and the OS print system?

Except the icon, I do not saw anything in colour.

It is easy to print the alternate background colors and the ListBox text.

@Axel
Drawinto = low resolution picture…
Here it is vector and Preview in print dialog : very interesting.

@Axel:
Open csv file sucks: all goes into one column, the ListBox (I think) goes far beyong the window bottom hiding the buttons…

Print LB: you better set the printer to Landscape in code, because it actually print until the left of Column 5 (only Col / Rov). Something like:

[code] Dim p As New PrinterSetup

p.Landscape = True
[/code]
And… the only colour I saw is the icon.

fld ListBox does not uses the defined alternate background colors…

What your code do that mine does not ?
You print the ListBox, I print the contents and with the set background colours (three alternate background colours).

NO, I am not ranting, I just let know what my experience with the shared project is.

[quote=142572:@Emile Schwarz]
Open csv file sucks: all goes into one column.[/quote]

Button Caption is: Open CSV (tab), maybe your file has other delimiter.

The Text is black.

Put this in CellTextPaint and you will see colors.

  select case column
  case 0
    g.ForeColor = &c414BFF00
  case 1
    g.ForeColor = &cA1781200
  case 2
    g.ForeColor = &c632B3100
  case 3
    g.ForeColor = &c284C4E00
  case 4
    g.ForeColor = &cDF242500
  end select

what is the defined alternate background color?
you know you can change the color in CellBackgroundPaint…

Doh ! the ending b) does ot appears
Comma Separated Value: ‘,’, not tab !

Sorry, somewhere my fault ! I knew (WikipediA) that no normae exists for csv files.

[quote=142580:@Axel Schneider]what is the defined alternate background color?
you know you can change the color in CellBackgroundPaint…[/quote]
Yes, I was talking about yours. Defined but for some unknow reason not used.

In the IDE, look your code into Window1.Controls.fld.CellBackgroundPaint:

if myRowMod = true then If row Mod 2 = 0 Then g.ForeColor = &cFFFFFF00 g.FillRect 0, 0, g.Width, g.Height else g.ForeColor = &cECECEC00 g.FillRect 0, 0, g.Width, g.Height End If end if

At last, I do print text in black only. And I do not think text in color when I wrote my LB Print with Colors (I had only Row Background in mind at the time). I do not even think images (icons).

I had to force quit Xojo before getting back your Row alternate colours code. I do not know what happens.

[quote=142572:@Emile Schwarz]Print LB: you better set the printer to Landscape in code,
because it actually print until the left of Column 5 (only Col / Rov). Something like:
Dim p As New PrinterSetup p.Landscape = True [/quote]

I use Declares to print

Download it again and use Version2.
In the Page Setup Window you can set the Percentage (%)

OS X too…

Axel:

You put a lot of work in your example. More have to be added to get a real winner.

Comma-separated values, a file format (usually with .csv extension)

roughly speaking, they say csv files use a comma as the delimiter (typically a single reserved character such as comma, semicolon, or tab; sometimes the delimiter may include optional spaces).

As an example (not good at 100%, because the file extension is .txt instead of .csv), go to FileFactory page, scroll to the bottom (and forget the list of links), then click in the cyan background button named Download Folder CSV load it with Apple’s TextEdit and watch its contents.

Another souce can be: open-data.europa.eu/. There they are downloadable files in csv, xls, pdf formats that can help.

At last, a Google quest will gave you other csv files, but the quest - as always - is boring.

All of this to say - IMHO - that tab separated files have to use the .txt file extension. Even OS X shows a difference between csv (using a comma as delimiter), if you ask the Finder to preview the file contents (QuickView ? Get an Eye on ? I do not know the english name of the feature).

In the contextual menu, you will get a crash if you use undo while you do not make any action.

And, change the computer language from English to another to watch what you get in the buttons in the I/O functions (for example).

Yes, you are right: this is a simple example, it does not have to be perfect. On the other hand, getting it as better as it is possible is a good thing for the nexbies (or nexbies in this particular domain), a way to follow the good path.

Hi Axel,

Thanks for your good work on this Listbox.

I have a few concerns, when you print, it changes the width/height of the Windows, prints then goes back to the original size.
I believe Cocoa has some declares to set a different Print size from the size of the current NSView/NSDocument, this might be worth looking into.

The best solution would be the ability to print on several sheet, I have an app that needs to print >50 columns in a Listbox on 2 or more sheets. I would love to have the Print preview for this on OSX.

[quote=143019:@Emile Schwarz]Comma-separated values, a file format (usually with .csv extension)
roughly speaking, they say csv files use a comma as the delimiter (typically a single reserved character such as comma, semicolon, or tab; sometimes the delimiter may include optional spaces).[/quote]

if you need Comma-separated values
it is no problem to change chr(9) to “,”

???
all button captions are in english, so they are in english, whatever computer language is

my computer language is german

I don’t. I looked at this conversation by curiousity only.

Mine is French and I get some english text inside French text in buttons.

That appears too with your rtf project.

I do not know why.

I use the English version of Xojo.
Perhaps this is why.

Maybe the two other button captions comes from the OS (and so are in French for me) ?

BTW: You have two “Fonts” menus in the MenuBar (v2). The first o nothing (highlight the manu nam ony), the second one changes the ListBox font.

Gradient: I only get an uniform grey (so no Gradient, but something)

Resize down the window: the ListBox is not resized.

Preview: this is something new to me (the way to get the PDF directly without buttons to click). A nice stuff. OS X only I suppose.

Print Orientation: I saw the declare, but the default value is still Portrait, not Landscape as needed with the filled data.
I get an eye on the Apple’s Print PDF, but I failed to find what to do !

I am sure that v3 will be great !

After some complement search I found something here.

HTH.

Delete the FontMenu in MainMenuBar

[quote=143542:@Emile Schwarz]
Gradient: I only get an uniform grey (so no Gradient, but something)[/quote]

set the 2 Colors in Inspector (BGGradient1, BGGradient2)

[quote=143542:@Emile Schwarz]Print Orientation: I saw the declare, but the default value is still Portrait, not Landscape as needed with the filled data.
I get an eye on the Apple’s Print PDF , but I failed to find what to do ![/quote]

you can test this in the btnPrint
( unfortunately, my Laserprinter does not support all lpr options)

  dim s as String
  dim f as FolderItem = SpecialFolder.Temporary.Child("temp.pdf")
  s = exportLB_PDF (myLB1, f)
  dim mshell as new Shell
  dim cmd as string
  cmd =  "lpr -o orientation-requested=4 " + f.ShellPath
  mshell.Execute cmd

works better if I use a Canvas

LB Print Mac 2