` Printed Icetips Article

Icetips Article



Par2: How to select a printer device with ABC's EIP
2012-05-10 -- Russ Eggen
 
its actually pretty easy.  Here is how its done:

1) For the column that stores the device name, Use any dialog lookup from the drop list. 
Font, Color, File, etc.  Does not really matter which. I used File.

2) You will need to override the TakeEvent method in the parent class, but not by editing
it.  Two embeds in this method:
  A) Declare local variable (DATA embed):
Str    CSTRING(FILE:MaxFilePath+1),AUTO

  B) The code, before parent call:
CASE Event
OF EVENT:DroppingDown
  IF ~SELF.ReadOnly
    IF NOT SELF.Title
      SELF.Title = SELF.ListBoxFeq{PROPLIST:Header,SELF.FieldNo}
    END
    UPDATE(SELF.FEQ)
    Str = SELF.UseVar
    IF PrinterDialog(SELF.Title)    !Key code
      Str = PRINTER{PROPPRINT:device}  !Key code
      SELF.UseVar = Str    !Key code
      DISPLAY(SELF.Feq)
    END
    RETURN EditAction:Ignore
  END
END

If any of the above looks familiar, it should be, I stole it from one of the ABEIP methods
.

3) Critical last step, add at the *module* embed level the INCLUDE('PRNPROP.CLW'),ONCE
code or it won't compile.

That's it.  Compile and test and you'll find you can select any printer device installed
on the system.  This is useful if you ever need to change printer devices on the fly like
you might do with point of sale systems (flip between a receipt printer and normal printer
for example).



Printed November 21, 2024, 11:20 am
This article has been viewed/printed 35247 times.