UPDATING THE OPEN SOURCE EDITOR

by Alyce Watson

Home

Contest Update

Liberty BASIC 3!

Open Source Editor

Tip Corner

Callbacks Explained

Drag 'n' Drop

Drag 'n' Drop in LB3

Gnu Liberty BASIC Compiler

LB2BCX

Newsletter Help

Index

API CALLS

To make the Open Source Editor LB3 compliant, it is necessary to change all API calls. The first step in doing that is to change the DLL names in the "open" statement. For 32-bit use, we must open "user32", "shell32", "kernel32", "gdi32", "comctl32", and so on. It is also necessary to change many of the type parameters used in the calls. Most "shorts" will be changed to "longs" for instance. Previously, there was no boolean type, so we used ushort in its place. Now we may use boolean where needed. In addition, some function calls have changed their names. This occurs for calls that have a text (ptr) parameter. The function name gains a final "A", which stands for "ascii". In this program, we changed the API calls for ShellExecuteA, SetWindowTextA, and ModifyMenuA.

Another notable update is the change in the tooltip routine. For the original explanation of tooltips in the Open Source Editor, please see The Liberty BASIC Newsletter, Issue #60. In addition to changing some types and changing the function name from "SendMessage" to "SendMessageA", we are able to streamline the code quite a bit. For some reason, in 16-bit Liberty BASIC, it was necessary to have a separate struct for each tooltip. That duplication is no longer needed. A single struct suffices for all tooltips. The general members of this struct need to be filled only one time. The struct members specific to each tooltip are filled just before we send a message to add a tool.

    '** LB3 NOW ONLY REQUIRES A SINGLE STRUCT
    '   FOR ALL TOOLTIPS
    struct toolinfo, cbSize as long, uFlags as long,_
        hwnd as long, uId as long, x as long, y as long,_
        w as long, h as long, _
        hInst as long, lpstrText$ as ptr

    'THESE STRUCT MEMBERS ONLY NEED TO BE FILLED ONCE:
    toolinfo.cbSize.struct = len(toolinfo.struct)
    toolinfo.uFlags.struct = TTF.IDISHWND or TTF.SUBCLASS
    toolinfo.hwnd.struct = h

    'THESE STRUCT MEMBERS NEED TO BE FILLED ANEW
    'FOR EACH TOOTLIP ADDED:

    toolinfo.uId.struct = hwnd(#1.new)
    toolinfo.lpstrText$.struct = "New File"
    calldll #user, "SendMessageA", hwndTT as long,_
    TTM.ADDTOOL as long, 0 as long,_
    toolinfo as struct, re as long


    toolinfo.uId.struct = hwnd(#1.open)
    toolinfo.lpstrText$.struct = "Open File"
    calldll #user, "SendMessageA", hwndTT as long,_
    TTM.ADDTOOL as long, 0 as long,_
    toolinfo as struct, re as long

More changes:

In previous versions of Liberty BASIC, we ran Windows Helpfiles like this (the exe extension is assumed if it is not included):

run "winhelp.exe myhelp.hlp"
or
run "winhelp myhelp.hlp"

We now use the 32-bit help engine:

run "winhlp32.exe myhelp.hlp"
or
run "winhlp32 myhelp.hlp"

The updated Open Source Editor for LB3 is attached as source code and as a tkn.


Home

Contest Update

Liberty BASIC 3!

Open Source Editor

Tip Corner

Callbacks Explained

Drag 'n' Drop

Drag 'n' Drop in LB3

Gnu Liberty BASIC Compiler

LB2BCX

Newsletter Help

Index