Argox Label Printer: A_prn_text - Variable Is Error

Asked

Viewed 897 times

0

Follows the function:

function  A_Prn_Text     ( x,y,ori,font,typee,hor_factor,ver_factor:integer;mode:char;numeric:integer;data:String):integer;stdcall;external 'WINPPLA.DLL';

Follows the code:

while not DMRetaguarda.QConItem.eof do
begin
  for i := 1 to strtoint(edit5.text) do
    begin
      A_Prn_Text(200, 360, 0, 9, 5, 1, 1, 'n', 2, PWideChar(AnsiString(copy(dmretaguarda.qconitemdescricao.asstring, 1, 29))));
      if length(dmretaguarda.qconitemdescricao.asstring) > 29 then
        A_Prn_Text(180, 360, 0, 9, 5, 1, 1, 'n', 2, PWideChar(AnsiString(copy(dmretaguarda.qconitemdescricao.asstring, 30, 29))));
      A_Prn_Text(175, 360, 0, 9, 5, 1, 1, 'n', 2, PWideChar(AnsiString('____________________________________')));
      A_Prn_Text(150, 360, 0, 9, 5, 1, 1, 'n', 2, PWideChar(AnsiString('MARCA: '+copy(dmretaguarda.qconitemmarca.asstring, 1, 30))));
      A_Prn_Text(130, 360, 0, 9, 5, 1, 1, 'n', 2, PWideChar(AnsiString('MODELO: '+copy(dmretaguarda.qconitemmodelo.asstring, 1, 30))));
      A_Prn_Text(110, 360, 0, 9, 5, 1, 1, 'n', 2, PWideChar(AnsiString('REF.: '+copy(dmretaguarda.qconitemreferencia.asstring, 1, 35))));
      loc12 := dmretaguarda.qconitemlocal1.asstring;
      if dmretaguarda.qconitemlocal2.asstring <> '' then
        loc12 := loc12 + ' e '+dmretaguarda.qconitemlocal2.asstring;
      A_Prn_Text(85, 360, 0, 9, 5, 1, 1, 'n', 2, PWideCHar(AnsiString('LOCAL: '+loc12)));
      A_Prn_Text(20, 180, 0, 9, 6, 0, 1, 'n', 2, PWideCHar(AnsiString('COD.: '+copy(dmretaguarda.qconitemcodigo.asstring, 7, 7))));
      A_Prn_Barcode(10, 360, 0, 'E', 0, 0, 60, 'A', 1, PWideCHar(AnsiString(dmretaguarda.qconitemcodigo.asstring)));
      A_Print_Out(1, 1, 1, 1);
    end;
  DMRetaguarda.QConItem.next;
end;

This code should print according to my coordinates, which from the query that is running will assign the values I typed in my form, but it is giving this error right in the first line:

inserir a descrição da imagem aqui

Could someone tell me what this could be?

  • @Filipe.Fonseca Some idea friend?

  • @Caputo, Some idea?

  • If the parameter is string, why are you converting to ansistring and then to Pwidechar? What happens if you pass the string directly?

  • Yes, friend, and nothing :/

1 answer

1


while not DMRetaguarda.QConItem.eof do
begin
  for i := 1 to strtoint(edit5.text) do
    begin
      A_Prn_Text(200, 360, 1, 9, 5, 1, 1, 'n', 2, PWideChar(AnsiString(copy(dmretaguarda.qconitemdescricao.asstring, 1, 29))));
      end;
end;

According to my above function which I researched a lot, the problem is that only 1,2,3 and 4 are allowed.

I just changed the numbering of ori, of function:

function  A_Prn_Text     ( x,y,ori,font,typee,hor_factor,ver_factor:integer;mode:char;numeric:integer;data:String):integer;stdcall;external 'WINPPLA.DLL';

and worked :D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.