> On Tue, Jan 22, 2013 at 3:45 PM, Art Heimsoth
> <artst...@artheimsoth.com> wrote:
>
>> I am trying to get a printer selection to work using the
>> .SingleSelection class
>>
> in my ooDialog program.  The selection is displayed, but the
> default item that is passed as a parm does not preselect the item,
> and the return is always the preselected index value.  If I take
> the method out of the main program and run it from a simple Rexx
> program, all works just fine. I have verified via traces that the
> parms are passed in correctly and the selected index value is not
> returned.  I am looking for ideas of how to find the problem short
> of really stripping the main program until it starts working.
>
>
> Hi Art,
>
>
> It's pretty hard to say without seeing some code.  You say "the
> method out of the main"  What does this method look like?
>
::method UpdatePrinter
    expose Fescue. Tkt.
    self~logError(0,"UpdatePrinter entered" time('S'))

    self~logError(0,"Fescue.printer set to:" Fescue.printer "on entry")
    if Fescue.printer <> '' then return         -- stop multiple entry
    waitmsg = .TimedMessage~new("Please wait for the list of printers.", ,
               "Getting Printer Names", -1)
    waitmsg~execute
    default_printer = SysWinGetDefaultPrinter()
    parse value default_printer with dp ','.
    call SysWinGetPrinters all_printers.
    do i = 1 to all_printers.0
        parse var all_printers.i pname ','.
        if pname == dp then do
            aprt.i = pname '(Default)'
            ldp = i
            end
        else aprt.i = pname
        end

    aprt.0 = all_printers.0
    m_title = 'Select A Printer For Fescue Program'
    self~logError(0,"Preselected:" aprt.ldp)
    dlg = .SingleSelection~new('Make A Selection',m_title,aprt.,ldp, ,4)
    wt = dlg~execute
    waitmsg~ok
    if wt <> '' then do
        Tkt.Printer~setText(aprt.wt)
        self~logError(0,"UpdatePrinter Selected:" aprt.wt)
        Fescue.printer = aprt.wt
        end
    else
        self~logError(0,"UpdatePrinter none selected")

Then if I run the following it works as expected:

/* why doesn't printer selection work?  */

    waitmsg = .TimedMessage~new("Please wait for the list of printers.", ,
               "Getting Printer Names", -1)
    waitmsg~execute
    default_printer = SysWinGetDefaultPrinter()
    parse value default_printer with dp ','.
    call SysWinGetPrinters all_printers.
    do i = 1 to all_printers.0
        parse var all_printers.i pname ','.
        if pname == dp then do
            aprt.i = pname '(Default)'
            ldp = i
            end
        else aprt.i = pname
        end

    aprt.0 = all_printers.0
    m_title = 'Select A Printer For Fescue Program'
    dlg = .SingleSelection~new('Make A Selection',m_title,aprt.,ldp, ,4)
    wt = dlg~execute
    waitmsg~ok
    if wt <> '' then
        Say "printer selected = "aprt.wt
    else
        Say "No printer selected"

::requires OODialog.CLS
>
> Off-hand, I'd say it is not possible for it to not work.  ;-)  So,
> I'm thinking there is something else going on there.
>
I agree there is something else going on, but I am out of ideas
of how to try to find out what!

--
  Art Heimsoth - artst...@artheimsoth.com

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to