PDA

View Full Version : Macro and PICK samples



CodeMonkey
06-06-2013, 10:49 AM
Use this thread to share your macro or PICK samples.
Use this thread to learn what others are doing with macros and PICK BASIC commands.


Tips and Tricks to posting CODE to this thread:

1. Once you click on the Reply to Thread button, use the Go Advanced options prior to editing your posted code.
2. Use the [ CODE ] and [ /CODE ] tags (see also the # button in the Advanced toolbar), without the spaces, prior to and after your posted code.
3. Please format and comment your posted code for readability and understanding.
4. Use the Paste as plain text button in the Advanced toolbar to post your code. It is helpful to cut and paste FROM Word or Wordpad into your thread.
5. Preview Changes often before submitting with Save Changes.
6. Please put comments and questions about code posted in this thread into a separate thread.
7. Please be kind, courteous and professional when posting to this and other forums.
8. Have FUN!

CodeMonkey
06-06-2013, 01:50 PM
REM This macro demonstrates how to handle properties, methods and events for Grid ActiveX control
REM Delays required for correct work may need to be adjusted depending on the system used


PRINT chr$(27) ; "_201;1;5;40;20;40wGRID1;MSFlexGridLib.MSFlexGrid.1" ; chr$(27);"\" ;
PRINT chr$(27);"_203wGRID1;EDITABLE;TRUE" ; chr$(27);"\" ;
PRINT chr$(27);"_203wGRID1;COLS;5" ;chr$(27);"\" ;
PRINT chr$(27);"_203wGRID1;FIXEDCOLS;1";chr$(27);"\" ;
PRINT chr$(27);"_203wGRID1;FORMATSTRING; LOGON||TOTAL ||VOLUME||DAYS||VAL";chr$(27);"\" ;
PRINT chr$(27);"_203wGRID1;REDRAW;TRUE";chr$(27);"\" ;
PRINT chr$(27);"_203wGRID1;TEXTARRAY;1;aaaa";chr$(27);"\" ;
PRINT chr$(27);"_203wGRID1;TEXTARRAY;7;bbbbb";chr$(27);"\" ;
PRINT chr$(27);"_204wGRID1;ADDITEM;CPA"+chr$(9)+"38,029.00"+chr$(9)+"45"+chr$(9)+"30"+chr$(9)+"25";chr$(27);"\" ;
DELAY 1
PRINT chr$(27);"_204wGRID1;ADDITEM;APA"+chr$(9)+"8,029.00"+chr$(9)+"5"+chr$(9)+"3"+chr$(9)+"2";chr$(27);"\" ;
REM
DIM CellText$, Event$, EventName$ AS STRING
DIM CellRow$,CellCol$ AS STRING
REM
DELAY 1
PRINT chr$(27);"_202wGRID1;TEXTARRAY;7";chr$(27);"\" ;
INPUT CellText$
PRINT CellText$
CellText$= id$(CellText$)
PRINT "Text in cell 7 is *" ;CellText$;"*"
DELAY 1
PRINT chr$(27);"_203wGRID1;TEXTARRAY;6;";CellText$;chr$(27);"\" ;
REM
PRINT chr$(27);"_203wGRID1;ENABLEEVENT;EnterCell;";chr$(27);"\" ;
PRINT chr$(27);"_15;2;16wGRID1";chr$(27);"\";
INPUT Event$
PRINT Event$
EventName$ = Field$(Event$,",",3)
PRINT EventName$
IF EventName$="EnterCell" THEN
PRINT chr$(27);"_202wGRID1;Row";chr$(27);"\" ;
INPUT CellRow$
PRINT CellRow$
PRINT chr$(27);"_202wGRID1;Col";chr$(27);"\" ;
INPUT CellCol$
PRINT CellCol$
CellRow$ = id$(CellRow$)
CellCol$ = id$(CellCol$)
PRINT chr$(27);"_202wGRID1;TEXTMATRIX;"+CellRow$+";"+CellCol$;chr$(27);"\" ;
INPUT CellText$
PRINT CellText$
ENDIF
REM
DELAY 10
PRINT chr$(27) ; "_10wGRID1" ; chr$(27) ; "\" ;