Recent Posts

Pages: 1 2 3 4 5 6 7 8 9 10
1
OxygenBasic / Re: The new Oxygenbasicprogress.zip compile differently
« Last post by Chris Chancellor on January 17, 2019, 11:25:54 PM »

Now i had made some changes in the O2Tooltips.inc by replacing all  string  types with bstring
and now was able to make the tooltips work.

There are still some issues with the Multiline header and Status bar
so anyone got any ideas that can help out here ?


here's the new listing of O2Tooltips.inc

Code: [Select]
    'O2ToolTips.inc
    'https://docs.microsoft.com/de-de/windows/desktop/Controls/tooltip-control-reference
     'https://www.oxygenbasic.org/forum/index.php?PHPSESSID=oeqf5lmiprivqr5uadgkijer94&topic=1751.msg19014;topicseen#msg19014
   '  Updated  Jan 17 2019
  '   Allowing differing color tooltips text
 '   Changed char*  and string to bstring in the tooltips -- so that it works
'    with Oxygenbasicprogress.zip of  Jan 14 2019
     
   #lookahead


    ' tooltips constants
    % TTF_IDISHWND=1
    % TTF_CENTERTIP=2
    % TTF_SUBCLASS=16
    % TTI_NONE  0
    % TTI_INFO  1
    % TTI_WARNING  2
    % TTI_ERROR  3
    % TTI_INFO_LARGE  4
    % TTI_WARNING_LARGE  5
    % TTI_ERROR_LARGE  6
    % TTM_ADDTOOL=1028
    % TTM_DELTOOL=1029
    % TTM_SETTIPBKCOLOR=1043
    % TTM_SETTIPTEXTCOLOR=1044
    % TTM_SETMAXTIPWIDTH=1048
    % TTM_SETTITLE=1056
    % TTS_ALWAYSTIP=1
    % TTS_BALLOON=64
    % TTM_NEWTOOLRECTA    = %WM_USER + 6
    % TTM_NEWTOOLRECTW    = %WM_USER + 52
     %  TTM_ACTIVATE        = %WM_USER + 1
     %  TTM_SETDELAYTIME    = %WM_USER + 3


' GetSystemMetrics() codes
% SM_CXSCREEN            = 0
% SM_CYSCREEN            = 1
% SM_CXVSCROLL           = 2
% SM_CYHSCROLL           = 3
% SM_CYCAPTION           = 4
% SM_CXBORDER            = 5
% SM_CYBORDER            = 6
% SM_CXDLGFRAME          = 7
% SM_CYDLGFRAME          = 8
% SM_CYVTHUMB            = 9
% SM_CXHTHUMB            = 10
% SM_CXICON              = 11
% SM_CYICON              = 12
% SM_CXCURSOR            = 13
% SM_CYCURSOR            = 14
% SM_CYMENU              = 15
% SM_CXFULLSCREEN        = 16
% SM_CYFULLSCREEN        = 17
% SM_CYKANJIWINDOW       = 18
% SM_MOUSEPRESENT        = 19
% SM_CYVSCROLL           = 20
% SM_CXHSCROLL           = 21
% SM_DEBUG               = 22
% SM_SWAPBUTTON          = 23
% SM_RESERVED1           = 24
% SM_RESERVED2           = 25
% SM_RESERVED3           = 26
% SM_RESERVED4           = 27
% SM_CXMIN               = 28
% SM_CYMIN               = 29
% SM_CXSIZE              = 30
% SM_CYSIZE              = 31
% SM_CXFRAME             = 32
% SM_CYFRAME             = 33
% SM_CXMINTRACK          = 34
% SM_CYMINTRACK          = 35
% SM_CXDOUBLECLK         = 36
% SM_CYDOUBLECLK         = 37
% SM_CXICONSPACING       = 38
% SM_CYICONSPACING       = 39
% SM_MENUDROPALIGNMENT   = 40
% SM_PENWINDOWS          = 41
% SM_DBCSENABLED         = 42
% SM_CMOUSEBUTTONS       = 43

% SM_CXFIXEDFRAME        = % SM_CXDLGFRAME  ' win40 name change
% SM_CYFIXEDFRAME        = % SM_CYDLGFRAME  ' win40 name change
% SM_CXSIZEFRAME         = % SM_CXFRAME     ' win40 name change
% SM_CYSIZEFRAME         = % SM_CYFRAME     ' win40 name change

% SM_SECURE              = 44
% SM_CXEDGE              = 45
% SM_CYEDGE              = 46
% SM_CXMINSPACING        = 47
% SM_CYMINSPACING        = 48
% SM_CXSMICON            = 49
% SM_CYSMICON            = 50
% SM_CYSMCAPTION         = 51
% SM_CXSMSIZE            = 52
% SM_CYSMSIZE            = 53
% SM_CXMENUSIZE          = 54
% SM_CYMENUSIZE          = 55
% SM_ARRANGE             = 56
% SM_CXMINIMIZED         = 57
% SM_CYMINIMIZED         = 58
% SM_CXMAXTRACK          = 59
% SM_CYMAXTRACK          = 60
% SM_CXMAXIMIZED         = 61
% SM_CYMAXIMIZED         = 62
% SM_NETWORK             = 63
% SM_CLEANBOOT           = 67
% SM_CXDRAG              = 68
% SM_CYDRAG              = 69
% SM_SHOWSOUNDS          = 70
% SM_CXMENUCHECK         = 71   ' Use instead of GetMenuCheckMarkDimensions()
% SM_CYMENUCHECK         = 72
% SM_SLOWMACHINE         = 73
% SM_MIDEASTENABLED      = 74
% SM_MOUSEWHEELPRESENT   = 75
% SM_XVIRTUALSCREEN      = 76
% SM_YVIRTUALSCREEN      = 77
% SM_CXVIRTUALSCREEN     = 78
% SM_CYVIRTUALSCREEN     = 79
% SM_CMONITORS           = 80
% SM_SAMEDISPLAYFORMAT   = 81
% SM_IMMENABLED          = 82
% SM_CXFOCUSBORDER       = 83
% SM_CYFOCUSBORDER       = 84
% SM_TABLETPC            = 86
% SM_MEDIACENTER         = 87
% SM_STARTER             = 88
% SM_SERVERR2            = 89
% SM_MOUSEHORIZONTALWHEELPRESENT  = 91
% SM_CXPADDEDBORDER       = 92
% SM_DIGITIZER            = 94
% SM_MAXIMUMTOUCHES       = 95
% SM_CMETRICS             = 97   ' depends on Windows version
% SM_REMOTESESSION        = &H1000
% SM_SHUTTINGDOWN         = &H2000
% SM_REMOTECONTROL        = &H2001
% SM_CARETBLINKINGENABLED = &H2002



    type TOOLINFO
      UINT      cbSize
      UINT      uFlags
      sys       hwnd
      sys       uId    'UINT_PTR
      RECT      rect   'must be checked
      sys       hinst
      bstring     lpszText
      sys       lParam
      sys       *lpReserved
    end type
     

   sys hTooltip ,  hToolTipLVH , hToolTipLVH2


!  FUNCTION SetWindowTheme LIB "UxTheme.dll" ALIAS "SetWindowTheme" ( _
   BYVAL hwnd AS sys  _                                ' __in HWND hwnd
 , BYREF pszSubAppName AS WSTRING _                    ' __in LPCWSTR pszSubAppName
 , BYREF pszSubIdList AS WSTRING _                     ' __in LPCWSTR pszSubIdList
 ) AS LONG                                              ' HRESULT




'============================================
' Calling SetWindowTheme with an empty string for a control
'     do that it is NOT painted with the current window  Theme.
'   This is to ensure that color tooltips can be display for that control
'  https://forum.powerbasic.com/forum/user-to-user-discussions/source-code/776731-custom-tooltip-on-a-region
'
FUNCTION DisableThemeControl(BYVAL hControl AS Sys) AS LONG
    LOCAL hLib AS Sys, pProc AS Sys
   Local    lRes AS LONG
    hLib = LoadLibrary("UxTheme.dll")
    IF hLib THEN
        pProc = GetProcAddress(hLib, "SetWindowTheme")
        IF pProc THEN
            lRes =   SetWindowTheme(hControl, " ", " ") 
             FUNCTION = lRes
        END IF
        FreeLibrary hLib
    END IF
END FUNCTION



 '===========================
' Place the  dialog at the topmost position
' most likely be called in the  CASE  WM_INITDIALOG section
SUB SetTopMost(BYVAL sys hwndDlg )
   SetWindowPos hwndDlg,  HWND_TOPMOST ,0,0,0,0, SWP_NOMOVE OR  SWP_NOSIZE
END SUB                                 




'=============================================
 'Set tooltips for any given area in a dialog or control
' Mainly for the listview columns headers which is based
' on the rect area where the mouse hovers
'  It can also display color tooltips, however only one color
'  can be display for each program using this function

  FUNCTION SetToolTipsPArea(BYVAL hWnd AS sys, ttRect AS RECT , _
               BYVAL sTxt AS bString,   BYVAL ttFGcolor  as  sys ,  _
              OPTIONAL RecChangeId AS WORD) AS sys

  LOCAL  ToolInf  AS TOOLINFO
  STATIC hInst    AS sys
  STATIC IDtt       AS sys

  IF hToolTipLVH  = 0 THEN
    hInst    = GetModuleHandle("")
    hToolTipLVH = CreateWindowEx(0, "tooltips_class32", "",
                             TTS_ALWAYSTIP OR TTS_BALLOON, _
                              0, 0, 0, 0, 0, BYVAL NULL, hInst, BYVAL NULL)
 '      Need to disable the theme for this control before
'       we can display its color tooltips
        DisableThemeControl(hToolTipLVH)
        SendMessage (hToolTipLVH, TTM_SETTIPTEXTCOLOR, ttFGColor, 0)
      SetTopMost(hToolTipLVH)
  END IF

 

  ToolInf.cbSize   = SIZEOF(TOOLINFO)
  ' OR  TTF_IDISHWND 'Indicates that the uId member
  ' is the window handle to the tool. If this flag is not set,
  ' uId is the tool's identifier.
  ToolInf.uFlags   = TTF_SUBCLASS
  ToolInf.hwnd     = hWnd
  ToolInf.hinst    = hInst
  ToolInf.rect     = ttRect

  IF VARPTR(RecChangeId) = 0 THEN 'New tooltip
      ToolInf.lpszText = STRPTR(sTxt)
       IDtt = IDtt + 1
      ToolInf.uId = IDtt
      'Returns TRUE if successful
       SendMessage(hToolTipLVH, TTM_ADDTOOL, 0, BYVAL VARPTR(ToolInf))
      '    Allocate for multiline tooltips
      SendMessage(hToolTipLVH, TTM_SETMAXTIPWIDTH, 0, 300)
  ELSE
         'Change rect for an existing tooltip
        ToolInf.uId = RecChangeId
          SendMessage(hToolTipLVH, TTM_NEWTOOLRECTW, 0, BYVAL VARPTR(ToolInf))
     '    Allocate for multiline tooltips
          SendMessage(hToolTipLVH, TTM_SETMAXTIPWIDTH, 0, 300)
   END IF
  FUNCTION = IDtt

 END FUNCTION
             



'=============================================
 'Set tooltips for any given area in a dialog or control
' Mainly for the listview columns headers which is based
' on the rect area where the mouse hovers
'  It can also display color tooltips, however only one color
'  can be display for each program using this same function

  FUNCTION SetToolTipsPArea2(BYVAL hWnd AS sys, ttRect AS RECT , _
               BYVAL sTxt AS bSTRING,   BYVAL ttFGcolor2  as  sys ,  _
              OPTIONAL RecChangeId AS WORD) AS sys

  LOCAL  ToolInf  AS TOOLINFO
  STATIC  hInst2     AS sys
  STATIC   IDtt2        AS sys

  IF hToolTipLVH2  = 0 THEN
    hInst2     = GetModuleHandle("")
    hToolTipLVH2 = CreateWindowEx(0, "tooltips_class32", "",
                             TTS_ALWAYSTIP OR TTS_BALLOON, _
                              0, 0, 0, 0, 0, BYVAL NULL, hInst2 , BYVAL NULL)
 '      Need to disable the theme for this control before
'       we can display its color tooltips
        DisableThemeControl(hToolTipLVH2)
        SendMessage (hToolTipLVH2, TTM_SETTIPTEXTCOLOR, ttFGColor2 , 0)
      SetTopMost(hToolTipLVH2)
  END IF

 

  ToolInf.cbSize   = SIZEOF(TOOLINFO)
  ' OR  TTF_IDISHWND 'Indicates that the uId member
  ' is the window handle to the tool. If this flag is not set,
  ' uId is the tool's identifier.
  ToolInf.uFlags   = TTF_SUBCLASS
  ToolInf.hwnd     = hWnd
  ToolInf.hinst    = hInst2
  ToolInf.rect     = ttRect

  IF VARPTR(RecChangeId) = 0 THEN 'New tooltip
      ToolInf.lpszText = STRPTR(sTxt)
       IDtt2  = IDtt2  + 1
      ToolInf.uId = IDtt2
      'Returns TRUE if successful
       SendMessage(hToolTipLVH2, TTM_ADDTOOL, 0, BYVAL VARPTR(ToolInf))
      '    Allocate for multiline tooltips
      SendMessage(hToolTipLVH2, TTM_SETMAXTIPWIDTH, 0, 300)
  ELSE
         'Change rect for an existing tooltip
        ToolInf.uId = RecChangeId
          SendMessage(hToolTipLVH2, TTM_NEWTOOLRECTW, 0, BYVAL VARPTR(ToolInf))
     '    Allocate for multiline tooltips
          SendMessage(hToolTipLVH2, TTM_SETMAXTIPWIDTH, 0, 300)
   END IF
  FUNCTION = IDtt2

 END FUNCTION
             




 
     '=========================================================
    Function SetToolTip(sys hwnd, bstring TipText, optional bool Balloon=false,
                bCentered=false) as sys
     
        TOOLINFO TI
        sys flags=TTS_ALWAYSTIP
        uint uFlags=TTF_SUBCLASS or TTF_IDISHWND
     
        if Balloon then
                flags=flags or TTS_BALLOON
         end if
        if bCentered then
              uflags=uflags or TTF_CENTERTIP
         end if
     
         hToolTip = CreateWindowEx(0, "tooltips_class32", "", flags,
                                      0, 0, 0, 0, hwnd, null, GetModuleHandle(null), null)
   

        TI.cbSize    = sizeof(TI)
        TI.uFlags    = uflags
        TI.hWnd      = GetParent(hToolTip)
        TI.uId       = hwnd
        TI.lpszText  = strptr TipText
       
        SendMessage (hToolTip, TTM_ADDTOOL, 0, &ti)
       
         return hToolTip
    End Function
     



 
2
GDImage / Re: HUD help display
« Last post by Chris Chancellor on January 17, 2019, 08:23:20 PM »
Whew!  that's very beautiful.

3
OxygenBasic / The new Oxygenbasicprogress.zip compile differently
« Last post by Chris Chancellor on January 17, 2019, 08:20:59 PM »
Hello Charles

When i use the Oxygenbasicprogress.zip  of Jan 14 2019,  to
compile my Listview with multiline header the resultant exe is broken.

These are

1.  Tooltips do not work -- it display special characters
2. No multiline header -- all in a single line
3.  Statusbar do not display anything

When i used the previous Oxygenbasicprogress.zip  of Jul 21 2018   
all these functions work

Can you please advise what i can do to make these programs work using the
new compiler? 

maybe say change some type sys to dword or what?

i have atteched the program for you to check

Thanxx
4
GDImage / HUD help display
« Last post by Patrice Terrier on January 17, 2019, 07:40:25 PM »
I managed to create a new GDImage help system working in HUD display mode, to keep working while reading.

For example in ObjReader, while browsing the help file you can interact directly with the 3D model to check in real time what you just learned.
 
5
General Discussion / Re: FreeBASIC CWstr
« Last post by Juergen Kuehlwein on January 16, 2019, 04:34:48 PM »
Ok Jeff,


please check the "ustring" branch at my fork (https://github.com/jklwn/fbc).

I hope this is better now. All unnecessary code changes were removed, \tests now contains an \ustring folder for ustring tests and dirlist.mk an "ustring \" line. All tests run successful, 32 and 64 bit. I updated "readme.txt" in \tests a bit. A short documentation is in "ustring,txt" and "ustring.bi" and "stringex.bi" were added to \inc.

I┤m still struggling a bit with GIT: i had to set core.autcrlf = false in order to prevent GIT from doing unwanted things to .txt files. Setting filemode = false didin┤t prevent GIT from staging all (so far untouched by me) .sh files, so i added "*.sh" to .git\info\exclude, which hopefully fixes this. And i had to change the line ends of several (e.g. emit.bi) files from LF to CRLF to make it usable for me. Tell me, if there still is something "wrong" (and maybe how to make it better).


JK

 
6
OxygenBasic / Re: how to do a Union in O2
« Last post by Chris Chancellor on January 15, 2019, 04:22:25 PM »
Thanxx a lot Charles
7
OxygenBasic / Re: how to do a Union in O2
« Last post by Charles Pegge on January 15, 2019, 06:59:16 AM »
Hi Chris,

unions are much the same in o2:

Code: [Select]
UNION ipAddress
   address AS LONG
   octet(4) AS BYTE
END UNION

DIM IpAdn AS ipAddress
8
OxygenBasic / how to do a Union in O2
« Last post by Chris Chancellor on January 15, 2019, 03:01:54 AM »
Hello Charles

in Pb they have a UNION statement to create a data structure for example

Code: [Select]
UNION ipAddress
   address AS LONG
   octet(1 TO 4) AS BYTE
END UNION


DIM IpAdn AS ipAddress


how do we rewrite this structure in O2 ?

Thanxx in advanced
9
OxygenBasic / Re: what is this notation qs*=
« Last post by Chris Chancellor on January 14, 2019, 06:00:28 PM »
Thanxx a lot, Mike
10
OxygenBasic / Re: what is this notation qs*=
« Last post by Mike Lobanovsky on January 14, 2019, 05:21:31 PM »
qs *= 0x10000 is a shorthand for qs = qs * 0x10000 pretty much like qs += 1 is a shorthand for qs = qs + 1.

The math operator preceding assignment can be any arith or logical operator like *=, /=, AND= etc., in which case the expression unrolls as shown above.

Note there should be no space between the operator and assignment for the O2 parser to understand the expression.
Pages: 1 2 3 4 5 6 7 8 9 10