Harap posting sesuai dengan Kategorinya agar anggota yang lain mudah dalam bernavigasi!
0 Members and 1 Guest are viewing this topic.
IF MessageBox('Apakah benar data ini akan di hapus?',36,"Perhatian!')=6 delete bla bla blaENDIF
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'
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 pnReturnENDFUNC
UT ya.....
Kalau itu mah saya juga masih bermasalah
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.ENDDEFINEDEFINE 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"ENDDEFINEDEFINE 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"ENDDEFINEDEFINE 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"ENDDEFINEDEFINE CLASS btg_no_buttons AS btg_container Name = "no_buttons"ENDDEFINEDEFINE CLASS btg_ok AS btg_container Name = "btg_ok" ADD OBJECT mb_ok1 AS mb_ok WITH ; Top = 9, ; Left = 80, ; Name = "Mb_ok1"ENDDEFINEDEFINE 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"ENDDEFINEDEFINE 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"ENDDEFINEDEFINE 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"ENDDEFINEDEFINE 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"ENDDEFINEDEFINE 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"ENDDEFINEDEFINE 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"ENDDEFINEDEFINE CLASS mb_button AS commandbutton Height = 29 Width = 60 FontName = "MS Sans Serif" Caption = "" i_rtnvalue = 1 Name = "mb_button"ENDDEFINEDEFINE CLASS mb_abort AS mb_button Caption = "\<Abort" i_rtnvalue = 3 Name = "mb_abort"ENDDEFINEDEFINE CLASS mb_cancel AS mb_button Caption = "Cancel" i_rtnvalue = 2 Name = "mb_cancel"ENDDEFINEDEFINE CLASS mb_ignore AS mb_button Caption = "\<Ignore" i_rtnvalue = 5 Name = "mb_ignore"ENDDEFINEDEFINE CLASS mb_no AS mb_button Caption = "\<No" i_rtnvalue = 7 Name = "mb_no"ENDDEFINEDEFINE CLASS mb_ok AS mb_button Caption = "OK" Name = "mb_ok"ENDDEFINEDEFINE CLASS mb_retry AS mb_button Caption = "\<Retry" i_rtnvalue = 4 Name = "mb_retry"ENDDEFINEDEFINE CLASS mb_yes AS mb_button Caption = "\<Yes" i_rtnvalue = 6 Name = "mb_yes"ENDDEFINEDEFINE CLASS mb_main AS line Height = 67 Width = 307 Name = "mb_main" PROCEDURE execute ENDPROCENDDEFINEDEFINE 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 ENDPROCENDDEFINEDEFINE 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
UT ya.....Ah.. mesti alerta itu? harus ada Foxtool.fll?Betul...Kalau itu mah saya juga masih bermasalah