//honeypot demagogic

 Forum DhammaCitta. Forum Diskusi Buddhis Indonesia

Author Topic: [HELP] Programming  (Read 17238 times)

0 Members and 1 Guest are viewing this topic.

Offline johan3000

  • KalyanaMitta
  • *****
  • Posts: 11.552
  • Reputasi: 219
  • Gender: Male
  • Crispy Lotus Root
Re: [HELP] Programming
« Reply #15 on: 25 August 2009, 08:47:40 AM »
try this..

Code: (visual foxpro) [Select]
local lcTempFile, lcPrinterName, lcFileInRam
SET SAFETY OFF
lcTempFile = ‘c:\coba.txt’
lcPrinterName = SET(”Printer”,2) &&
SET PRINTER TO NAME (lcPrinterName) &&
SET DEVICE TO FILE (lcTempFile)
 [at] PROW(),10 SAY ALLTRIM(CUST_ID)
 [at] PROW(),43 SAY ALLTRIM(PENERIMA)
 [at] PROW()+1,3 SAY ALLTRIM(PENGIRIM)
 [at] PROW()+1,3 SAY ALLTRIM(alam1)
 [at] PROW()+1,3 SAY ALLTRIM(alam2)

 [at] PROW()+1,0 say ‘ ‘ &&biar posisi head printer kembali ke posisi 0(nol)

itu hasil google..

kelemahannya, yaitu gak bisa huruf besar, tapi bisa diakali.. dengan kombinasi kunci pada LX-300
nanti malam coba gw cari dan gw share.. mudah2an masih ada di lappie


Thanks bro Forte dan HatRed, ternyata member2 DC banyak yg doyan programming

kalau contoh2 bro Forte dgn printer2 code tsb ya bagi yg programmer sejati...
memang dua pilihan apakah output printer kita menggunakan PRG atau FRM,
saya pilih FRM karna disana dgn mudah menggantikan ukuran FONT2 utk label pasien.
Memang sih client tsb sukanya ganti2 fontnya, kurang besar, kurang begitu...
malah setelah 2 minggu dia bisa minta perubahan2 yg tidak esensial...

Jadi gw amat takut deh kalau hardCOde dgn printer code tsb..
selain itu nanti kalau ganti printer, harus ngubah program lagi sebab printerKodenya
udah gak berfungsi.

Sebenarnya ganti inkJet lebih mantep lho!... gak berisik, dan tintanyapun lebih murah.
Bagaimana menurut bro? (kalau client sih gak mau keluar duit lagi deh...)

thanks again!
 _/\_ :) :| :D
Nagasena : salah satu dari delapan penyebab matangnya kebijaksanaan dgn seringnya bertanya

Offline hatRed

  • KalyanaMitta
  • *****
  • Posts: 7.400
  • Reputasi: 138
  • step at the right place to be light
Re: [HELP] Programming
« Reply #16 on: 25 August 2009, 08:54:03 AM »

ini kalo di printer inkjet sih aye dah pernah ngeprint Stiker...  (samalah kek label gtu)

cuman di vb :P  itu pake crystal report.... jadi pas buat file crystal reportnya udah di set ukuran stickernya....

nah pas di program tinggal di set aja ukuran kertasnya (sebelomnya di tambah di server properties dulu.. cuman karena merepotkan user jadi di otomatisasi di program)

and voila...


dan kelemahannya cuman gak bisa buat printer yg di network.. (karena pilihan server propertiesnya itu loh)

tapi dapat diakali dengan menyuruh user lebih giat lagi ... :)) itu biasanya di printer Epson (Inkjet ) ada pilihan Page Sizenya di pake User defined aja...
i'm just a mammal with troubled soul



Offline hatRed

  • KalyanaMitta
  • *****
  • Posts: 7.400
  • Reputasi: 138
  • step at the right place to be light
Re: [HELP] Programming
« Reply #17 on: 25 August 2009, 08:59:08 AM »
 [at]  om jo

itu PRG sama FRM apa sih?
i'm just a mammal with troubled soul



Offline johan3000

  • KalyanaMitta
  • *****
  • Posts: 11.552
  • Reputasi: 219
  • Gender: Male
  • Crispy Lotus Root
Re: [HELP] Programming
« Reply #18 on: 25 August 2009, 09:15:44 AM »
Quote
Creating Reports

Standard wisdom suggests creating a report and adding tables to its data environment and setting relations among them, then dragging the controls onto the report, much as you created your frmData form. While this approach is easy to begin with, it can create a debugging nightmare for multi-table reports. In truth, the simplest way to create a report begins with an SQL SELECT statement, and once you've learned a little of this "second" programming language, it's easier to type the SQL code than to use a Wizard or GUI interface.

To make best use of the FoxPro report writer, use SQL to create a denormalized view or cursor of the exact data you want in your report. Refer to the fields in the cursor as MyField only and not MyCursor.MyField. The Report Writer will run the report from whatever cursor, table, or view is in the currently selected work area. The extra effort of adding the controls to the report individually is well worth the time in exchange for the ease of getting the rest of the report working properly.


Figure 9. The most foolproof way to create reports in Visual FoxPro is to select with SQL commands, exactly the way  you want it to appear in your report. This code can be
located in the Click() method of the button that calls the
report, and is usually followed by the REPORT command.Figure 9. The most foolproof way to create reports in Visual FoxPro is to select with SQL commands, exactly the way
 you want it to appear in your report. This code can be
located in the Click() method of the button that calls the
report, and is usually followed by the REPORT command.

Figure 10. Adding fields to a report is as simple as drawing a rectangle, then typing in the name of the field which you want shown in that position. The Visual FoxPro Report Writer easily does group and summary totals, averages, and so on, and with a few Print When tricks can produce some very sophisticated reports.

Create a frmReport with a "Run Report" button. Double click on the "Run Report" button on your frmReport and type the following code in the window, as shown in Figure 9:
SELECT * FROM Customers ;
    INTO CURSOR TempCustomers ;
   ORDER BY Customer

REPORT FORM Customers.FRX TO PRINTER PROMPT PREVIEW

Create a new report by highlighting Reports on the Docs tab of the Project Manager and clicking New. Save your report as "Customers." Using the Report Controls toolbar, click the Field control and draw a rectangle in the detail section of the report as shown in Figure 10. Type "Customer" in the Expression textbox. You can add other fields, and finish off the title band if you want. The Visual FoxPro Report Writer has many other capabilities including group and summary computations that I'll leave for you to discover. Getting the most out of the Report Writer is mostly a matter of assembling the data in the order and way you want it to appear, and learning a few tricks with Print When and formatting.


http://www.melbpc.org.au/pcupdate/2108/2108article4.htm


PRG dlm vFoxPro adalah CODE (file yg mengisi program tertulis, spt source code VB)
FRM, FRX adalah file yg bersisi layout dan field, header, footer, dll yg berhubungan dgn REPORT
   (FRM bentuk aslinya, FRX setelah dicompile...kira2 begitu deh, soalnya udah agak lupa)

Jadi keuntungan menggunakan fasilitas FRM, anda cukup menggeser, menambah, menghapus
  field2 mapun label2 dlm keadaan WYWYG (what U see what U get) graphic layout.
spt pada figure 10.

Dan utk report2 lebih canggih lagi bisa gunakan CRYSTAL REPORT yg konon bekerja sama dgn banyak programming Language.

semoga cukup jelas!  ;D

[at]  om jo

itu PRG sama FRM apa sih?
« Last Edit: 25 August 2009, 09:17:48 AM by johan3000 »
Nagasena : salah satu dari delapan penyebab matangnya kebijaksanaan dgn seringnya bertanya

Offline hatRed

  • KalyanaMitta
  • *****
  • Posts: 7.400
  • Reputasi: 138
  • step at the right place to be light
Re: [HELP] Programming
« Reply #19 on: 25 August 2009, 09:23:14 AM »
oo...

berarti sama ya.. kalo pake VB6.

file FRM itu cuma kode berisi layout serta code source sedangkan FRX adalah file2 biner yg integrasikan ke layout Form... (kek gambar de el el )

berarti kalo di FoxPro di pisahin ya  kode GUI sama kode Programnya ;D

btw boleh gantian nanyanya gak...

ini i dah pernah nanya disini lum ya :-?

cuman mo nanya.... trik buat dapet tampilan kek vista gitu.... yg kalo muncul dialog box... layar backgroundnya jadi item..

trik sementara sih pake form laen yg dijadiin layer.. (hitam dan transparant)
« Last Edit: 25 August 2009, 09:25:10 AM by hatRed »
i'm just a mammal with troubled soul



Offline Forte

  • Sebelumnya FoxRockman
  • KalyanaMitta
  • *****
  • Posts: 16.577
  • Reputasi: 458
  • Gender: Male
  • not mine - not me - not myself
Re: [HELP] Programming
« Reply #20 on: 25 August 2009, 09:26:35 AM »
yeah.. fox rock.. :))
Ini bukan milikku, ini bukan aku, ini bukan diriku
6 kelompok 6 - Chachakka Sutta MN 148

Offline johan3000

  • KalyanaMitta
  • *****
  • Posts: 11.552
  • Reputasi: 219
  • Gender: Male
  • Crispy Lotus Root
Re: [HELP] Programming
« Reply #21 on: 25 August 2009, 09:28:37 AM »
kalo gak salah itu untuk ukuran2 kertas di windows...

kalo buat c90 tergantung neh.. print lewat kodeprogram atau pake aplikasi printer c90..

tapi bukannya ngeprint di lx-300 ???

printer LX-300+ punya client, jadi gw cuma nyoba ngecek di C90 apakah
newForm yg dibuat myLabel nongol ?
Nagasena : salah satu dari delapan penyebab matangnya kebijaksanaan dgn seringnya bertanya

Offline tesla

  • KalyanaMitta
  • *****
  • Posts: 6.426
  • Reputasi: 125
  • Gender: Male
  • bukan di surga atau neraka, hanya di sini
Re: [HELP] Programming --- about overriding constructor in Pascal
« Reply #22 on: 21 December 2010, 02:37:32 PM »
gan... nanya donk... kok yg ini ga bisa di compile ya?

Quote
TATCommandDevice = class(TObject)
public
  constructor Create(const AName: String = '');
end;

TATModem = class(TATCommandDevice)
public
  constructor Create(const AName: String = ''); override;
end;

error di compilenya:
Code: [Select]
Error: there is no method in an accesstor class to be overriden: "constructor TATModem.Create(const AnsiString);"

padahal kan di ancestornya ada tuh method...
kenapa yah gan?
Lepaskan keserakahan akan kesenangan. Lihatlah bahwa melepaskan dunia adalah kedamaian. Tidak ada sesuatu pun yang perlu kau raup, dan tidak ada satu pun yang perlu kau dorong pergi. ~ Buddha ~

Offline seniya

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 3.469
  • Reputasi: 169
  • Gender: Male
  • Om muni muni mahamuni sakyamuni svaha
Re: [HELP] Programming
« Reply #23 on: 21 December 2010, 07:47:53 PM »
gan... nanya donk... kok yg ini ga bisa di compile ya?

error di compilenya:
Code: [Select]
Error: there is no method in an accesstor class to be overriden: "constructor TATModem.Create(const AnsiString);"

padahal kan di ancestornya ada tuh method...
kenapa yah gan?

Kayaknya constructor-nya harus dideklarasikan sebagai virtual karena hanya function/procedure virtual aja yang bisa di-override. Dari Delphi Help dikatakan:

Quote
Virtual and dynamic methods

To make a method virtual or dynamic, include the virtual or dynamic directive in its declaration. Virtual and dynamic methods, unlike static methods, can be overridden in descendant classes. When an overridden method is called, the actual (runtime) type of the class or object used in the method call--not the declared type of the variable--determines which implementation to activate.

To override a method, redeclare it with the override directive. An override declaration must match the ancestor declaration in the order and type of its parameters and in its result type (if any).

In the following example, the Draw method declared in TFigure is overridden in two descendant classes.

Code: [Select]
type
  TFigure = class
    procedure Draw; virtual;
  end;
  TRectangle = class(TFigure)
    procedure Draw; override;
  end;
  TEllipse = class(TFigure)
    procedure Draw; override;
  end;

Given these declarations, the following code illustrates the effect of calling a virtual method through a variable whose actual type varies at runtime.

Code: [Select]
var
  Figure: TFigure;
begin
  Figure := TRectangle.Create;
  Figure.Draw;  // calls TRectangle.Draw
  Figure.Destroy;
  Figure := TEllipse.Create;
  Figure.Draw;  // calls TEllipse.Draw
  Figure.Destroy;
end;

Only virtual and dynamic methods can be overridden. All methods, however, can be overloaded; see Overloading methods.

Virtual versus dynamic

Virtual and dynamic methods are semantically equivalent. They differ only in the implementation of method-call dispatching at runtime. Virtual methods optimize for speed, while dynamic methods optimize for code size.

In general, virtual methods are the most efficient way to implement polymorphic behavior. Dynamic methods are useful when a base class declares many overridable methods which are inherited by many descendant classes in an application, but only occasionally overridden.

Note:
Only use dynamic methods if there is a clear, observable benefit. Generally, use virtual methods.

dan

Quote
Overriding methods

Overriding a method means extending or refining it, rather than replacing it. A descendant class can override any of its inherited virtual methods.

To override a method in a descendant class, add the directive override to the end of the method declaration.

Overriding a method causes a compilation error if

* The method does not exist in the ancestor class.
* The ancestor's method of that name is static.
* The declarations are not otherwise identical (number and type of arguments parameters differ).

Btw, saya coba coding anda di Delphi 7, pesan error yang keluar adalah "cannot override a static method"
"Holmes once said not to allow your judgement to be biased by personal qualities, and emotional qualities are antagonistic to clear reasoning."
~ Shinichi Kudo a.k.a Conan Edogawa

Offline tesla

  • KalyanaMitta
  • *****
  • Posts: 6.426
  • Reputasi: 125
  • Gender: Male
  • bukan di surga atau neraka, hanya di sini
Re: [HELP] Programming
« Reply #24 on: 22 December 2010, 09:52:41 AM »
thanks... udah solved dg keyword reintroduce

jadi...
constructor Create(const AName: String = ''); override; reintroduce;

saya jg googling kemana2...
kesimpulannya:
keyword override artinya adalah meng-implement-kan abstract method pada ancestor class.
keyword reintroduce artinya adalah meng-override-kan method pada ancestor class.

penamaan yg agak berbeda...




oh ya, tambahan: saya pakai Lazarus dg compiler FPC :)
Lepaskan keserakahan akan kesenangan. Lihatlah bahwa melepaskan dunia adalah kedamaian. Tidak ada sesuatu pun yang perlu kau raup, dan tidak ada satu pun yang perlu kau dorong pergi. ~ Buddha ~

Offline morpheus

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 2.750
  • Reputasi: 110
  • Ragu pangkal cerah!
Re: [HELP] Programming
« Reply #25 on: 22 December 2010, 09:56:03 AM »
pascal tambah ancur sekarang...
* I'm trying to free your mind, Neo. But I can only show you the door. You're the one that has to walk through it
* Neo, sooner or later you're going to realize just as I did that there's a difference between knowing the path and walking the path

Offline Indra

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 14.819
  • Reputasi: 451
  • Gender: Male
Re: [HELP] Programming
« Reply #26 on: 22 December 2010, 09:59:01 AM »
pascalnya masih ok, delphi yg mengecewakan

Offline tesla

  • KalyanaMitta
  • *****
  • Posts: 6.426
  • Reputasi: 125
  • Gender: Male
  • bukan di surga atau neraka, hanya di sini
Re: [HELP] Programming
« Reply #27 on: 22 December 2010, 10:00:40 AM »
pascal hancur gmn?
delphi terjun bebas gmn?

... Lazarus itu kan meniru Delphi... kalau Delphi udah uzur, Lazarus ikut?
Lepaskan keserakahan akan kesenangan. Lihatlah bahwa melepaskan dunia adalah kedamaian. Tidak ada sesuatu pun yang perlu kau raup, dan tidak ada satu pun yang perlu kau dorong pergi. ~ Buddha ~

Offline seniya

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 3.469
  • Reputasi: 169
  • Gender: Male
  • Om muni muni mahamuni sakyamuni svaha
Re: [HELP] Programming
« Reply #28 on: 22 December 2010, 12:48:32 PM »
Kenapa Delphi ditinggalkan & Lazarus lbh disukai? Apa aja kelebihan Lazarus dibanding Delphi? Selain masalah lisensi tentunya....

Ane pernah coba Lazurus sekitar 2 th yg lalu,memang sangat mirip dg Delphi,tp wkt itu Lazarus msh baru & msh dlm tahap pengembangan.
"Holmes once said not to allow your judgement to be biased by personal qualities, and emotional qualities are antagonistic to clear reasoning."
~ Shinichi Kudo a.k.a Conan Edogawa

Offline Indra

  • Global Moderator
  • KalyanaMitta
  • *****
  • Posts: 14.819
  • Reputasi: 451
  • Gender: Male
Re: [HELP] Programming
« Reply #29 on: 22 December 2010, 12:55:43 PM »
sebelumnya saya termasuk orang yg fanatik sama delphi.

tapi sekarang trend programming sudah mengarah kepada open source dan cross platform, sedangkan delphi masih nempel sama M$. Delphi XE yg terbaru, juga masih belum mengusung cross platform yg sangat ditunggu2 oleh para delepoper seluruh dunia. hal ini membuat delphi jadi tidak populer. alternatif pengganti delphi adalah lazarus. tapi lazarus tumbuh terlalu lambat, tidak mampu mengejar ketinggalan.