Announcement

Collapse
No announcement yet.

discussion for mutiple keyword search program in source code section

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Paul Purvis
    replied
    sorry about posting in the wrong section
    the txt2wndw program is a gui program and not a console program

    txt2wndw.bas
    the source listing from above with just small code change
    compiled with pbwin 9.04
    i just wanted to upload the exe long with the source
    Attached Files
    Last edited by Paul Purvis; 19 Mar 2010, 03:20 PM.

    Leave a comment:


  • Paul Purvis
    replied
    i have had some problems in working with a textbox but i did learn something the hard way.
    it makes no sense for a beginner programmer in windows to try to keep a certain line highlighted for viewing purposes, i am not sure if it is even possible.

    example, i wanted my program to load a file in a textbox and goto a certain line and highlight that line for the viewer, and i also wanted the viewer to be able to change lines in the viewed textbox for copying and pasting purposes.my experience in doing that, forget about it. you have to highlight text in order to copy it to the clipboard. i have found no way to easily color the text in a textbox, maybe i made the wrong choice in trying to highlight a line when i should of been trying to color the text.

    i altered a previous program that was using textbox for displaying a text file, that was my other problem.
    programming to me like going to war, i that an experienced warrior will pick the right weapons to use. the more weapons he has and that he knows how to use them, and the pros and cons that come with using each weapon usually comes from the experience or the knowledge of others they have passed on.

    learning what is possible or not possible with a certain control type makes all the difference and also knowing what control types are available. before using a control type, try your best to identify all the possible needs your control will need now and in the future of that same program and do your best to find out whether or not the control supports your needs.

    i made some assumptions of what a control could do, or at least do easily without a tremendous amount of coding, that seemed to be my biggest mistake that cause a lot of stress and time to me. i will now look for a place on this forum that list the pros and cons of certain control types.

    paul

    Leave a comment:


  • Paul Purvis
    replied
    on my quest to get to a program of my needs of searching file for multiple keywords and having the ability to bullet to those results, i have rewritten a program i call txt2wndw.
    i guess this is as good a place as any to post any code written while it is being produced.

    and because i have searched for my road blocks in creating this program and not been able to find solutions, i am just going to post them here, because it all relates back to the program i have already written or the code that is going to be written to make a better program than what was entered into the source code section that is referenced in the first post.

    this program in the end should help out with other projects other than powerbasic, and this is great when you are converting your code to powerbasic from another language.


    here is a program to use instead of notepad.
    you place the file on the command line and if you want to goto and highlight on line in the program, then add /L:##### to the command tail

    Code:
    'txt2wndw.bas
    'compiled with pbwin 8.04
    'program reads a file then displays the contents in a window
    
    #COMPILE EXE
    #REGISTER NONE
    #DIM ALL
    #INCLUDE "Win32Api.Inc"
    #INCLUDE "COMDLG32.INC"   ' Common dialog declares
    #INCLUDE "PREVIEW.INC"    ' Preview dialog include from tutorials in the samples directory
    
    %IDC_BUTNOPEN   = 120     ' Control id's
    %IDC_BUTNVIEW   = 121
    %IDC_BUTNPAGE   = 122
    %IDC_BUTNFONT   = 123
    %IDC_BUTNFONT1  = 124
    %IDC_BUTNFONT2  = 125
    %IDC_BUTNFONT3  = 126
    
    %ListBox = 201
    GLOBAL datainthefile() AS STRING
    GLOBAL largestwidthline AS LONG
    GLOBAL gifontsize AS DWORD
    GLOBAL gibuttonfontsize AS DWORD
    GLOBAL gstext AS STRING
    GLOBAL glinecount AS LONG
    GLOBAL gLINESTART AS LONG
    GLOBAL gcharactercount AS LONG
    GLOBAL glinestartcharactercount AS LONG
    GLOBAL hFont,hbuttonfont AS DWORD
    GLOBAL FONTSIZE AS LONG
    GLOBAL gifontbold AS LONG
    
    GLOBAL ghdlg AS WORD
    
    
    'FUNCTION DECLARATIONS---------------------------------------------------------------
    DECLARE FUNCTION findwidestpart(BYVAL a AS STRING) AS LONG
    DECLARE FUNCTION GetFile    (BYVAL sFile AS STRING) AS STRING
    
    DECLARE FUNCTION MakeFontEx (BYVAL FontName AS STRING, _
                                 BYVAL PointSize AS LONG, _
                                 BYVAL fBold AS LONG, _
                                 BYVAL fItalic AS LONG, _
                                 BYVAL fUnderline AS LONG) AS DWORD
    
    DECLARE FUNCTION SelectFontProc   (BYVAL hDlg AS DWORD, _
                                       BYVAL id AS LONG, _
                                       hFont AS DWORD, _
                                       pd AS PreviewData) AS LONG
    '----------------------------------------------------------------------------------------
    '====================================================================
    FUNCTION GetFile (BYVAL sFile AS STRING) AS STRING
    '--------------------------------------------------------------------
    ' Open and return given file's contents as a string
    '--------------------------------------------------------------------
      LOCAL ff   AS LONG
      LOCAL sBuf AS STRING
    
      IF LEN(DIR$(sFile)) = 0 THEN
          MSGBOX "The file does not exist.", %MB_TASKMODAL, "Error"
          EXIT FUNCTION
      END IF
    
      ff = FREEFILE
      OPEN sFile FOR BINARY ACCESS READ LOCK SHARED  AS ff LEN = 16000
          IF ERR THEN  ' Always trap ev. errors on file open actions
              MSGBOX ERROR$(ERR), %MB_TASKMODAL, "Error"
              RESET : ERRCLEAR : EXIT FUNCTION
          END IF
          GET$ ff, LOF(ff), sBuf
      CLOSE ff
    
      FUNCTION = sBuf
    END FUNCTION
    
    
    FUNCTION findcharactercount() AS LONG
    LOCAL TEMP1 AS LONG,TEMP2 AS LONG
    LOCAL I AS QUAD
    TEMP1=1&
    TEMP2=1&
    FOR i=1 TO glinestart
       temp2=INSTR(TEMP1,GSTEXT,$CRLF)
       IF glinestart=i THEN
        gCHARACTERCOUNT=TEMP1
         glinestartcharactercount=INSTR(TEMP1,GSTEXT,$CRLF)-1&-gcharactercount
        EXIT FUNCTION
       END IF
       IF i=glinecount THEN EXIT FOR
    temp1=temp2+1
    NEXT i
     gCHARACTERCOUNT=INSTR(-1,gstext,$CRLF)
     gCHARACTERCOUNT=INSTR(gcharactercount-1,gstext,$CRLF)
     glinestartcharactercount=2
    END FUNCTION
    
    'FUNCTION EmLineScroll(BYVAL hEdit AS LONG, BYVAL x AS LONG, BYVAL y AS LONG) AS LONG
    '  FUNCTION = SendMessage(hEdit, %EM_LINESCROLL, x, y)
    'END FUNCTION
    
    
    
    '====================================================================
    FUNCTION MakeFontEx (BYVAL FontName AS STRING, _
                         BYVAL PointSize AS LONG, _
                         BYVAL fBold AS LONG, _
                         BYVAL fItalic AS LONG, _
                         BYVAL fUnderline AS LONG) AS DWORD
    '--------------------------------------------------------------------
    ' Create a desired font and return its handle.
    '--------------------------------------------------------------------
      LOCAL hDC AS DWORD, CharSet AS LONG, CyPixels AS LONG
      IF gifontbold THEN fbold=700 ELSE fbold=400
      hDC = GetDC(%HWND_DESKTOP)
        CyPixels  = GetDeviceCaps(hDC, %LOGPIXELSY)
        EnumFontFamilies hDC, BYVAL STRPTR(FontName), CODEPTR(EnumCharSet), BYVAL VARPTR(CharSet)
      ReleaseDC %HWND_DESKTOP, hDC
      PointSize = 0 - (PointSize * CyPixels) \ 72
    
      FUNCTION = CreateFont(PointSize, 0, _  'height, width(default=0)
                 0, 0, _                     'escapement(angle), orientation
                 fBold, _                    'weight (%FW_DONTCARE = 0, %FW_NORMAL = 400, %FW_BOLD = 700)
                 fItalic, _                  'Italic
                 fUnderline, _               'Underline
                 %FALSE, _                   'StrikeThru
                 CharSet, %OUT_TT_PRECIS, _
                 %CLIP_DEFAULT_PRECIS, %DEFAULT_QUALITY, _
                 %FF_DONTCARE , BYCOPY FontName)
    
    END FUNCTION
    
     '====================================================================
    FUNCTION EnumCharSet (elf AS ENUMLOGFONT, ntm AS NEWTEXTMETRIC, _
                          BYVAL FontType AS LONG, CharSet AS LONG) AS LONG
    '--------------------------------------------------------------------
    ' Get type of character set - ansi, symbol, etc. A must for some fonts..
    ' Called from FUNCTION MakeFontEx.
    '--------------------------------------------------------------------
      CharSet = elf.elfLogFont.lfCharSet
    END FUNCTION
    '====================================================================
    
    
    FUNCTION SelectFontProc (BYVAL hDlg AS DWORD, _
                             BYVAL id AS LONG, _
                             hFont AS DWORD, _
                             pd AS PreviewData) AS LONG
    '--------------------------------------------------------------------
    ' Use COMDLG32's Font dialog for font settings
    '--------------------------------------------------------------------
      LOCAL cf AS CHOOSEFONTAPI, lf AS LOGFONT
      IF hFont THEN GetObject hFont, SIZEOF(lf), lf
    
      cf.lStructSize    = SIZEOF(CHOOSEFONTAPI)
      cf.hwndOwner      = hDlg
      cf.lpLogFont      = VARPTR(lf)
      cf.Flags          = %CF_BOTH OR %CF_FORCEFONTEXIST OR %CF_INITTOLOGFONTSTRUCT
      cf.nFontType      = %SCREEN_FONTTYPE
    
      IF ChooseFont(cf) THEN
         pd.FontName = lf.lfFaceName
         pd.FontSize = cf.iPointSize / 10
         pd.FontType = IIF&(lf.lfWeight < 500, 0, 1)
         IF lf.lfItalic THEN pd.FontType = pd.FontType OR 2
         IF lf.lfUnderline THEN pd.FontType = pd.FontType OR 4
    
         IF hFont THEN DeleteObject hFont
         hFont = MakeFontEx (pd.FontName, pd.FontSize, _
                             lf.lfWeight, lf.lfItalic, lf.lfUnderline)
    
         FUNCTION = %TRUE
      END IF
    
    END FUNCTION
    
    
    '______________________________________________________________________________
    
    CALLBACK FUNCTION DlgProc
      LOCAL h, w, x, y AS LONG
      LOCAL i AS LONG
    
      SELECT CASE AS LONG CBMSG
      CASE %WM_INITDIALOG  ' <- Received right before the dialog is shown
          '------------------------------------------------------------------
          ' The main program is responsible for maintaining a Static or Global
          ' PreviewData variable and calling InitPreviewDlg before the Print
          ' Preview dialog in Preview.inc is used.
          '------------------------------------------------------------------
          STATIC pd AS PreviewData  ' <- Defined in Preview.inc
          InitPreviewDlg pd         ' <- Located in Preview.inc
           IF LEN(gsText) THEN CONTROL SET TEXT CBHNDL, %listbox , gsText
            IF hFont THEN DeleteObject hFont
            hFont = MakeFontEx("Courier New", gifontsize, 0, 0, 0)
            IF hFont THEN CONTROL SEND CBHNDL, %Listbox, %WM_SETFONT, hFont, 1
    
           CONTROL  SET FOCUS ghdlg, %listbox
            LISTBOX SELECT ghdlg, %listbox, 4&
            '   CONTROL SEND ghDlg, %listbox , %Es_readonly, 1&,0&
            IF gcharactercount THEN
                IF glinecount>=glinestart THEN
                 CONTROL SEND ghDlg, %listbox , %EM_SETSEL, gcharactercount&, gcharactercount+glinestartcharactercount&
                 CONTROL SEND ghDlg, %listbox , %Es_readonly, 1&,0&
                IF glinestart<=glinecount THEN CONTROL SEND CBHNDL, %LISTBOX, %EM_LINESCROLL,0, glinestart-10
                ELSE
                 CONTROL SEND ghDlg, %listbox , %EM_SETSEL, gcharactercount&, gcharactercount+glinestartcharactercount&
                 CONTROL SEND CBHNDL, %LISTBOX, %EM_LINESCROLL,0, glinecount
                END IF
            END IF
    
            FUNCTION=1&
    
    
      CASE %WM_DESTROY ' <- Received right before the dialog is destroyed
          IF hFont THEN DeleteObject hFont
    
       CASE %WM_COMMAND
          '----------------------------------------------------
          ' Messages from the controls are handled here.
          ' Example: Button clicks generates a %BN_CLICKED message
          '          and menu clicks generates the value 1.
          '----------------------------------------------------
          SELECT CASE AS LONG CBCTL
    
          CASE %IDC_BUTNFONT
              IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                  IF SelectFontProc (CBHNDL, %listbox, hFont, pd) THEN
                      CONTROL SEND CBHNDL, %listbox, %WM_SETFONT, hFont, 1
                  END IF
              END IF
    
    
           CASE %IDC_BUTNFONT1
             IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                 IF gifontsize>5 THEN  gifontsize=gifontsize-1
                 IF hFont THEN DeleteObject hFont
                 hFont = MakeFontEx("Courier New", gifontsize, 0, 0, 0)
                 IF hFont THEN CONTROL SEND CBHNDL, %Listbox, %WM_SETFONT, hFont, 1
                 END IF
    
            CASE %IDC_BUTNFONT2
              IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                 IF gifontsize<72 THEN  gifontsize=gifontsize+1
                 IF hFont THEN DeleteObject hFont
                 hFont = MakeFontEx("Courier New", gifontsize, 0, 0, 0)
                 IF hFont THEN CONTROL SEND CBHNDL, %Listbox, %WM_SETFONT, hFont, 1
              END IF
    
             CASE %IDC_BUTNFONT3
              IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                 IF hFont THEN DeleteObject hFont
                 IF gifontbold THEN gifontbold=0& ELSE gifontbold=1&
                 hFont = MakeFontEx("Courier New", gifontsize, 0, 0, 0)
                 IF hFont THEN
                     CONTROL SEND CBHNDL, %Listbox, %WM_SETFONT, hFont, 1
                  END IF
    
              END IF
    
    
          CASE %IDCANCEL      ' "Exit" button or the Esc-key was pressed
              IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                  DIALOG END CBHNDL, 0
              END IF
          END SELECT
    
      CASE %WM_SIZE  ' is sent on resize - auto-size the TextBox
          IF CBWPARAM <> %SIZE_MINIMIZED THEN  ' avoid minimized state
              w = LO(WORD, CBLPARAM)      ' dialog client area's width in pixels
              h = HI(WORD, CBLPARAM)      ' dialog client area's height in pixels
              DIALOG PIXELS CBHNDL, w, h TO UNITS w, h  ' convert to dialog units
              CONTROL GET LOC CBHNDL, %listbox TO x, y      ' we need top pos
              CONTROL SET SIZE CBHNDL, %listbox, w, h - y   ' auto-size..
          END IF
    
      END SELECT
    
    
    END FUNCTION
    
    FUNCTION findwidestpart(BYVAL a AS STRING) AS LONG
    LOCAL i AS LONG
    LOCAL j AS LONG
    LOCAL k AS LONG
    LOCAL l AS LONG
    k=0&
    l=LEN(a)
    i=1&
    findagain:
        j=INSTR(i,a,$CRLF)
        IF j THEN
            IF j-i>k THEN k=j-i
            i=j+2
            IF i<l THEN GOTO findagain
        END IF
    
        IF i<l  AND l-i>k THEN k=l-i
    
    FUNCTION=k
    END FUNCTION
    
    '______________________________________________________________________________
    
    FUNCTION PBMAIN()
    
     LOCAL hDlg         AS DWORD
     LOCAL Root         AS STRING
     DIM  Datainthefile(0 TO 0) AS STRING
     LOCAL Filter       AS STRING
     LOCAL FileCount    AS DWORD
     LOCAL filename    AS STRING
     LOCAL I           AS DOUBLE
     LOCAL hfile2   AS LONG
     LOCAL aa       AS STRING
     LOCAL bb AS STRING
     LOCAL vscrollbarwidth AS LONG
     LOCAL vwindowsize AS LONG
     LOCAL hwindowsize AS LONG
     LOCAL TEMP1 AS LONG,TEMP2 AS LONG
     LOCAL COMMANDLINE$
    
    
    commandline$=" "+TRIM$(COMMAND$)+" "
    
    TEMP1=INSTR(UCASE$(commandline$),"/L:")
      IF TEMP1 THEN
         TEMP2=INSTR(TEMP1+3,UCASE$(commandline$)," ")-(TEMP1+3)
          gLINESTART=VAL(MID$(COMMANDLINE$,TEMP1+3,TEMP2))
          COMMANDLINE$=REMOVE$(COMMANDLINE$,MID$(COMMANDLINE$,TEMP1,TEMP1+TEMP2+3))
      END IF
    
    Filename=TRIM$(COMMANDLINE$)
    gstext=getfile(filename)
    I=INSTR(gstext,$CRLF+CHR$(26))
    IF I THEN
         gstext=LEFT$(gstext,I+1)
    ELSE
       I=INSTR(gstext,CHR$(26))
       IF I THEN gstext=LEFT$(gstext,I-1&)
    END IF
    
    IF LEN(gstext)>0& THEN
         SLEEP 10
         largestwidthline=findwidestpart(gstext)
         glinecount=TALLY(gstext,$CRLF)
         IF glinestart THEN findcharactercount
    
     ELSE
          gstext="The file is empty or"+$CRLF+"there is no file on "+$CRLF+_
          "the command line."+$CRLF+_
          "An option to start"+$CRLF+"viewing at a specific"+$CRLF+"line can be added"+$CRLF+_
          "using /L:####"
    END IF
    
    
    gifontbold=1&
    FONTSIZE=10&
    gifontsize=fontsize
    gibuttonfontsize=8
    vscrollbarwidth=largestwidthline*((fontsize/2)-2&)
    vwindowsize=vscrollbarwidth+fontsize
    IF vwindowsize>400& THEN vwindowsize=400&
    IF vwindowsize<100 THEN vwindowsize=100&
    hwindowsize=glinecount*((fontsize/2)+2&)
    IF hwindowsize>300& THEN hwindowsize=300&
    IF hwindowsize<100 THEN hwindowsize=100&
    
     DIALOG FONT "Courier New",FONTSIZE
     DIALOG NEW %HWND_DESKTOP, filename, , , vwindowsize, hwindowsize, _
            %WS_CAPTION OR %WS_SYSMENU OR _
            %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX OR %WS_THICKFRAME OR %WS_BORDER OR %WS_CLIPSIBLINGS OR %WS_CLIPCHILDREN, 0 TO hDlg
     SetClassLong hDlg, %GCL_HICON, LoadIcon(BYVAL %NULL, BYVAL %IDI_INFORMATION)
    
    ' CONTROL ADD LISTBOX, hDlg, %ListBox, Datainthefile(), 0,  10, vwindowsize, hwindowsize, %LBS_NOTIFY OR _
    '        %WS_TABSTOP OR %WS_VSCROLL OR %WS_HSCROLL, %WS_EX_CLIENTEDGE
    
    
    CONTROL ADD TEXTBOX, hDlg, %listbox, "", 0,  10, vwindowsize, hwindowsize, _
                   %WS_HSCROLL OR   %ES_MULTILINE OR  %ES_NOHIDESEL OR %ES_WANTRETURN OR _
                   %WS_VSCROLL , %WS_EX_CLIENTEDGE
    
    
    CONTROL SET COLOR hDlg,%listbox,-1,-1
    CONTROL SEND hDlg, %ListBox, %LB_SETHORIZONTALEXTENT, vscrollbarwidth+(fontsize*3&), 0
    
    
     CONTROL ADD BUTTON, hDlg, %IDC_BUTNFONT,  "Font",    1, 1, 18, 8
     CONTROL ADD BUTTON, hDlg, %IDC_BUTNFONT1,  "font",    21, 1, 18, 8
     CONTROL ADD BUTTON, hDlg, %IDC_BUTNFONT2,  "FONT",    41, 1, 18, 8
     CONTROL ADD BUTTON, hDlg, %IDC_BUTNFONT3,  "Bold",    61, 1, 18, 8
    
     CONTROL ADD BUTTON, hDlg, %IDCANCEL,      "E&xit",    81, 1, 18, 8
    
     hFont = MakeFontEx("Courier New", 10, 2, 0, 0)
     IF hFont THEN
         CONTROL SEND hDlg, %Listbox, %WM_SETFONT, hFont, 1
    '     SLEEP 20
     END IF
    
     hbuttonFont = MakeFontEx("Courier New", gibuttonfontsize, 0, 0, 0)
     IF hbuttonFont THEN
         CONTROL SEND hDlg, %Listbox, %WM_SETFONT, hbuttonfont, 1
     END IF
     ghdlg=hdlg
     DIALOG SHOW MODAL hDlg CALL DlgProc
    
    END FUNCTION

    Leave a comment:


  • Paul Purvis
    replied
    gotcha is great program and is very useful, i would suggest to anybody that they get the program and like James, the altered Gotcha to Gotchaex is the one i like best.
    i do not understand in the first version, the one posted in the forum, why there is section of the dialog where i can see through it. i am sure there is a good reason, but not knowing for what reason, it mostly distracts my vision off the gotcha dialog.

    thanks both for the recommendations and Pierre thanks for the hard work of coding it and sharing it.

    Pierre you deserve a pat on the back for this program, so just reach over your should and do a couple for me with a big smile.

    programs like gotcha helps to reinforce why placing code in functions is much more useful because there are tools like gotcha that make it easy to junk to certain code in a program.

    i write and use other programs also.
    gotcha has mostly what i wanted in a program and most of these type programs should do nearly the same things, if the program has matured. Displaying gathered search results, speed, and displaying giving the user optional ways of looking at the results and different ways of viewing results is the big differences in these programs. Specific application to specific programming languages is a lot of hard work too in displaying and working with the certain languages, which Gotcha seems to be powerbasic orientated.

    this still though is not what i was looking for by what a great find, maybe others will find gotcha useful also.

    paul

    Leave a comment:


  • Pierre Bellisle
    replied
    Me too
    For a while - GotCha.zip (The exe only - no source)
    Last edited by Pierre Bellisle; 19 Mar 2008, 06:49 PM.

    Leave a comment:


  • jcfuller
    replied
    I use Gotcha ( the one bundled with SED) for all of my programing searches


    http://www.powerbasic.com/support/pb...ghlight=gotcha

    James

    Leave a comment:


  • Paul Purvis
    replied
    i wanted to make some comments about this program.

    first, this program was created by altering a previous program that would search a file looking for all keywords on a single line.
    i needed a program that i could not find to the job i wanted to.

    the original program was one of my first powerbasic 32bit programs.
    i would not suggest altering this code much if one decided to but create another program.

    this program was altered to find keywords located close to one another in a file, display the briefly found results with a option to view the whole file.
    something that is needed when searching functions or anything else that would benefit a programmer, specially somebody learning code or wanting to copy code previously written.


    if there is a program to do what this program does please let me know about it, please.

    this program is acking to be a totally gui program.
    it would take me days to do this, but some of you i know can whip this out almost over a long lunch period.

    so in case i have any bitter, i want to pass on some information or suggestions if any body was to do so.

    not in any order.

    have a gui that does not require any command tail for it to run
    have a option to search subdirectories
    have any file searched to be read up at one time


    search the file for keywords then if all keywords found to this,replace all CRLF with LF then replace all LFLF with LF then replace all LF with CRLF.
    by doing above you can search and display files that have no CRLFs just LF and also remove blank lines.

    then add extra lines amounting to how much lines you are going to allow for the other keyword to be close to the primary keyword to the beginning of your file in memory and lines to the ending of the file in memory.
    these extra lines will help finding and displaying the found keywords if your primary keyword is at the most beginning or ending of the file.

    after you have located the matched primary keyword, read backwards the number of CRLFs till you have the number of extra lines you are going to allow the user to include in the block of lines additional keywords can be found in, make that location of the file in memory then read from there the size of of the whole block you want all keywords to be found in, and mark that location. mark, meaning a variable of course.
    then using maybe mid$ to get that information to possibly an array of your blocks size.

    then display that information in a textbox or listbox inside your dialog, i do not know which, but it would be nice to have keywords colored with the primary being colored in a different color that the additional keywords, i like green for the primary and yellow for secondary keywords.

    allow for some long lines, i used 500 characters, but i guess a really good programmer would allow the line length to be any length.

    i am in favor myself of having a different dialog or a program to display the whole file. then position of the cursor at the found primary keyword's location in the file.
    inside the viewer of the whole file, do not allow a user to make any changes or saves to the file, the viewer should be static and colors are really not that important in the whole file viewer.

    that is all there is to it.

    some goodies would be on the programs window where you specify the keywords, directories, search block,etc would be the files to find and the program should search by files in order of extension, so naturally prior to searching each file, you would build an array that include the files whole name, then step through each file in the array while searching.
    also a nice option to save the search parameters in a ini file that is read at program startup in which the program was started.
    also something to add would be to make the block size in which additional keywords are found in, would be rather than making the block line number oriented, make the block a certain number of characters from the primary keyword, then go backward until you found the beginning of line and doing the same for the number of characters after your primary keyword hit, but this time reading the full line till you get to the end of the line.

    i am sure that other programmer's have the same problems as myself.
    this program as most will see can be useful for a number of other purposes by itself or with little change.
    one such program might be where you have keywords in files that are linked to another file, although not the fastest way to search, but there would be no indexs needed, and the index files could simply be updated without somebody understanding sql or anything else, this could be a poor man's index on jpg files and other none text files, where a user can see what is in the index file file before reviewing the none text file.

    for a generic program, you could also allow for alternative programs to open the whole file.
    you may also want to change the way the viewer program runs, an asynchronously option would be nice too, specially to us programmers, which you can easily change in my program, but button to choose on a gui would be best.

    i just tried to outline my thoughts if somebody where to give this a go, to write another better program.
    if again i where to write it, i would try for the smallest gui displays i could get away with allowing for font increases and decrease, might as well be some transparency to the window as well, and trying to stay away from too many options on the screen.


    paul
    Last edited by Paul Purvis; 19 Mar 2008, 05:26 PM.

    Leave a comment:


  • discussion for mutiple keyword search program in source code section

    discussion for a keyword search with upto 3 addtional keywords close to primary keyword

    http://powerbasic.com/support/pbforu...d.php?p=279522
Working...
X