Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sam-Clip
#1
Note: Windows only app. (Saving you time reading if you only have Linux or Mac.)

For fun, I thought I'd start putting together an app that let's us paste text in a small persistent QB64 window. We can then click on line of text in the window, and insert it into another document, including a QB64 IDE window. So basically I'm making a multi-use clipboard app.

For now, it's bar bones, not goof proofed, but this is why I love this section of the boards where we can share stuff in the making. This is enough for now to demonstrate the basic mechanics. A lot more needs to be added to make it really worth using.

One challenge was a difference between apps like Notepad and QB64. _SCREENPRINT can be used for non-QB64 apps, but copying to highlighted text in the QB64 IDE results in the text being replaced with a "c" and paste has similar problems. I had to use a hack to get around this and used SENDEKY Windows API sub to open the QB64 Edit Menu and select "C" or "P" to get the operations to work properly. Not all that happy with it, but at least it works, and it is nice to include the IDE in the Sam-Clip app.

So how to separate the QB64 from other apps like Notepad? Hold Ctrl  when highlighting or pasting to an app like Notepad and simple use the mouse without any key held to copy or paste in a QB64 IDE.

So to test it, try this....

1) Open Notepad and type some crap like, "Steve is brilliant." (We can so edit that later.)

2) Run Sam-Clip

3) Hold the Ctrl key and use your mouse to highlight part of the text like, "brilliant" When you release the left mouse button what you highlighted will be pasted into the Sam-Clip window.

3) Now press Enter a couple of times on notepad.

4) Next go to Sam-Clip and click on "brilliant" The text will be highlighted.

5) Go back to Notepad, hold down the Ctrl key, and left click where you want the text inserted. The word "brilliant" will be pasted into Notepad.

You can add more stuff to Sam-Clip, but for now it can't handle more than the window height. You can't same your additions yet, either.

You can bulk copy multiple lines of text to Sam-Clip, and bulk paste. .

Edit: Added Sam.clip.dat and Sam-clip.tmp database to save clipped selections.
Added ability to click where in the list to add a clipped line.

Edit: Added the ability to copy a bunch of text and keep it on Sam-Clip as a custom named [Header]. You right mouse hold on the [Header] and it will show you the contents.
Added the ability to click to highlight a [Header] and click the document. The contents of the [Header] will be paste into the document.
Added a bypass. If you hold Alt with a Sam-Clip entry highlighted, you can move about your doc and your Sam-Clip window will be grey and disengaged until you release the Alt key.

Code: (Select All)
WIDTH 50, 25
_DELAY .1
a = _DESKTOPWIDTH - (_FONTWIDTH * _WIDTH)
_SCREENMOVE a, 0

CONST HWND_TOPMOST%& = -1
CONST SWP_NOSIZE%& = &H1
CONST SWP_NOMOVE%& = &H2
CONST SWP_SHOWWINDOW%& = &H40
CONST KEYEVENTF_KEYUP = &H2
CONST VK_ALT = &H12 'Alt key

REDIM Hold AS POINTAPI
TYPE POINTAPI
    X_Pos AS LONG
    Y_Pos AS LONG
END TYPE

DECLARE DYNAMIC LIBRARY "user32"
    FUNCTION GetAsyncKeyState% (BYVAL vkey AS LONG)
    FUNCTION GetCursorPos (lpPoint AS POINTAPI)
    FUNCTION FindWindowA& (BYVAL ClassName AS _OFFSET, WindowName$) 'handle by title
    FUNCTION ShowWindow& (BYVAL hwnd AS _OFFSET, BYVAL nCmdShow AS LONG) 'maximize process
    FUNCTION GetForegroundWindow& 'Find currently focused process handle
    FUNCTION SetWindowPos& (BYVAL hWnd AS LONG, BYVAL hWndInsertAfter AS _OFFSET, BYVAL X AS INTEGER, BYVAL Y AS INTEGER, BYVAL cx AS INTEGER, BYVAL cy AS INTEGER, BYVAL uFlags AS _OFFSET)
    SUB SENDKEYS ALIAS keybd_event (BYVAL bVk AS LONG, BYVAL bScan AS LONG, BYVAL dwFlags AS LONG, BYVAL dwExtraInfo AS LONG)
END DECLARE

title$ = "Sam-Clip"
_TITLE (title$)
_DELAY .1

DIM SHARED hWnd AS LONG
hWnd = _WINDOWHANDLE

TYPE ClipType
    clip AS STRING
    cnt AS INTEGER
END TYPE

DIM SHARED AS ClipType a, c, placement, paste, header
REDIM SHARED clipper$(_HEIGHT * 2), clipper%(_HEIGHT * 2)

_CLIPBOARD$ = "" ' Clear clipboard.

IF _FILEEXISTS("Sam-Clip.dat") THEN
    c.cnt = 0
    OPEN "Sam-Clip.dat" FOR BINARY AS #1
    DO UNTIL EOF(1)
        c.cnt = c.cnt + 1
        LINE INPUT #1, clipper$(c.cnt)
    LOOP
    CLOSE #1
END IF

CALL show_sam

DO
    _LIMIT 60
    z = GetCursorPos(Hold)
    IF pal = -1 THEN IF GetAsyncKeyState(18) = 0 THEN PALETTE 0, 0: pal = 0
    IF GetAsyncKeyState(18) THEN
        IF pal = 0 THEN pal = -1: PALETTE 0, 56
        _CONTINUE ' Bypass everything to do other stuff off screen.
    END IF

    FGwin& = GetForegroundWindow&

    IF hWnd <> FGwin& THEN ' QB64 no longer in focus.
        y& = SetWindowPos&(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE + SWP_SHOWWINDOW)
    END IF

    IF Hold.Y_Pos >= _SCREENY AND Hold.Y_Pos <= _SCREENY + _FONTHEIGHT * (_HEIGHT + 1) AND Hold.X_Pos >= _SCREENX AND Hold.X_Pos <= _SCREENX + _FONTWIDTH * _WIDTH THEN
        WHILE _MOUSEINPUT: WEND
        my = _MOUSEY
        mx = _MOUSEX
        IF _MOUSEBUTTON(1) AND lb = 0 THEN ' Left button pressed.
            lb = -1: z2 = TIMER
        ELSEIF _MOUSEBUTTON(1) = 0 AND lb THEN ' Left button released.
            lb = 0: hl = 0: drag = 0: begin_hl = 0: begin_hl_toggle = 0: z2 = TIMER
        END IF

        IF my < _HEIGHT THEN
            IF _MOUSEBUTTON(2) AND show_c = 0 THEN
                IF INSTR(clipper$(my), CHR$(255)) THEN
                    IF show_c = 0 THEN CALL show_collapse(my): show_c = -1
                END IF
            ELSE
                IF _MOUSEBUTTON(2) = 0 AND show_c THEN
                    show_c = 0
                    SCREEN 0, 0, 0, 0
                END IF
            END IF

            IF lb AND hl = 0 AND drag = 0 THEN
                IF paste.cnt AND my = paste.cnt THEN ' Toggle for single selected item.
                    clipper%(paste.cnt) = 0
                    CALL show_sam
                    paste.cnt = 0
                    hl = -1 ' Prevents highlighting from relooping.
                ELSE
                    hl = 1 ' Highlight a single line.
                    LOCATE 1, 1, 0 ' Hide cursor.
                    REDIM clipper%(_HEIGHT * 2)
                    CALL show_sam
                    LOCATE my, 1
                    IF clipper%(my) THEN ' Unhighlighted one line.
                        clipper%(my) = 0
                        COLOR 7, 0: PRINT MID$(clipper$(my), 1, _WIDTH);
                        _CLIPBOARD$ = ""
                    ELSE
                        REDIM clipper%(_HEIGHT * 2)
                        IF LEN(clipper$(my)) THEN ' Highlight a line.
                            COLOR 14, 1: PRINT MID$(clipper$(my), 1, _WIDTH);: COLOR 7, 0
                            clipper%(my) = my: paste.cnt = my
                        ELSE
                            paste.cnt = 0: ' Ignore a blank line.
                        END IF
                    END IF
                END IF
            ELSE
                IF lb THEN
                    IF oldmy <> my AND drag = 0 THEN
                        LOCATE oldmy, 1
                        REDIM clipper%(_HEIGHT * 2)
                        COLOR 14, 1: PRINT MID$(clipper$(oldmy), 1, _WIDTH);: COLOR 7, 0
                        clipper%(oldmy) = 1
                        LOCATE oldmy, 1 ' IMPORTANT to restoring correct row with print to edge entries. This will be passed to drag_hl as CSRLIN.
                        CALL drag_hl(drag): _CONTINUE
                    END IF

                    IF clipper$(my) = "" AND drag = 0 THEN
                        LOCATE my, 1, 1, 7, 30 ' Show cursor at a blank space.
                        placement.cnt = my
                    END IF
                END IF
            END IF
        ELSE ' Click on the next space you want another clip added to the list.
            IF lb AND drag = 0 THEN
                LOCATE my, 1, 1, 7, 30 ' Show cursor.
                placement.cnt = my
            END IF
        END IF
        oldmy = my
    ELSEIF drag = 0 THEN ' Mouse cursor is outide of QB64 program window and drag is not engaged.
        IF paste.cnt THEN ' Paste into document.
            IF GetAsyncKeyState(1) < 0 THEN
                CALL prep_doc_paste
                SOUND 1000, .2
                _SCREENCLICK Hold.X_Pos, Hold.Y_Pos
                _DELAY .1
                IF GetAsyncKeyState(17) = 0 THEN
                    SENDKEYS VK_ALT, 0, 0, 0
                    SENDKEYS &H45, 0, 0, 0 ' Alt+E open IDE edit menu.
                    _DELAY .1
                    SENDKEYS &H50, 0, 0, 0 ' P
                    _DELAY .1
                    SENDKEYS &H50, 0, KEYEVENTF_KEYUP, 0
                    SENDKEYS &H45, 0, KEYEVENTF_KEYUP, 0
                    SENDKEYS VK_ALT, 0, KEYEVENTF_KEYUP, 0
                ELSE
                    _SCREENPRINT CHR$(22)
                    _DELAY .1
                END IF
            END IF
            _CLIPBOARD$ = "" ' Clear clipboard after paste.
        ELSE ' Add to Sam-Clip.
            IF GetAsyncKeyState(1) < 0 AND win32lb = 0 THEN win32lb = -1: z1 = TIMER
            IF win32lb = -1 AND GetAsyncKeyState(1) >= 0 THEN
                IF ABS(z1 - TIMER) > .5 THEN
                    IF GetAsyncKeyState(17) = 0 THEN
                        _DELAY .1
                        SENDKEYS VK_ALT, 0, 0, 0
                        SENDKEYS &H45, 0, 0, 0 ' Alt+E open IDE edit menu.
                        _DELAY .2
                        SENDKEYS &H43, 0, 0, 0 ' C
                        _DELAY .2
                        SENDKEYS &H43, 0, KEYEVENTF_KEYUP, 0
                        SENDKEYS &H45, 0, KEYEVENTF_KEYUP, 0
                        SENDKEYS VK_ALT, 0, KEYEVENTF_KEYUP, 0
                    ELSE
                        _SCREENPRINT CHR$(3)
                    END IF
                    _DELAY .1
                    _KEYCLEAR
                    IF LEN(_CLIPBOARD$) THEN CALL clip_get
                    _CLIPBOARD$ = ""
                    win32lb = 0: z1 = TIMER
                ELSE
                    win32lb = 0: z1 = TIMER
                END IF
            END IF
        END IF
    END IF
LOOP
END

SUB prep_doc_paste:
    tmp2$ = ""
    IF INSTR(clipper$(paste.cnt), CHR$(255)) THEN
        tmp$ = _TRIM$(MID$(clipper$(paste.cnt), 151))
        DO UNTIL INSTR(tmp$, CHR$(255)) = 0
            j = INSTR(tmp$, CHR$(255)) - 1
            tmp2$ = tmp2$ + MID$(tmp$, 1, j) + CHR$(13) + CHR$(10)
            tmp$ = MID$(tmp$, j + 2)
        LOOP
        tmp2$ = MID$(tmp2$, 1, LEN(tmp2$) - 2) ' Chop off trailing CHR$(13) + CHR$(10)
        _CLIPBOARD$ = tmp2$: tmp2$ = ""
    ELSE
        i = 0
        DO
            i = i + 1
            IF clipper%(i) THEN
                IF INSTR(clipper$(i), CHR$(255)) THEN
                    ' Ignore collapsed headers in paste prep.
                ELSE
                    _CLIPBOARD$ = _CLIPBOARD$ + clipper$(i) + CHR$(13) + CHR$(10)
                END IF
            END IF
        LOOP UNTIL i >= c.cnt
        _CLIPBOARD$ = MID$(_CLIPBOARD$, 1, LEN(_CLIPBOARD$) - 2)
    END IF
    paste.cnt = 0
    REDIM clipper%(_HEIGHT * 2)
    CALL show_sam
END SUB

SUB show_sam
    CLS
    FOR i = 1 TO _HEIGHT - 1
        LOCATE i, 1
        IF clipper%(i) < 0 THEN COLOR 2 ELSE COLOR 7
        IF INSTR(clipper$(i), CHR$(255)) THEN
            PRINT MID$(clipper$(i), 1, INSTR(clipper$(i), "]"));
        ELSE
            PRINT MID$(clipper$(i), 1, _WIDTH);
        END IF
        IF LEN(clipper$(i)) THEN placement.cnt = i
    NEXT
    COLOR 7
    placement.cnt = placement.cnt + 1 ' Next available space.
END SUB

SUB clip_get
    LOCATE , , 0 ' Hide cursor.
    IF c.cnt < _HEIGHT THEN
        a.clip = _CLIPBOARD$
        IF RIGHT$(a.clip, 2) <> CHR$(13) + CHR$(10) THEN a.clip = a.clip + CHR$(13) + CHR$(10)
        IF LEN(a.clip) THEN
            SOUND 1000, .2
            IF INSTR(INSTR(a.clip, CHR$(13) + CHR$(10)) + 1, a.clip, CHR$(13) + CHR$(10)) THEN
                CALL condense
            END IF
            c.cnt = 0: REDIM clipper%(_HEIGHT * 2), clipper$(_HEIGHT * 2)
            IF _FILEEXISTS("Sam-Clip.dat") THEN
                OPEN "Sam-Clip.dat" FOR BINARY AS #1
                IF LOF(1) THEN
                    DO UNTIL EOF(1)
                        IF c.cnt + 1 >= placement.cnt THEN EXIT DO
                        c.cnt = c.cnt + 1
                        LINE INPUT #1, clipper$(c.cnt)
                    LOOP
                END IF
            END IF

            IF placement.cnt > c.cnt + 1 THEN ' Include any blank spaces between established text and new entry.
                DO UNTIL c.cnt = placement.cnt - 1
                    c.cnt = c.cnt + 1
                    clipper$(c.cnt) = ""
                LOOP
            END IF

            ' Parse clipboard.
            i = 0: j = 1 ' Instr() seed.
            IF INSTR(a.clip, CHR$(255)) = 0 THEN
                DO UNTIL INSTR(j, a.clip, CHR$(13) + CHR$(10)) = 0
                    i = i + 1
                    tmp$ = MID$(a.clip, j, INSTR(j, a.clip, CHR$(13)) - j)
                    j = j + LEN(tmp$) + 2
                    DO UNTIL INSTR(tmp$, CHR$(9)) = 0
                        tmp$ = MID$(tmp$, 2)
                    LOOP
                    DO UNTIL INSTR(tmp$, CHR$(0)) = 0
                        tmp$ = MID$(tmp$, 2)
                    LOOP
                    tmp$ = LTRIM$(tmp$)
                    c.cnt = c.cnt + 1
                    clipper$(c.cnt) = tmp$
                    clipper%(c.cnt) = -1
                LOOP
            ELSE
                c.cnt = c.cnt + 1
                clipper$(c.cnt) = a.clip
                clipper%(c.cnt) = -1
            END IF
            _CLIPBOARD$ = ""
            ' Save file update routine.
            IF _FILEEXISTS("Sam-Clip.dat") THEN
                IF NOT EOF(1) AND LOF(1) > 0 THEN
                    DO UNTIL EOF(1)
                        c.cnt = c.cnt + 1
                        LINE INPUT #1, clipper$(c.cnt)
                    LOOP
                END IF
                CLOSE #1
            END IF

            IF _FILEEXISTS("Sam-Clip.dat") THEN
                IF _FILEEXISTS("Sam-Clip.tmp") THEN KILL "Sam-Clip.tmp"
                NAME "Sam-Clip.dat" AS "Sam-Clip.tmp"
            END IF

            i = 0
            OPEN "Sam-Clip.dat" FOR OUTPUT AS #2
            DO UNTIL i = c.cnt
                i = i + 1
                PRINT #2, clipper$(i)
            LOOP
            CLOSE #2
            CALL show_sam
        END IF
    ELSE
        BEEP ' Clipboard menu full.
    END IF
END SUB

SUB condense
    y = CSRLIN: x = POS(0)
    LOCATE placement.cnt, 1
    COLOR 2
    PRINT "[Collapse Copied Text into Header? ";: COLOR 15, 2: PRINT " Y ";: COLOR 2, 0: PRINT "/";: COLOR 15, 2: PRINT " N ";: COLOR 2, 0: PRINT "]"
    i = 0
    DO
        _LIMIT 30
        WHILE _MOUSEINPUT: WEND
        my2 = _MOUSEY
        mx2 = _MOUSEX
        IF _MOUSEBUTTON(1) OR i THEN
            i = SCREEN(my2, mx2)
            IF i = ASC("Y") THEN
                LOCATE my2, 1
                LOCATE my2, 1: PRINT "[" + SPACE$(_WIDTH - 2) + "]";
                LOCATE my2, 2
                CALL keyboard
                ' Routine to add contents to header for file input...
                tmp$ = ""
                j = 1 ' Instr() seed.
                DO UNTIL INSTR(j, a.clip, CHR$(13) + CHR$(10)) = 0
                    tmp$ = MID$(a.clip, j, INSTR(j, a.clip, CHR$(13)) - j)
                    j = j + LEN(tmp$) + 2
                    DO UNTIL INSTR(tmp$, CHR$(9)) = 0
                        tmp$ = MID$(tmp$, 2)
                    LOOP
                    DO UNTIL INSTR(tmp$, CHR$(0)) = 0
                        tmp$ = MID$(tmp$, 2)
                    LOOP
                    tmp2$ = tmp2$ + LTRIM$(tmp$) + CHR$(255)
                LOOP
                a.clip = "[" + header.clip + "]" + SPACE$(150) + tmp2$
                EXIT DO
            ELSEIF i = ASC("N") THEN
                EXIT DO
            END IF
        END IF
        b$ = INKEY$
        IF UCASE$(b$) = "Y" THEN
            i = ASC("Y")
        ELSEIF UCASE$(b$) = "N" THEN
            i = ASC("N")
        END IF
    LOOP
END SUB

SUB keyboard
    LOCATE , , 1, 7, 7 ' Show cursor.
    numofspaces% = _WIDTH - 2
    startpos% = POS(1)
    endpos% = startpos% + numofspaces%
    DO
        DO
            _LIMIT 30
            b$ = INKEY$
            IF LEN(b$) THEN EXIT DO
        LOOP
        xx% = CSRLIN: yy% = POS(1)

        SELECT CASE b$
            CASE CHR$(0) + "K"
                mov% = -1: GOSUB action
            CASE CHR$(0) + "M"
                mov% = 1: GOSUB action
            CASE CHR$(0) + "S"
                GOSUB wash: GOSUB delete
            CASE CHR$(0) + "R"
                IF ins% = 0 THEN ins% = -1 ELSE ins% = 0
                IF ins% = 0 THEN LOCATE , , 1, 7, 7 ELSE LOCATE , , 1, 7, 30
            CASE CHR$(0) + "O"
                IF word$ <> "" THEN LOCATE xx%, startpos% + LEN(word$)
            CASE CHR$(0) + "G"
                LOCATE xx%, startpos%
            CASE CHR$(8)
                IF yy% > startpos% THEN
                    LOCATE , POS(1) - 1
                    yy% = POS(1)
                    GOSUB wash: GOSUB delete
                END IF
            CASE CHR$(13)
                LOCATE , , 0 ' Hide cursor.
                header.clip = word$
                EXIT SUB
            CASE CHR$(27)
                EXIT DO
            CASE CHR$(32) TO CHR$(126)
                key$ = b$: GOSUB action
        END SELECT
        mov% = 0: key$ = ""
    LOOP

    action:
    IF POS(1) + mov% >= startpos% AND POS(1) + mov% < endpos% THEN
        DO
            IF key$ <> "" THEN
                SELECT CASE ins%
                    CASE 0
                        IF LEN(word$) + LEN(key$) > endpos% - startpos% THEN EXIT DO
                        word$ = MID$(word$, 1, POS(1) - startpos%) + key$ + MID$(word$, POS(1) - startpos% + 1)
                    CASE -1
                        word$ = MID$(word$, 1, POS(1) - startpos%) + key$ + MID$(word$, POS(1) - startpos% + 2)
                END SELECT
            END IF
            IF POS(1) - startpos% >= LEN(word$) - LEN(key$) AND key$ <> "" OR key$ = "" OR ins% = -1 THEN
                IF key$ = "" AND mov% = 1 THEN IF POS(1) - startpos% = LEN(word$) THEN EXIT DO
                LOCATE , POS(1) + mov%: PRINT key$;
            ELSE
                LOCATE xx%, startpos%: PRINT MID$(word$, 1, yy% - startpos%); key$;: yy2% = POS(1): PRINT MID$(word$, yy% - startpos% + 2);: LOCATE xx%, yy2%
            END IF
            EXIT DO
        LOOP
    END IF
    RETURN

    wash:
    IF POS(1) >= startpos% AND word$ <> "" AND POS(1) - startpos% < LEN(word$) THEN
        LOCATE xx%, startpos% + LEN(word$) - 1
        PRINT " ";
        LOCATE xx%, yy%
    END IF
    RETURN

    delete:
    IF POS(1) - startpos% = 0 THEN
        word$ = MID$(word$, 2)
    ELSE
        word$ = MID$(word$, 1, POS(1) - startpos%) + MID$(word$, POS(1) - startpos% + 2)
    END IF
    PRINT MID$(word$, yy% - startpos% + 1);: LOCATE xx%, yy%
    RETURN
END SUB

SUB show_collapse (my)
    SCREEN 0, 0, 1, 0
    PALETTE 4, 8
    COLOR 15, 4
    tmp$ = _TRIM$(MID$(clipper$(my), 151))
    i = 0
    CLS
    DO UNTIL INSTR(tmp$, CHR$(255)) = 0
        i = i + 1
        j = INSTR(tmp$, CHR$(255)) - 1
        tmp2$ = MID$(tmp$, 1, j)
        PRINT MID$(tmp2$, 1, _WIDTH)
        IF i >= _HEIGHT - 1 THEN EXIT DO
        tmp$ = MID$(tmp$, j + 2)
    LOOP
    SCREEN 0, 0, 1, 1
    COLOR 7, 0
END SUB

SUB drag_hl (drag)
    LOCATE , , 0 ' Hide cursor
    y = CSRLIN
    WHILE -1
        _LIMIT 120
        WHILE _MOUSEINPUT: WEND
        my = _MOUSEY
        x = SGN(my - y)
        IF x THEN
            IF oldx AND x <> oldx THEN
                IF retrace THEN retrace = 0 ELSE retrace = 1
                LOCATE y, 1
            END IF
            DO UNTIL y = my OR y = 1 AND x < 0 OR y = _HEIGHT - 1 AND x > 0
                IF _MOUSEBUTTON(1) = 0 THEN EXIT WHILE
                IF retrace = 0 THEN y = y + x
                LOCATE y, 1
                IF clipper%(y) = 0 THEN COLOR 14, 1: clipper%(y) = 1 ELSE COLOR 7, 0: clipper%(y) = 0
                PRINT MID$(clipper$(y), 1, _WIDTH);
                retrace = 0
            LOOP
            oldx = x
        END IF
        IF _MOUSEBUTTON(1) = 0 THEN EXIT WHILE
    WEND
    COLOR 7, 0
    drag = 0
END SUB

Pete
Reply
#2
Added a way to save the clipped lines and a way to decide where to paste them. If you want something pasted other on the next free line in the list, just click to highlight the line to paste and before highlighting the part of a document to copy, just left click, in a free space in the list, where you want to add the item you are about to clip. This way, you can have some free space between items.

Pete
Reply
#3
a good snippets app would be nice, have you considered extending Sam-Clip in that regard?
Reply
#4
Snippet as in a snippet of code, like saving a sub on the clipboard? If so, then yes. My vision would be to give it a list name like a header [Display Text Sub] and when you click and paste it, it pastes all the lines of that sub into the receiving window. I would also like to have a right click to view the contents of that header.

If you mean something else, please provide me with an example.

Thanks,

Pete
Reply
#5
I meant code snippets of course Smile
Reply
#6
Then yes. What did you think of my described method. Any other ideas?

Pete
Reply
#7
Lightbulb 
Someone get on Github and push it up as enhancement LOL!

Code: (Select All)
IF | THEN
(blank line)
END IF

Cursor placed on pipe symbol. See if it annoys people.

I liked Steve's modification of the last SDL version of QB64, but the keystrokes for the "completion" that he chose were too "challenging" for me. Oh well it prevented me from relying a lot on it just to kludge a program. Smile
Reply
#8
(11-06-2022, 05:15 AM)mnrvovrfc Wrote: I liked Steve's modification of the last SDL version of QB64, but the keystrokes for the "completion" that he chose were too "challenging" for me. Oh well it prevented me from relying a lot on it just to kludge a program. Smile

And now I don't even remember what the heck you're talking about?  keystrokes for completion?  What the heck did I end up doing with that last version of SDL back when??
Reply
#9
(11-06-2022, 05:25 AM)SMcNeill Wrote: And now I don't even remember what the heck you're talking about?  keystrokes for completion?  What the heck did I end up doing with that last version of SDL back when??
@SMcNeill

Wasn't this by you? Contents of a post made on the oldest QB64 forum:

As requested by OlDosLover here:



Quote from: OlDosLover on January 02, 2013, 05:13:04 AM

I think these tweaks should all be in one place for consolidation purposes. I also think you should make a copy of the source available for download for people that dont wish to delve into modifying the source themsleves and would rather use the finished product.




So, I'm doing as requested and uploading everything all prepackaged, for those who aren't that interested in changing the source code themselves...

So, what does this do for us that the latest QB64 SDL doesn't do?

* It fixes the WRITE bug that can eat your code.
* It makes fixed length strings available for use with _MEM.
* It makes fixed length string arrays available for use with _MEM.
* It expands the CONST command so that we can now use it with _RGB values.  (As discussed here: /NOLINK/www.qb64.net/forum/index.php?topic=10244.0)
* It strips out portions of the QB64 source into component modules, to make moving around and editing inside them a bit easier, and to start us in the direction of an eventual modularized version of QB64.

* version 954a2 fixes the bug that was causing PRINT USING to sometimes display wrong results as discussed here: /NOLINK/www.qb64.net/forum/index.php?topic=10350.0

*version 954a3 fixes the FOR-NEXT bug inside $CHECKING:OFF as described by Galleon here: /NOLINK/www.qb64.net/forum/index.php?topic=10353.msg85694#msg85694
* It adds support for a new _MATH sub-function for use only inside CONST.  _MATH allows us to use COS, SIN, TAN, ATN, LOG, SQR, CSC, SEC, COT, PI inside our CONST.  Usage will be explained better a few posts lower.  /NOLINK/www.qb64.net/forum/index.php?topic=10251.msg85768#msg85768

*version 954a4 credit goes completely to DSMan195276.  Everyone give Matt a big old "Thank You!" for this expansion.  What did he do for us?  He went in and expanded the _math function which we could use with our constants so that it would work recursively with itself.  Before CONST x = _math(COS(30)) would work, but CONST x = _math(COS(COS(30))) would not.  Now, that's fixed.  We can now use our functions inside our functions, with no problems.  Even things like Const x = _math(1) works now, where before it needed one of our functions for it to work.  Many thanks Matt!

*version 954a5 adds multiple variable support on the lines that use _RGB with CONST now.  If you use _MATH with CONST, **KEEP** math for a single variable until use for it can be expanded upon as well. 

*version 954b now finally allows us to use multiple variables with the _MATH function as well.  No more worrying over 1 per line, and you can mix and match them up.  CONST x = _math(cos(30)), a = 14, b = _RGB32(255,255,0)  will all work on a single line now and generate proper results for all the variables in the mix.  (Or should I say all the constants in the mix.  )

*version 964c now allows us to generate our own quick insertion codes, to reduce typing and repetitive stress injuries on our fingers and knuckles.

Just download, extract in the original Qb64 (SDL version) directory (nothing overwrites existing files), and then use the exe here to write and compile your programs, and you're all set to take advantage of these tweaks and modifications.  It's that simple. 

(end of post)

My underline above, and I also "neutralized" the links that do not work toward the oldest QB64 forum.

I have the 0.954d3 archive in RAR format. It's only 1.2MB so I could probably place it as attachment on this forum.
Reply
#10
And now back to our previously derailed topic: Book learning vs non-book learning.

Recommended subject reading: How to Think for Yourself by Simon and Shyster.

Pete
Reply




Users browsing this thread: 2 Guest(s)