Mapping Clipper Alert() to MsgYesNo()
Moderator: Rathinagiri
-
- Posts: 140
- Joined: Tue Mar 03, 2009 8:59 am
Mapping Clipper Alert() to MsgYesNo()
Hi
I use Alert() everywhere in FAS4HMG as my dialog of choice.
Do you think it is a good idea to create a say cch4clipper.ch file and map Alert() to MsgYesNo() ?
CCH
http://cch4clipper.blogspot.com
I use Alert() everywhere in FAS4HMG as my dialog of choice.
Do you think it is a good idea to create a say cch4clipper.ch file and map Alert() to MsgYesNo() ?
CCH
http://cch4clipper.blogspot.com
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Mapping Clipper Alert() to MsgYesNo()
Hi CCHCCH4CLIPPER wrote:Hi
I use Alert() everywhere in FAS4HMG as my dialog of choice.
Do you think it is a good idea to create a say cch4clipper.ch file and map Alert() to MsgYesNo() ?
CCH
AFAIK Alert() have multiple ( unlimited) options. MsgYesNo() don't accept any option and support automatically two ( "yes" and "no" ).
If all of your Alert()s have always "yes/no", you may map it. Still you have change your source code, because of parameters aren't identical.
Regards
--
esgici
Viva INTERNATIONAL HMG
Re: Mapping Clipper Alert() to MsgYesNo()
Hi CCH,CCH4CLIPPER wrote:Hi
I use Alert() everywhere in FAS4HMG as my dialog of choice.
Do you think it is a good idea to create a say cch4clipper.ch file and map Alert() to MsgYesNo() ?
Please be so kind to review the following direct replacement for Clipper ALERT() function:
/*----------------------------------------------------------------------------
* $Id: walert.prg,v 1.0 2006/09/08 02:42:56 $
*
* Direct replacement for Clipper ALERT() function
*
* Copyright 2006 Ricardo Sassy <rsassy@gmail.com>
* www - http://www.harley.com.ar
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
/*----------------------------------------------------------------------------
* FUNCTION walert( cMessage, aItems, cTitle ) ===> nValue returned
* cMessage: Message to be displayed inside ALERT frame. Can contain ";"
* character(s) to line feed efect.
* aItems : (optional) An array of choices. If empty, a "OK" button will
* be displayed and return "0" value.
* cTitle : (optional) A title for ALERT window. If empty, default to "choice" message.
*
* Function return numeric value from 1 to 4 according to button pressed
* or zero "0" value in case of interactive window close.
*
* In case of translate from original Clipper code to ooHG/Minigui code
* only replace "ALERT" word for "WALERT" word.
* Sample Clipper code : ALERT('Please;Choice output...',{'PRINTER','SCREEN'})
* Sample ooHG/Minigui code: WALERT('Please;Choice output...',{'PRINTER','SCREEN'})
* WARNING !!!!: Pay attention that function put "OFF" INTERACTIVECLOSE value before exit.
* This could be incorrect for you program structure.
/*----------------------------------------------------------------------------/*
FUNCTION walert( cMessage, aItems, cTitle )
LOCAL I:=0 , J:=0 , nStart:=1 , nValue:=0
DEFAULT aItems TO {}
DEFAULT cMessage TO ' '
IF SET( _SET_LANGUAGE )=='ES'
DEFAULT cTitle TO 'Seleccione...'
ELSE
DEFAULT cTitle TO 'Please, select'
ENDIF
cMessage := cMessage+';'
SET INTERACTIVECLOSE ON
DEFINE WINDOW walert ;
AT 0,0 ;
WIDTH 400 HEIGHT 215 ;
TITLE cTitle ;
ICON 'MAIN' ;
TOPMOST ;
NOMAXIMIZE NOSIZE ;
ON INTERACTIVECLOSE {|| nValue := 0, walert.Release }
//******************** DISPLAY MESSAGE *******************************
FOR I=1 TO LEN(cMessage)
IF SUBST(cMessage,I,1)=';'
++J
cTexLabel := 'text'+STR(J,1)
@ (J*15)-10,016 LABEL &cTexLabel WIDTH 368 HEIGHT 20 VALUE SUBST(cMessage,nStart,I-nStart) ;
FONT 'Sans serif' SIZE 10 CENTERALIGN
nStart := I+1
ENDIF
NEXT
//******************** DRAW BUTTONS ***********************************
IF LEN(aItems) <= 1
@ 150,160 BUTTON Button_1 ;
CAPTION '&OK' ;
ACTION {|| nValue := 0, walert.Release } ;
WIDTH 80
ENDIF
IF LEN(aItems) = 2
@ 150,105 BUTTON Button_1 ;
CAPTION '&'+aItems[1] ;
ACTION {|| nValue := 1, walert.Release } ;
WIDTH 80
@ 150,215 BUTTON Button_2 ;
CAPTION '&'+aItems[2] ;
ACTION {|| nValue := 2, walert.Release } ;
WIDTH 80
ENDIF
IF LEN(aItems) = 3
@ 150,055 BUTTON Button_1 ;
CAPTION '&'+aItems[1] ;
ACTION {|| nValue := 1, walert.Release } ;
WIDTH 80
@ 150,160 BUTTON Button_2 ;
CAPTION '&'+aItems[2] ;
ACTION {|| nValue := 2, walert.Release } ;
WIDTH 80
@ 150,265 BUTTON Button_3 ;
CAPTION '&'+aItems[3] ;
ACTION {|| nValue := 3, walert.Release } ;
WIDTH 80
ENDIF
IF LEN(aItems) = 4
@ 150,016 BUTTON Button_1 ;
CAPTION '&'+aItems[1] ;
ACTION {|| nValue := 1, walert.Release } ;
WIDTH 80
@ 150,112 BUTTON Button_2 ;
CAPTION '&'+aItems[2] ;
ACTION {|| nValue := 2, walert.Release } ;
WIDTH 80
@ 150,208 BUTTON Button_3 ;
CAPTION '&'+aItems[3] ;
ACTION {|| nValue := 3, walert.Release } ;
WIDTH 80
@ 150,304 BUTTON Button_4 ;
CAPTION '&'+aItems[4] ;
ACTION {|| nValue := 4, walert.Release } ;
WIDTH 80
ENDIF
END WINDOW
CENTER WINDOW walert
ACTIVATE WINDOW walert
SET INTERACTIVECLOSE OFF
RETURN(nValue)
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
-
- Posts: 140
- Joined: Tue Mar 03, 2009 8:59 am
Re: Mapping Clipper Alert() to MsgYesNo()
Hi Grigory
I think I saw a link to walert() somewhere in the net this afternoon. Could be at extendedHMG site...
But when I clicked on the link, I get the 404 not found error
So, I couldn't believe it when you posted walert().
I will checked it out and report back here.
TQVM
CCH
http://cch4blogspot.com
I think I saw a link to walert() somewhere in the net this afternoon. Could be at extendedHMG site...
But when I clicked on the link, I get the 404 not found error
So, I couldn't believe it when you posted walert().
I will checked it out and report back here.
TQVM
CCH
http://cch4blogspot.com
-
- Posts: 140
- Joined: Tue Mar 03, 2009 8:59 am
Re: Mapping Clipper Alert() to MsgYesNo()
Hi
Is walert.prg compatible with HMG ?
Using compile.bat to compile walert.prg, I get :-
walert.prg(34) Error E0030 Syntax error: "syntax error at 'AITEMS'"
walert.prg(35) Error E0030 Syntax error: "syntax error at 'CMESSAGE'"
walert.prg(37) Error E0030 Syntax error: "syntax error at 'CTITLE'"
walert.prg(39) Error E0030 Syntax error: "syntax error at 'CTITLE'"
walert.prg(42) Error E0030 Syntax error: "syntax error at 'INTERACTIVECLOSE'"
walert.prg(50) Error E0030 Syntax error: "syntax error at 'WINDOW'"
walert.prg(58) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(68) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(75) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(80) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(87) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(92) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(97) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(104) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(109) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(114) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(119) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(122) Error E0030 Syntax error: "syntax error at 'END'"
walert.prg(123) Error E0030 Syntax error: "syntax error at 'WINDOW'"
walert.prg(124) Error E0030 Syntax error: "syntax error at 'WINDOW'"
walert.prg(125) Error E0030 Syntax error: "syntax error at 'INTERACTIVE'"
Where should I go from here ?
CCH
http://cch4clipper.blogspot.com
Is walert.prg compatible with HMG ?
Using compile.bat to compile walert.prg, I get :-
walert.prg(34) Error E0030 Syntax error: "syntax error at 'AITEMS'"
walert.prg(35) Error E0030 Syntax error: "syntax error at 'CMESSAGE'"
walert.prg(37) Error E0030 Syntax error: "syntax error at 'CTITLE'"
walert.prg(39) Error E0030 Syntax error: "syntax error at 'CTITLE'"
walert.prg(42) Error E0030 Syntax error: "syntax error at 'INTERACTIVECLOSE'"
walert.prg(50) Error E0030 Syntax error: "syntax error at 'WINDOW'"
walert.prg(58) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(68) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(75) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(80) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(87) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(92) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(97) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(104) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(109) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(114) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(119) Error E0030 Syntax error: "syntax error at '@'"
walert.prg(122) Error E0030 Syntax error: "syntax error at 'END'"
walert.prg(123) Error E0030 Syntax error: "syntax error at 'WINDOW'"
walert.prg(124) Error E0030 Syntax error: "syntax error at 'WINDOW'"
walert.prg(125) Error E0030 Syntax error: "syntax error at 'INTERACTIVE'"
Where should I go from here ?
CCH
http://cch4clipper.blogspot.com
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Mapping Clipper Alert() to MsgYesNo()
Had you added #include "minigui.ch" ?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Mapping Clipper Alert() to MsgYesNo()
Hi CCH
Please also take a look to MsgMulti at HMG Resources \ HMG Samples \ Misc Samples topic.
Regards
--
esgici
Please also take a look to MsgMulti at HMG Resources \ HMG Samples \ Misc Samples topic.
Regards
--
esgici
Viva INTERNATIONAL HMG
-
- Posts: 140
- Joined: Tue Mar 03, 2009 8:59 am
Re: Mapping Clipper Alert() to MsgYesNo()
Hi Rathinagiri
Yes, I just did and still cannot compile walert.aprg
Start...
Missing ".o" files: WALERT.O
WALERT.prg(37) Error E0030 Syntax error: "syntax error at 'AITEMS'"
WALERT.prg(38) Error E0030 Syntax error: "syntax error at 'CMESSAGE'"
WALERT.prg(40) Error E0030 Syntax error: "syntax error at 'CTITLE'"
WALERT.prg(42) Error E0030 Syntax error: "syntax error at 'CTITLE'"
WALERT.prg(128) Error E0030 Syntax error: "syntax error at 'INTERACTIVE'"
Finished With Errors.
CCH
http://cch4clipper.blogspot.com
Yes, I just did and still cannot compile walert.aprg
Start...
Missing ".o" files: WALERT.O
WALERT.prg(37) Error E0030 Syntax error: "syntax error at 'AITEMS'"
WALERT.prg(38) Error E0030 Syntax error: "syntax error at 'CMESSAGE'"
WALERT.prg(40) Error E0030 Syntax error: "syntax error at 'CTITLE'"
WALERT.prg(42) Error E0030 Syntax error: "syntax error at 'CTITLE'"
WALERT.prg(128) Error E0030 Syntax error: "syntax error at 'INTERACTIVE'"
Finished With Errors.
CCH
http://cch4clipper.blogspot.com
Re: Mapping Clipper Alert() to MsgYesNo()
Hi CCH
Please add also #include "common.ch"
Please add also #include "common.ch"
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
-
- Posts: 140
- Joined: Tue Mar 03, 2009 8:59 am
Re: Mapping Clipper Alert() to MsgYesNo()
Hi Grigory
Yup, no come error but testing out alert() does not give any response
Function ReindexAll()
nChoice:=Alert('Reindex All Files',{'Yes','No'})
Alert(Str(nChoice))
Return
DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 32,24 BORDER
BUTTON Button_Reindex ;
CAPTION '&Reindex All' ;
PICTURE 'task-2.bmp' ;
ACTION ReindexAll()
END TOOLBAR
Clicking Reindex Btn does not give any response at all.
FYI, Using MsgInfo('Reindex') does work, so I think walert.prg has some issues.
Would appreciate any help here.
CCH
http://cch4clipper.blogspot.com
Yup, no come error but testing out alert() does not give any response
Function ReindexAll()
nChoice:=Alert('Reindex All Files',{'Yes','No'})
Alert(Str(nChoice))
Return
DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 32,24 BORDER
BUTTON Button_Reindex ;
CAPTION '&Reindex All' ;
PICTURE 'task-2.bmp' ;
ACTION ReindexAll()
END TOOLBAR
Clicking Reindex Btn does not give any response at all.
FYI, Using MsgInfo('Reindex') does work, so I think walert.prg has some issues.
Would appreciate any help here.
CCH
http://cch4clipper.blogspot.com