1. Generic demo does not break text when printing

Hi:
My name is Mia, I am new to euphoria.  I was looking at the Generic demo, 
and no matter what I do. It will not print text correctly, the lines
are not broken so you lose the text if the line is too long.

I am new to programing so, I have not been able to figure out what
is wrong, the code looks fine, and it has the subs for breaking the code
so, I am sure why it does not work.  Does anybody have any suggestions?

Thank you in anticipation for your assistance,
Regards,
Mia

new topic     » topic index » view message » categorize

2. Re: Generic demo does not break text when printing

mia wrote:
> 
> Hi:
> My name is Mia, I am new to euphoria.  I was looking at the Generic demo,
You mean the one that comes with Win32Lib?
 
> and no matter what I do. It will not print text correctly, the lines
> are not broken so you lose the text if the line is too long.
> 
> I am new to programing so, I have not been able to figure out what
> is wrong, the code looks fine, and it has the subs for breaking the code
Yes, but it is only called when printing.

> so, I am sure why it does not work.  Does anybody have any suggestions?
Try reading the documentation and CK's book:
http://www.cklester.com/books/jubilation/

> 
> Thank you in anticipation for your assistance,
> Regards,
> Mia
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Generic demo does not break text when printing

mia wrote:
> 
> Hi:
> My name is Mia, I am new to euphoria.  I was looking at the Generic demo, 
> and no matter what I do. It will not print text correctly, the lines
> are not broken so you lose the text if the line is too long.
> 
> I am new to programing so, I have not been able to figure out what
> is wrong, the code looks fine, and it has the subs for breaking the code
> so, I am sure why it does not work.  Does anybody have any suggestions?
> 
> Thank you in anticipation for your assistance,
> Regards,
> Mia

Hi Mia,
you are correct. It was really designed to show text on the screen
but as it can print, it probably should do a better job of it. I'll
fix this up soon.

In the meantime, you might like to look into the drawText() function
which is what would be used to break lines on word boundries.
 
-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

4. Re: Generic demo does not break text when printing

Derek Parnell wrote:
> 
> mia wrote:
> > 
> > Hi:
> > My name is Mia, I am new to euphoria.  I was looking at the Generic demo, 
> > and no matter what I do. It will not print text correctly, the lines
> > are not broken so you lose the text if the line is too long.
> > 
> > I am new to programing so, I have not been able to figure out what
> > is wrong, the code looks fine, and it has the subs for breaking the code
> > so, I am sure why it does not work.  Does anybody have any suggestions?
> > 
> > Thank you in anticipation for your assistance,
> > Regards,
> > Mia
> 
> Hi Mia,
> you are correct. It was really designed to show text on the screen
> but as it can print, it probably should do a better job of it. I'll
> fix this up soon.
> 
> In the meantime, you might like to look into the drawText() function
> which is what would be used to break lines on word boundries.
>  
> -- 
> Derek Parnell
> Melbourne, Australia
> 
Hi Derek: Thanks for your tip. I followed your advice, and using the drawtext
example I managed to
draw the text on the richedit, but, when I try to print all I get is a blank
page?!?

Any ideas/

Many thanks,
Mia
------------------ Here is the code I used ----------
-------Iam using windowsxp and winlib v.0.6

constant
PR = create( PushButton, "Print", Window1, 40, 530, 110, 30, 0),
RE = create( RichEdit, "", Window1, 20, 220, 560, 300, ES_NOHIDESEL)
constant
   -- theWin = create( Window, "Resizable Text Window", 0, 0, 0, 400, 400, 0 ),
    SB     = create( StatusBar, "", Window1, 0, 0, 0, 0, 0),
    vBorders = {12,12,-18,-18},
    vText =
"Licence:" & 10 &
"This software is provided 'as-is', without any express or implied warranty." &
10 &
"In no event will the authors be held liable for any damages arising from " &
"the use of this software." & 10 &
"" & 10 &
"Permission is granted to anyone to use this software for any purpose, " &
"including commercial applications, and to alter it and redistribute it " &
"freely, subject to the following restrictictions:" & 10 &
"1.\tThe origin of this software must not be misrepresented; you must not " &
"claim that you wrote the original software." & 10 &
"2.\tIf you use this software in a product, acknowedgement in the product's " &
"documenation and binary are required." & 10 &
"3.\tAltered source versions, and works substantially derived from the it, " &
"must..." & 10 &
"\ta)\tbe plainly be marked as such," & 10 &
"\tb)\tnot be misrepresented as the original software," & 10 &
"\tc)\tinclude this notice, unaltered." & 10 &
"--------------------End of NOTICE------------------------*"



------------------------------------------------
procedure Resize_theWin(integer self, integer event, sequence parms)
------------------------------------------------
    returnValue(0)
end procedure

------------------------------------------------
procedure Paint_theWin(integer self, integer event, sequence parms)
------------------------------------------------
    sequence lRect, lTextRect
    sequence drawn

    -- Find the size of the rectangle needed.
    lTextRect = textRect(RE, vText, {self, vBorders},
            {DT_EXPANDTABS, DT_WORDBREAK, DT_END_ELLIPSIS}, 2, 15, 0)

    lRect = lTextRect[3]
    lRect[1] -= 6
    lRect[2] -= 6
    lRect[3] += 6
    lRect[4] += 6

    -- Paint the background, and borders
    drawLines(RE, {Cyan, --getSysColor(COLOR_BTNHIGHLIGHT),
                           {lRect[1],lRect[4], lRect[1], lRect[2]},
                           {lRect[3],lRect[2]},
                           {lRect[3]-1,lRect[2]+1},
                           {lRect[1]-1,lRect[2]+1},
                           {lRect[1]-1,lRect[4]+1},
                       BrightCyan, --getSysColor(COLOR_BTNSHADOW),
                           {lRect[1],lRect[4], lRect[3], lRect[4]},
                           {lRect[3], lRect[2]},
                           {lRect[3]-1,lRect[2]+1},
                           {lRect[3]-1,lRect[4]+1},
                           {lRect[1]+1,lRect[4]+1},
                       BrightBlue, --getSysColor(COLOR_BTNSHADOW),
{w32True, lRect[1]+2,lRect[2]+2, lRect[3]-1,
                           lRect[4]-1}
                          })

    -- Set the text color and draw in the text.
    drawn = drawText(RE, vText, lTextRect[3],
            {DT_EXPANDTABS, DT_WORDBREAK, DT_END_ELLIPSIS}, 2, 15, 0)

    -- Show status message.
    setText(SB, sprintf("Height (in pixels): %d, Chars drawn: %d", drawn))
end procedure

procedure PR_onClick(integer self, integer event, sequence parms)

    if length(getPrinter()) > 0 then
        VOID = startDoc("RichText Printer Test")
        VOID = startPage()
        printRichText(Printer, RE, 0, -1, {0.5, 0.5, 2.5, 3, w32InchScale}, 1)
        VOID = endPage()
        VOID = endDoc()

        releasePrinter()
        --repaintWindow(PPV)
    end if

end procedure
setHandler(PR, w32HClick, routine_id( "PR_onClick" ))
setFont(RE, "Times New Roman", 10, 0)
setHandler(RE, w32HPaint, routine_id("Paint_theWin"))
setHandler(RE, w32HResize, routine_id("Resize_theWin"))
setTextColor(RE, Black)
WinMain( Window1, Normal)


procedure Window1_onClick (integer self, integer event, sequence params)--params
is ()

end procedure
setHandler( Window1, w32HClick, routine_id("Window1_onClick"))

new topic     » goto parent     » topic index » view message » categorize

5. Re: Generic demo does not break text when printing

Hi CoJaBo:
Thanks for the info, the tutorial was great!

Regards,
Mia

CoJaBo wrote:
> 
> mia wrote:
> > 
> > Hi:
> > My name is Mia, I am new to euphoria.  I was looking at the Generic demo,
> You mean the one that comes with Win32Lib?
>  
> > and no matter what I do. It will not print text correctly, the lines
> > are not broken so you lose the text if the line is too long.
> > 
> > I am new to programing so, I have not been able to figure out what
> > is wrong, the code looks fine, and it has the subs for breaking the code
> Yes, but it is only called when printing.
> 
> > so, I am sure why it does not work.  Does anybody have any suggestions?
> Try reading the documentation and CK's book:
> <a
> href="http://www.cklester.com/books/jubilation/">http://www.cklester.com/books/jubilation/</a>
> 
> > 
> > Thank you in anticipation for your assistance,
> > Regards,
> > Mia
> >
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu