Author Topic: Membuat MessageBox versi Indonesia  (Read 20196 times)

0 Members and 1 Guest are viewing this topic.

Offline tejos

  • SET STUDY ON
  • Global Moderator
  • Hero Member
  • *
  • Posts: 1.703
Membuat MessageBox versi Indonesia
« on: April 08, 2008, 12:54:19 PM »
Dalam pemrograman VFP, kita pasti dan kenal betul apa yang namanya MESSAGEBOX, yaitu membuat pesan-pesan kepada user.
Misalnya :
Code: [Select]
IF MessageBox('Apakah benar data ini akan di hapus?',36,"Perhatian!')=6
    delete bla bla bla
ENDIF


Tapi kelemahannya :
1. Tampilan standar VFP/windows (warna, huruf, icon)
2. Tombolnya musti 'Yes' dan 'No'

Pertanyaannya :
Bagaimana agar kita bisa mengatasi kelemahan yang ada itu?
Maksul lhoh...

1. Tampilan bisa sesuai keinginan kita.
2. Huruf bisa di ganti baik jenis maupun besarnya.
3. Iconnya bisa diganti sesuai gambar keinginan kita.
4. Tombol bisa menjadi 'Ya' dan 'Tidak'

Jawabnya? mau? ikuti pesan-pesan berikut ini. Jadi jangan kemana-mana.
http://isa-tech.6te.net/home/?pilih=dl&mod=yes&aksi=lihat&kategori=VisualFoxPro&kid=8

 :icon_sunny: :icon_sunny: :icon_sunny:

Terima kasih untuk Mr. Hedi - Palembang, Mr. Rudy - Jakarta atas kodingnya...
Maaf saya utak-atik-utak :icon_thumright:
http://www.isakomputer.com


Salam,
***BTGL - Belajar Terus Gitu Lhoh.....***

Offline s1nh4n

  • Junior Member
  • *
  • Posts: 143
  • Awesome
Re: Membuat MessageBox versi Indonesia
« Reply #1 on: April 08, 2008, 01:32:37 PM »
Nah ini...Joss tenan...
Matur nuwun Pak....
Psalms 1

Offline sinyonamakoe

  • Global Moderator
  • Hero Member
  • *
  • Posts: 1.198
Re: Membuat MessageBox versi Indonesia
« Reply #2 on: April 08, 2008, 01:59:07 PM »
Hi Pak.Tejos, apa kabar ?

Nimbrung ya...sekalian berguru bos... :icon_salut:

Tapi kelemahannya :
1. Tampilan standar VFP/windows (warna, huruf, icon)
2. Tombolnya musti 'Yes' dan 'No'

Pertanyaannya :
Bagaimana agar kita bisa mengatasi kelemahan yang ada itu?
Maksul lhoh...

1. Tampilan bisa sesuai keinginan kita.
2. Huruf bisa di ganti baik jenis maupun besarnya.
3. Iconnya bisa diganti sesuai gambar keinginan kita.
4. Tombol bisa menjadi 'Ya' dan 'Tidak'

Saya udah lama dapat Class ini, dari UT kalo g salah....tapi selama pake, ada beberapa masalah yang blm bisa saya pecahkan sampai saat ini.

beberapa diantaranya adalah :

- Class ini blm bisa auto-indent

seperti gambar ini (bawaan VFP)



- yang berkotak cyan: string akan otomatis (di-enter) jika memang melampaui batas tertentu
- yang berkotak kuning : jika icon di hilangkan, maka controlbox juga ikut hilang, jadi tidak bisa memanfaatkan tombol 'X' (kotak hijau)

monggo .... saya tunggu bantuannya

Offline tejos

  • SET STUDY ON
  • Global Moderator
  • Hero Member
  • *
  • Posts: 1.703
Re: Membuat MessageBox versi Indonesia
« Reply #3 on: April 08, 2008, 02:31:36 PM »
UT ya.....
Ah.. mesti alerta itu?
harus ada Foxtool.fll?
Betul...
Kalau itu mah saya juga masih bermasalah
http://www.isakomputer.com


Salam,
***BTGL - Belajar Terus Gitu Lhoh.....***

Offline Batman Kasarung

  • Senior Member
  • *
  • Posts: 469
  • Pemula Banget
    • Mari Belajar Lewat Internet !
Re: Membuat MessageBox versi Indonesia
« Reply #4 on: April 09, 2008, 08:49:39 AM »
Mau maumau...
Visual Foxpro.... Enjoy aja!
http://kaewin.co.cc
http://dksoftware.co.cc

Offline a17dh4

  • Senior Member
  • *
  • Posts: 484
  • Keep Trying, trying and trying....
Re: Membuat MessageBox versi Indonesia
« Reply #5 on: April 09, 2008, 08:52:21 AM »
alternatif lain :

Quote

FUNCTION MsgBox(cMessage, nImage, nButton, nActive, cTitle)
  PUBLIC pnReturn
  LOCAL aImage, aMaxButton, aButton, cActive, nLButton, nLButton, nLMessage, nLTitle, nWidth

 
*!*     IF TYPE("oApp.oToolbar") = "O"
*!*       oApp.oToolBar.SetAll("Enabled",.F.)
*!*     ENDIF
*!*     IF TYPE("oApp.oPanel") = "O"
*!*       oApp.oPanel.SetAll("Enabled",.F.)
*!*     ENDIF
 
  ACTIVATE MENU _msysmenu NOWAIT
   
  DIMENSION aImage[4]
  aImage[1] =CURDIR()+"\graphics\icombox01.ico"     && Stop sign 
  aImage[2] =CURDIR()+"\graphics\icombox02.ico"     && Question mark
  aImage[3] =CURDIR()+"\graphics\icombox03.ico"     && Exclamation point
  aImage[4] =CURDIR()+"\graphics\icombox04.ico"     && Information (i) icon

  DIMENSION aMaxButton[5]
  aMaxButton[1] =1
  aMaxButton[2] =2
  aMaxButton[3] =3
  aMaxButton[4] =2
  aMaxButton[5] =2

  DIMENSION aButton[aMaxButton[nButton]]
  DO CASE
     CASE nButton=1
          aButton[1] ='\<Ya'
     CASE nButton=2
          aButton[1] ='\<Ya'
          aButton[2] ='\<Batal'
     CASE nButton=3
          aButton[1] ='\<Ya'
          aButton[2] ='\<Tidak'
          aButton[3] ='\<Batal'
     CASE nButton=4
          aButton[1] ='\<Ya'
          aButton[2] ='\<Tidak'
     CASE nButton=5
          aButton[1] ='\<Coba'
          aButton[2] ='\<Batal'
  ENDCASE

  IF aMaxButton[nButton] = 3
     cActive =IIF( nActive = 1, '123', IIF( nActive = 2, '231', '312' ) )
  ELSE
     cActive =IIF( nActive = 1, '12', '21' )
  ENDIF
 
  *----- perhitungan lebar windows/form
  cMessage  = ALLTRIM(cMessage)
  nLButton  = (aMaxButton[nButton] * 80) + ((aMaxButton[nButton]-1) * 10)
  nLMessage = (( TXTWIDTH(cMessage,'MS Sans Serif',9) * FONTMETRIC(6,'MS Sans Serif',9) / 5 ) * 5 )
  nLTitle   = ( TXTWIDTH(cTitle,'MS Sans Serif',9) * FONTMETRIC(6,'MS Sans Serif',9) / 5 ) * 5
  nWidth    = IIF( nLButton+40 > nLMessage+90, nLButton+40, IIF( nLMessage+90 > nLTitle, nLMessage+90, nLTitle ) )
 
*!*     nLMessage = (( TXTWIDTH(cMessage,'Arial',9) * FONTMETRIC(6,'Arial',9) / FONTMETRIC(6) ) * 5 )
*!*     nLTitle   = ( TXTWIDTH(cTitle,'Arial',9) * FONTMETRIC(6,'Arial',9) / FONTMETRIC(6) ) * 5

 
  *----- create object
  frmMyForm = CREATEOBJECT('MyForm')  && Create a Form
  frmMyForm.AddObject('Image','MyImage') 
  frmMyForm.AddObject('Label','MyLabel')
 
  frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Cmnd button #1
  frmMyForm.cmdCmndBtn1.Visible =.T.  && Command button visible #1
  IF aMaxButton[nButton] > 1 AND aMaxButton[nButton] <= 3
     frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Cmnd button #2
     frmMyForm.cmdCmndBtn2.Visible =.T.  && Command button visible #2
  ENDIF
  IF aMaxButton[nButton] = 3
     frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Cmnd button #3
     frmMyForm.cmdCmndBtn3.Visible =.T.  && Command button visible #3
  ENDIF

  *----- Properties form
  frmMyForm.FontName ="MS Sans Serif"
  frmMyForm.FontSize =9
  frmMyForm.Width =nWidth 
  frmMyForm.AutoCenter =.T.
  frmMyForm.Caption =cTitle
  frmMyForm.AlwaysOnTop =.T.

  *----- Properties image/logo
  frmMyForm.Image.Picture =aImage[nImage]
  frmMyForm.Image.Left =(nWidth-nLMessage-50)/2
 
  *----- Properties Label/Message
  frmMyForm.Label.Caption =cMessage
  frmMyForm.Label.Left =((nWidth-nLMessage-50)/2)+50

  *----- Properties command button
  frmMyForm.cmdCmndBtn1.Left = (nWidth-nLButton)/2
  frmMyForm.cmdCmndBtn1.TabIndex =VAL(LEFT(cActive,1))
  IF aMaxButton[nButton] > 1 AND aMaxButton[nButton] <= 3
     frmMyForm.cmdCmndBtn2.Left = ((nWidth-nLButton)/2)+80+10
     frmMyForm.cmdCmndBtn2.TabIndex =VAL(SUBSTR(cActive,2,1))
  ENDIF
  IF aMaxButton[nButton] = 3
     frmMyForm.cmdCmndBtn3.Left = ((nWidth-nLButton)/2)+(80*2)+(10*2)
     frmMyForm.cmdCmndBtn3.TabIndex =VAL(RIGHT(cActive,1))
  ENDIF

  SET BELL TO CURDIR()+'\sound\chimes.wav',0     &&blip.wav',0
  ??C H R (7)
  SET BELL TO
  frmMyForm.SHOW(1)    &&SHOW  && Display the form
  READ EVENTS  && Start event processing

  RETURN pnReturn
ENDFUNC


-=>> Go FoxPro <<=-

Offline tejos

  • SET STUDY ON
  • Global Moderator
  • Hero Member
  • *
  • Posts: 1.703
Re: Membuat MessageBox versi Indonesia
« Reply #6 on: April 09, 2008, 09:24:00 AM »
Nah akhirnya banyak versi to...
Ini yang dinamakan forum ....
bagi2 ilmu...

OK silahkan yang lain gabung aja di sini ....
biar referensinya lebih banyak...
Tinggal pilih... tinggal pilih... :director: :director:
 :icon_thumright:
http://www.isakomputer.com


Salam,
***BTGL - Belajar Terus Gitu Lhoh.....***

Offline sinyonamakoe

  • Global Moderator
  • Hero Member
  • *
  • Posts: 1.198
Re: Membuat MessageBox versi Indonesia
« Reply #7 on: April 09, 2008, 10:44:42 AM »
UT ya.....

Saya dapat dari sini : http://www.vfug.org

Kalau itu mah saya juga masih bermasalah

Lha piye supoyo iso jal ? nuwun pencerahanipun ....


Offline s1nh4n

  • Junior Member
  • *
  • Posts: 143
  • Awesome
Re: Membuat MessageBox versi Indonesia
« Reply #8 on: April 09, 2008, 01:21:54 PM »
Kalo saya dapet ini...
cuma bahasanya belum disesuaikan ke Indonesia...
Code: [Select]
oForm=CREATEOBJECT("message_box")
oForm.addobject("btg_abort_retry_ignore","btg_abort_retry_ignore")
oForm.show()

Or
oForm=CREATEOBJECT("message_box")
oForm.addobject("btg_ok_cancel","btg_ok_cancel")
oForm.show()




DEFINE CLASS btg_container AS container
    top = 60
    left = 30
    Width = 220
    Height = 47
    BackStyle = 0
    BorderWidth = 0
    Name = "btg_container"
    visible = .t.
ENDDEFINE
DEFINE CLASS btg_abort_retry_ignore AS btg_container
    Name = "btg_abort_retry_ignore"
    ADD OBJECT mb_abort1 AS mb_abort WITH ;
        Top = 9, ;
        Left = 7, ;
        Name = "Mb_abort1"
        ADD OBJECT mb_retry1 AS mb_retry WITH ;
        Top = 9, ;
        Left = 80, ;
        Name = "Mb_retry1"
    ADD OBJECT mb_ignore1 AS mb_ignore WITH ;
        Top = 9, ;
        Left = 153, ;
        Name = "Mb_ignore1"
ENDDEFINE
DEFINE CLASS btg_accept_decline AS btg_container
    Name = "btg_accept_decline"
    ADD OBJECT mb_yes1 AS mb_yes WITH ;
        Top = 9, ;
        Left = 19, ;
        Width = 84, ;
        Caption = "I \<Accept", ;
        Name = "Mb_yes1"
    ADD OBJECT mb_no1 AS mb_no WITH ;
        Top = 9, ;
        Left = 117, ;
        Height = 29, ;
        Width = 84, ;
        Caption = "I \<Decline", ;
        Name = "Mb_no1"
ENDDEFINE
DEFINE CLASS btg_cool AS btg_container
    Name = "btg_cool"
    ADD OBJECT mb_ok1 AS mb_ok WITH ;
        Top = 9, ;
        Left = 80, ;
        Caption = "Cool!", ;
        Name = "Mb_ok1"
ENDDEFINE
DEFINE CLASS btg_no_buttons AS btg_container
    Name = "no_buttons"
ENDDEFINE
DEFINE CLASS btg_ok AS btg_container
    Name = "btg_ok"
    ADD OBJECT mb_ok1 AS mb_ok WITH ;
        Top = 9, ;
        Left = 80, ;
        Name = "Mb_ok1"
ENDDEFINE
DEFINE CLASS btg_ok_cancel AS btg_container
    Name = "btg_ok_cancel"
    ADD OBJECT mb_ok1 AS mb_ok WITH ;
        Top = 9, ;
        Left = 42, ;
        Name = "Mb_ok1"
    ADD OBJECT mb_cancel1 AS mb_cancel WITH ;
        Top = 9, ;
        Left = 118, ;
        Name = "Mb_cancel1"
ENDDEFINE
DEFINE CLASS btg_retry_cancel AS btg_container
    Name = "btg_retry_cancel"
    ADD OBJECT mb_retry1 AS mb_retry WITH ;
        Top = 9, ;
        Left = 38, ;
        Name = "Mb_retry1"
    ADD OBJECT mb_cancel1 AS mb_cancel WITH ;
        Top = 9, ;
        Left = 121, ;
        Name = "Mb_cancel1"
ENDDEFINE
DEFINE CLASS btg_sowhat AS btg_container
    Name = "btg_sowhat"
    ADD OBJECT mb_ok1 AS mb_ok WITH ;
        Top = 9, ;
        Left = 71, ;
        Height = 29, ;
        Width = 77, ;
        Caption = "So What!", ;
        Name = "Mb_ok1"
ENDDEFINE
DEFINE CLASS btg_thanks_nothanks AS btg_container
    Name = "btg_thanks_nothanks"
    ADD OBJECT mb_yes1 AS mb_yes WITH ;
        Top = 9, ;
        Left = 19, ;
        Width = 84, ;
        Caption = "\<Thanks", ;
        Name = "Mb_yes1"
    ADD OBJECT mb_no1 AS mb_no WITH ;
        Top = 9, ;
        Left = 117, ;
        Height = 29, ;
        Width = 84, ;
        Caption = "\<No Thanks", ;
        Name = "Mb_no1"
ENDDEFINE
DEFINE CLASS btg_yes_no AS btg_container
    Name = "btg_yes_no"
    ADD OBJECT mb_yes1 AS mb_yes WITH ;
        Top = 9, ;
        Left = 42, ;
        Name = "Mb_yes1"
    ADD OBJECT mb_no1 AS mb_no WITH ;
        Top = 9, ;
        Left = 118, ;
        Name = "Mb_no1"
ENDDEFINE
DEFINE CLASS btg_yes_no_cancel AS btg_container
    Name = "btg_yes_no_cancel"
    ADD OBJECT mb_yes1 AS mb_yes WITH ;
        Top = 9, ;
        Left = 8, ;
        Name = "Mb_yes1"
    ADD OBJECT mb_no1 AS mb_no WITH ;
        Top = 9, ;
        Left = 80, ;
        Name = "Mb_no1"
    ADD OBJECT mb_cancel1 AS mb_cancel WITH ;
        Top = 9, ;
        Left = 152, ;
        Name = "Mb_cancel1"
ENDDEFINE
DEFINE CLASS mb_button AS commandbutton
    Height = 29
    Width = 60
    FontName = "MS Sans Serif"
    Caption = ""
    i_rtnvalue = 1
    Name = "mb_button"
ENDDEFINE
DEFINE CLASS mb_abort AS mb_button
    Caption = "\<Abort"
    i_rtnvalue = 3
    Name = "mb_abort"
ENDDEFINE
DEFINE CLASS mb_cancel AS mb_button
    Caption = "Cancel"
    i_rtnvalue = 2
    Name = "mb_cancel"
ENDDEFINE
DEFINE CLASS mb_ignore AS mb_button
    Caption = "\<Ignore"
    i_rtnvalue = 5
    Name = "mb_ignore"
ENDDEFINE
DEFINE CLASS mb_no AS mb_button
        Caption = "\<No"
    i_rtnvalue = 7
    Name = "mb_no"
ENDDEFINE
DEFINE CLASS mb_ok AS mb_button
    Caption = "OK"
    Name = "mb_ok"
ENDDEFINE
DEFINE CLASS mb_retry AS mb_button
    Caption = "\<Retry"
    i_rtnvalue = 4
    Name = "mb_retry"
ENDDEFINE
DEFINE CLASS mb_yes AS mb_button
        Caption = "\<Yes"
    i_rtnvalue = 6
    Name = "mb_yes"
ENDDEFINE
DEFINE CLASS mb_main AS line
    Height = 67
    Width = 307
    Name = "mb_main"
    PROCEDURE execute
    ENDPROC
ENDDEFINE
DEFINE CLASS message_box AS form
    Height = 110
    Width = 287
    ShowWindow = 1
    DoCreate = .T.
    AutoCenter = .T.
    BorderStyle = 2
    Caption = ""
    ControlBox = .t.
    MaxButton = .F.
    MinButton = .F.
    WindowType = 1
    AlwaysOnTop = .T.
    *-- Return Value from the Messagebox
    i_rtnvalue = 0
    Name = "message_box"

    *-- Array containing settings for messagebox object
    DIMENSION a_settings[1]
    PROTECTED caption
    ADD OBJECT tmrclose AS timer WITH ;
        Top = 73, ;
        Left = 15, ;
        Height = 23, ;
        Width = 23, ;
        Enabled = .F., ;
        Name = "tmrClose"
    ADD OBJECT imgicon AS image WITH ;
        BackStyle = 1, ;
        Height = 32, ;
        Left = 16, ;
        Top = 15, ;
        Visible = .F., ;
        Width = 32, ;
        Name = "imgIcon"
    ADD OBJECT shpcover AS shape WITH ;
        Top = 46, ;
        Left = 10, ;
        Height = 14, ;
        Width = 17, ;
        BorderStyle = 0, ;
        Name = "shpCover"
    ADD OBJECT edit1 AS editbox WITH ;
        FontName = "MS Sans Serif", ;
        BackStyle = 0, ;
        BorderStyle = 0, ;
        Height = 16, ;
        Left = 68, ;
        Margin = 0, ;
        visible = .f.,;
        ScrollBars = 0, ;
        SpecialEffect = 1, ;
        Top = 13, ;
        Width = 207, ;
        IntegralHeight = .T., ;
        Name = "Edit1"
*!*        *-- Configures the message_box object
    PROCEDURE configure
    ENDPROC
ENDDEFINE
DEFINE CLASS message_box_sdi AS message_box
    ShowWindow = 2
    DoCreate = .T.
    Name = "message_box_sdi"
    tmrClose.Name = "tmrClose"
    imgIcon.Name = "imgIcon"
    shpCover.Name = "shpCover"
    Edit1.Name = "Edit1"
ENDDEFINE

Psalms 1

Offline sinyonamakoe

  • Global Moderator
  • Hero Member
  • *
  • Posts: 1.198
Re: Membuat MessageBox versi Indonesia
« Reply #9 on: May 05, 2008, 03:07:53 PM »
UT ya.....
Ah.. mesti alerta itu?
harus ada Foxtool.fll?
Betul...
Kalau itu mah saya juga masih bermasalah

Akhirnya...dengan kesabaran dan usaha...class ini bisa saya modif sesuai harapan, murni class + dll kecil untuk custom sound dan icon, tanpa utak-utik foxtools.fll (krn saya g bisa)  :tongue3:

Class ini sangat mirip dengan fungsi _MessageBox bawaan VFP, tapi ada beberapa feature yang (menurut saya) berbeda :
 -  icon dan sound dapat diganti sesuai keinginan.
 - caption tombol bisa diganti sesuai bahasa masing-masing.

Feature yang sama dengan VFP :
 - prolog pesan udah auto indent, sesuai dengan punya VFP. jadi meskipun input pesan yang kita masukkan panjang, otomatis langsung dipotong dan ikut baris dibawahnya.
 - timeout value


Default VFP Messagebox


Custom Messagebox


Source komplit akan segera saya upload disini (jika diperbolehkan)....so jika ada yang berminat, harap bersabar.


Special thank's to :
- Fernando D. Bozzo in Madrid / EspaƱa for "lib_comctl_aux.vcx"
- VFP for sample solution (MCI is Rock)
« Last Edit: May 05, 2008, 03:24:42 PM by sinyonamakoe »

Offline Batman Kasarung

  • Senior Member
  • *
  • Posts: 469
  • Pemula Banget
    • Mari Belajar Lewat Internet !
Re: Membuat MessageBox versi Indonesia
« Reply #10 on: May 05, 2008, 03:30:23 PM »
inyong mau nieh... mas Budi... monggo di aplud!!
Visual Foxpro.... Enjoy aja!
http://kaewin.co.cc
http://dksoftware.co.cc

Offline teuku arfan

  • Junior Member
  • *
  • Posts: 234
  • Always Smile..
Re: Membuat MessageBox versi Indonesia
« Reply #11 on: May 05, 2008, 09:49:39 PM »
Oke tu, ijin upload ya senior2.. Kalu bhs indo bisa brti bhs aceh juga bisa nie..
Keren2..


Dengan agama hidup menjadi terarah, dengan Ilmu hidup menjadi mudah & dengan seni hidup menjadi indah..

Offline taz

  • Administrator
  • Hero Member
  • *
  • Posts: 2.515
  • Do SEARCH berfore post guys!
    • http://fox-id.com
Re: Membuat MessageBox versi Indonesia
« Reply #12 on: May 06, 2008, 01:23:54 PM »
kan bisa buat sendiri,
tinggal buat class form (atau bahkan form), isikan editbox untuk container messagenya, tambahkan tombol dll.
seperti yang pak tejos contohkan

[attachment deleted by admin]
- Fox-id.org is KiOSS Project exclusive member -


Offline cyber_robFOX

  • Full Member
  • *
  • Posts: 96
  • Indonesian FoxPro Community.
Re: Membuat MessageBox versi Indonesia
« Reply #13 on: May 07, 2008, 08:58:43 AM »
waduh apik tenan yo....!!! :director:

ada zetoc free lg g ya..... :tongue3:


Hebat Pak Taz...
::: maju terus FOX-ID Sukses Selalu untuk Kita Semua :::
http://www.robbex.blogspot.com/

Offline taz

  • Administrator
  • Hero Member
  • *
  • Posts: 2.515
  • Do SEARCH berfore post guys!
    • http://fox-id.com
Re: Membuat MessageBox versi Indonesia
« Reply #14 on: May 07, 2008, 02:47:09 PM »
saya sedang mempersiapkan untuk share custom messagebox yang saya ambilkan dari zetoc pro 3 (setelah ada ijin dari sodara saya yang punya aplikasi). nanti saya post kemari.
Salut buat pak tejos yang memulai thread ini.
Topic saya buat STICKY.
- Fox-id.org is KiOSS Project exclusive member -