1. Where do I call setHint for statusbar?

I have the following code in my parent window General section:

setHint ( {STATUSB,status_flag},"Current mode [Down for mouse]" )
showMessage( {"Start",{STATUSB,status_flag}} )


STATUSB is my status bar control and status_flag is a constant for subfield #

The message is showing ok, but not the tooltip.

Andy Katz

new topic     » topic index » view message » categorize

2. Re: Where do I call setHint for statusbar?

Andrew Katz wrote:
> 
> I have the following code in my parent window General section:
> 
> }}}
<eucode>
> setHint ( {STATUSB,status_flag},"Current mode [Down for mouse]" )
> showMessage( {"Start",{STATUSB,status_flag}} )
> </eucode>
{{{

> 
> STATUSB is my status bar control and status_flag is a constant for subfield
> #
> 
> The message is showing ok, but not the tooltip.

Tooltips for status bar panels are not correctly coded. I've done a bit of
research just now and I can't work out how to interpret the TTN_GETDISPINFO
message the application receives for status bar panels. I need to do some more
reading. Also note that any such tooltip will only show for panels that contain
an icon or text that can't fit into the panel.


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

3. Re: Where do I call setHint for statusbar?

Andrew Katz wrote:
> The message is showing ok, but not the tooltip.

I have a solution but its not a trival fix. The diff-text is below. I've not
tested it in all situations but it seems to be holding up.

** in createEx()
> replace ...
            if sequence(sbPanels) then
                call_proc(r_setSubFields,{id, sbPanels})
            end if
> with ...
            if sequence(sbPanels) then
                call_proc(r_setSubFields,{id, sbPanels})
                call_proc(r_setHintEx, { {id, 0}, pCaption, 0})
            end if

** in setText()
> replace ...
    if atom(pID) then
        id = pID
        lPart = 1
    else
> with ...
    if atom(pID) then
        id = pID
        lPart = 0
    else

> replace ...
    if ctrl_Type[ id ] = StatusBar then

        -- send the text to the statusbar
        VOID = sendMessage( id, SB_SETTEXT,    lPart-1, s)
        VOID = sendMessage( id, SB_SETTIPTEXT, lPart-1, s)
> with ...
    if ctrl_Type[ id ] = StatusBar then

        -- send the text to the statusbar
        VOID = sendMessage( id, SB_SETTEXT,    lPart-1, s)
        call_proc(r_setHintEx, { {id, lPart-1}, s, 0})

** replace all of fDoTTN_GETDISPINFO()
> with ...
-- start tone skoda: support for longer than 80-char long tooltips
atom TTTextPtr
TTTextPtr = 0
-- end tone skoda

----------------------------------------------------
function fDoTTN_GETDISPINFO(integer id, atom hWnd, atom wParam, atom lParam)
----------------------------------------------------
    sequence lText
    atom hFrom
    atom hFromId
    atom lTextLen
    atom lUflags

    -- start tone skoda: autowidth of tooltip
    sequence lineText
    integer largestWid, lineWid
    sequence screenSize
    -- end tone skoda

    id = getId( wParam )
    if id = 0 then
        hFrom = w32fetch(lParam, NMHDR_hwndFrom )
        hFromId = w32fetch(lParam, NMHDR_idFrom )
        lUflags = w32fetch(lParam, NMTTDISPINFO_uFlags )

        id = getId(hFrom)
        if id = 0 then
            if ctrl_Statusbar[ mainWindow ] != 0 then
                id = ctrl_Statusbar[ mainWindow ]
            end if
        end if
    end if

    if id > 0 and id <= length(ctrl_Hint_Text) then
        if atom(ctrl_Hint_Text[id]) then
            if integer(ctrl_Hint_Text[id]) and ctrl_Hint_Text[id] >= 0 then
                -- The user routine returns either a string or a sequence in
                -- the form of { string, width }, eg. {"Sample text", 120}
                lText = call_func(ctrl_Hint_Text[id], {id,
                                ctrl_Hint_Width[id]})
                if length(lText) = 2 and sequence(lText[1]) and
                              integer(lText[2]) then
                    ctrl_Hint_Width[id] = lText[2]
                    lTextLen = lText[2]
                    lText = lText[1]
                elsif length(lText) = 0 then
                    lTextLen = 0
                else
                    lTextLen = ctrl_Hint_Width[id]
                end if
            else
                lText = sprintf("Invalid routine_id %g", ctrl_Hint_Text[id])
                lTextLen = ctrl_Hint_Width[id]
            end if
        else
            if id = ctrl_Statusbar[ mainWindow ] then
                if length(ctrl_Hint_Text[id]) > 0 and
                   sequence(ctrl_Hint_Text[id][1]) then
                    if length(ctrl_Hint_Text[id][1]) > hFromId then
                        lText = ctrl_Hint_Text[id][1][hFromId+1]
                    else
                        lText = ""
                    end if
                else
                    lText = ctrl_Hint_Text[id]
                end if
            else
                lText = ctrl_Hint_Text[id]
            end if
            lTextLen = ctrl_Hint_Width[id]
       end if

        w32store( lParam, NMTTDISPINFO_szText, lText )

        -- start tone skoda: support for longer than 80-char long tooltips
        if length (lText) > 80 then
            if TTTextPtr != 0 then
                w32release_mem (TTTextPtr)
            end if
            TTTextPtr = w32acquire_mem (0, lText)
            w32store( lParam, NMTTDISPINFO_lpszText, TTTextPtr )
        end if
        -- end tone skoda

        -- start tone skoda: autowidth of tooltip

        -- 1.get largestWid
        lineText = ""
        largestWid = 0
        for i = 1 to length (lText) do
            if lText [i] = '\n' or i = length (lText) then
                if i = length (lText) then
                    lineText &= lText [i]
                end if
                if not tooltipControl then
                    tooltipControl = createEx( ToolTip, "", 
                                        0, 0, 0, 0, 0, 0, 0)
                end if
                lineWid = getTextWidth (tooltipControl, lineText)
                if lineWid > largestWid then
                    largestWid = lineWid
                end if
                lineText = ""
            else
                lineText &= lText [i]
            end if
        end for

        -- 2. get lTextLen, if larger than screen then adjust to screen
        lTextLen = largestWid
        screenSize = getCtlSize( Screen )
        if lTextLen > screenSize [1] then
            lTextLen = screenSize [1]
        end if
        -- end tone skoda

        VOID = w32Func(xSendMessage,{w32fetch(lParam, NMHDR_hwndFrom ),
                          TTM_SETMAXTIPWIDTH, 0,
                          lTextLen})

    end if

   return {kMainMsg}
end function

** in setHintEx() 
> replace ...
            VOID = sendMessage(id, SB_SETTIPTEXT, lPart, text)
> with ...
            VOID = sendMessage(id, SB_SETTIPTEXT, lPart, text)
            if not tooltipControl then
                tooltipControl = createEx( ToolTip, "", 0, 0, 0, 0, 0, 0, 0)
            end if
            if lPart >= 0 then
                lPart += 1
                if length(ctrl_Hint_Text[id]) = 0 then
                    ctrl_Hint_Text[id] = {{}}
                end if
                if length(ctrl_Hint_Text[id][1]) < lPart then
                    ctrl_Hint_Text[id][1] = append(ctrl_Hint_Text[id][1],
                         repeat("", 1 + lPart - length(ctrl_Hint_Text[id])))
                end if
                ctrl_Hint_Text[id][1][lPart] = text
            else                  
                ctrl_Hint_Text[id] = text
            end if
----------------

Okay so try this out and let me know if it works for you. Then I can add it to
the 'official' code base.
-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

4. Re: Where do I call setHint for statusbar?

That is an amazing fix.

The first time I ran my program, I got the following error. This is from the
file ex.err:

C:\EUPHORIA\include\Win32Lib.ew:33892 in procedure setHintEx() 
subscript value 2 is out of bounds, assigning to a sequence of length 1 
    id = 15
    text = {83'S',116't',97'a',114'r',116't',32' ',111'o',102'f',32' ',101'e',
108'l',108'l',105'i',112'p',115's',101'e',32' ',109'm',111'o',117'u',115's',
101'e',32' ',112'p',111'o',115's',105'i',116't',105'i',111'o',110'n',32' ',
120'x',44',',121'y'}
    exflags = 0
    ti = <no value>
    lTTflags = <no value>
    lTTmsg = <no value>
    rect = <no value>
    parentId = <no value>
    lPart = 2

... called from C:\EUPHORIA\include\Win32Lib.ew:34040 in procedure setHint()  
    id = {15,1}
    text = {83'S',116't',97'a',114'r',116't',32' ',111'o',102'f',32' ',101'e',
108'l',108'l',105'i',112'p',115's',101'e',32' ',109'm',111'o',117'u',115's',
101'e',32' ',112'p',111'o',115's',105'i',116't',105'i',111'o',110'n',32' ',
120'x',44',',121'y'}

... called from C:\Documents and Settings\Andrew Katz\My
Documents\EUPHORIA\Designer_TEMP.exw:194

Here is the your code in the library (note that our line numbers may not match):

if lPart >= 0 then
                lPart += 1
                if length(ctrl_Hint_Text[id]) = 0 then
                    ctrl_Hint_Text[id] = {{}}
                end if
                if length(ctrl_Hint_Text[id][1]) < lPart then
                    ctrl_Hint_Text[id][1] = append(ctrl_Hint_Text[id][1],
                         repeat("", 1 + lPart - length(ctrl_Hint_Text[id])))
                end if
                ctrl_Hint_Text[id][1][lPart] = text
            else                  
                ctrl_Hint_Text[id] = text
            end if
        end if
        return
    end if


Here is my code:

-- Status line has these fields:
constant status_Bxy = 1
constant status_Nxy = 2
constant status_Cxy = 3
constant status_dirty = 4
constant status_flag = 5
constant status_count = 6
constant status_color = 7 -- want to color it in with selected color for drawing
constant status_message = 8
sequence status_line -- text to place stuff for status line

setSubFields (STATUSB,{{80},{80},{80},{12},{40},{30},{20},-1})
setHint ( {STATUSB,status_Bxy},"Start of ellipse mouse position x,y" )
setHint ( {STATUSB,status_Nxy},"Bottom of ellipse mouse position x,y" )
setHint ( {STATUSB,status_Cxy},"Current mouse position x,y" )


I may be calling setHint wrong, or differently from what you expect
which is the same deal, since you define the rules.

Thanks for your continuing efforts. It is amazing.

Andy Katz

new topic     » goto parent     » topic index » view message » categorize

5. Re: Where do I call setHint for statusbar?

The statement ... 

  ctrl_Hint_Text[id][1] = append(ctrl_Hint_Text[id][1],
       repeat("", 1 + lPart - length(ctrl_Hint_Text[id])))

should be ...

  ctrl_Hint_Text[id][1] = append(ctrl_Hint_Text[id][1],
       repeat("", lPart - length(ctrl_Hint_Text[id][1])))

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

6. Re: Where do I call setHint for statusbar?

Also, for some dumb reason, I made the panel numbers in setHint zero-based but
in setTExt they are one-based. This means that the first panel in setHint() is 0
but in setText() it is 1.

Sorry about that.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

7. Re: Where do I call setHint for statusbar?

Still does not work.

Here is code generated by an IDE test:

--  code generated by Win32Lib IDE v0.22.0 Build Dec-16-2006

constant TheProgramType="exw" 
 
include Win32lib.ew
without warning

--------------------------------------------------------------------------------
--  Window Window1
constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300,
0, 0 )
constant StatusBar2 = createEx( StatusBar, "StatusBar2", Window1, 0, 0, 0, 0, 0,
0 )
---------------------------------------------------------
--------------------------------------------------------------------------------
constant field1 = 1
constant field2 = 2
setSubFields (StatusBar2,{{200},-1})
setHint ( {StatusBar2,field1-1},"Content of field1" )
setHint ( {StatusBar2,field2-1},"Content of field2" )
showMessage( {"1st subField", {StatusBar2,field1}} )
showMessage( {"2nd subField", {StatusBar2,field2}} )



WinMain( Window1,Normal )
--this program has 24 lines without including this line. If there is a
discrepancy please send this file zipped to Judith.


new topic     » goto parent     » topic index » view message » categorize

8. Re: Where do I call setHint for statusbar?

Andrew Katz wrote:
> 
> 
> Still does not work.

I assume by that statement you mean that when the program you submitted runs, it
doesn't crash but it doesn't show the tool tips either?

Here is the test program with 'corrections'...
----------------
constant TheProgramType="exw"

include Win32lib.ew
without warning

--------------------------------------------------------------------------------
--  Window Window1
constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300,
0, 0 )
constant StatusBar2 = createEx( StatusBar, "StatusBar2", Window1, 0, 0, 0, 0,
SBT_TOOLTIPS, 0 )
---------------------------------------------------------
--------------------------------------------------------------------------------
constant field1 = 1
constant field2 = 2
setSubFields (StatusBar2,{{200},-1})
showMessage( {"1st subField (plus text to make it very very long)",
{StatusBar2,field1}} )
showMessage( {"2nd subField (plus text to make it very very long)",
{StatusBar2,field2}} )
setHint ( {StatusBar2,field1-1},"Content of field1" )
setHint ( {StatusBar2,field2-1},"Content of field2" )



WinMain( Window1,Normal )
----------------


The first problem is that you didn't specify SBT_TOOLTIPS in the Statusbar's
Flags parameter.

The second problem is that because the text in the panels can completely fit
into the panel areas specified, Windows does not show any tool tips.

The third problem is that you set the text of the panel after setting the hint.
Setting the text of a panelled statusbar automatically resets the hint to the
panel text. (That might be considered a mistake by me, so I'll consider changing
this behaviour).

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

9. Re: Where do I call setHint for statusbar?

Derek Parnell wrote:
> 
> Andrew Katz wrote:
> > 
> > 
> > Still does not work.
> 
> I assume by that statement you mean that when the program you submitted runs,
> it doesn't crash but it doesn't show the tool tips either?
> 
> Here is the test program with 'corrections'...
> }}}
<eucode>
> ----------------
> constant TheProgramType="exw"
> 
> include Win32lib.ew
> without warning
> 
>
> --------------------------------------------------------------------------------
> --  Window Window1
> constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300,
> 0, 0 )
> constant StatusBar2 = createEx( StatusBar, "StatusBar2", Window1, 0, 0, 0, 0,
> SBT_TOOLTIPS, 0 )
> ---------------------------------------------------------
>
> --------------------------------------------------------------------------------
> constant field1 = 1
> constant field2 = 2
> setSubFields (StatusBar2,{{200},-1})
> showMessage( {"1st subField (plus text to make it very very long)",
> {StatusBar2,field1}} )
> showMessage( {"2nd subField (plus text to make it very very long)",
> {StatusBar2,field2}} )
> setHint ( {StatusBar2,field1-1},"Content of field1" )
> setHint ( {StatusBar2,field2-1},"Content of field2" )
> 
> 
> WinMain( Window1,Normal )
> ----------------
> </eucode>
{{{

> 
> The first problem is that you didn't specify SBT_TOOLTIPS in the Statusbar's
> Flags parameter.
> 
> The second problem is that because the text in the panels can completely fit
> into the panel areas specified, Windows does not show any tool tips.
> 
> The third problem is that you set the text of the panel after setting the
> hint.
> Setting the text of a panelled statusbar automatically resets the hint to the
> panel text. (That might be considered a mistake by me, so I'll consider
> changing
> this behaviour).
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

I see a problem with how we interpret tool tips. Ideally, both the text in a
status bar subfield and its tool tip should be dynamic. I mean, that the 
program should be able to change either one at any time. In my program, the
hints stay the same (it is my help mechanism).

Even though I do not need this for my program, but I noticed that in the
browser firefox, the status bar seems to have controls inside of the
subfields. So maybe those are the ones generating the tool tips.

Has anyone successfully written an application using the Euphoria IDE and
windows library, with controls inside of subfields of a status bar?

Andy Katz

new topic     » goto parent     » topic index » view message » categorize

10. Re: Where do I call setHint for statusbar?

Andrew Katz wrote:
> I see a problem with how we interpret tool tips. Ideally, both the text in a
> status bar subfield and its tool tip should be dynamic. I mean, that the 
> program should be able to change either one at any time. In my program, the
> hints stay the same (it is my help mechanism).

Fair enough. I think I agree with you.
 
> Even though I do not need this for my program, but I noticed that in the
> browser firefox, the status bar seems to have controls inside of the
> subfields. So maybe those are the ones generating the tool tips.
> 
> Has anyone successfully written an application using the Euphoria IDE and
> windows library, with controls inside of subfields of a status bar?

Here is a basis of something you might be able to use...

----------------
constant TheProgramType="exw"

include Win32lib.ew
without warning

--------------------------------------------------------------------------------
--  Window Window1
constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300,
0, 0 )
constant FakeSB = createEx( Label, "", Window1, 0,{w32AltEdge, -40}, 0.9999, 40,
WS_BORDER, WS_EX_CLIENTEDGE )
---------------------------------------------------------
--------------------------------------------------------------------------------

sequence textsize
textsize = getTextExtent(Window1, "M")
textsize[2] += 10
constant f1 = createEx(Label, "1st subField", FakeSB,  2, -1, 100,
textsize[2]-4, WS_BORDER, WS_EX_STATICEDGE)
constant f2 = createEx(Label, "2nd subField", FakeSB,104, -1, 100,
textsize[2]-4, WS_BORDER, WS_EX_STATICEDGE)

-- Ensure 'statusbar' always spans the window.
procedure Resize_Window(integer self, integer event, sequence parms)
    setRect(FakeSB, 0, {w32AltEdge, -textsize[2]}, 0.9999, 
                           textsize[2], 1)
end procedure

setHandler(Window1, w32HResize, routine_id("Resize_Window"))
setHint ( f1,"Content of field1" )
setHint ( f2,"Content of field2" )

WinMain( Window1,Normal )
----------------



-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

11. Re: Where do I call setHint for statusbar?

Actually the Win32lib is reasonable extendable. Here is a simple Fake StatusBar
subsystem...

----- sb.e ---------
include Win32lib.ew as win
without warning

sequence vWINList
sequence vSBList
sequence vFLDList
sequence vFLDIDList

vWINList = {}
vSBList = {}
vFLDList = {}
vFLDIDList = {}


-- Ensure 'statusbar' always spans the window.
with trace
procedure Resize_Window(integer self, integer event, sequence parms)
    integer id
    sequence lRect

    id = find(self, vWINList)
    if id = 0 then
        return
    end if

    id = vSBList[id]
    lRect = win:getRect(id)
    lRect[4] -= lRect[2]
    win:setRect(id, 0, {w32AltEdge, -lRect[4]},
                       0.99999,lRect[4], 1)
end procedure


global function create(integer pParent, integer pHeight, object pFields)
    integer id
    integer sbHeight
    sequence lRect
    integer x
    integer lType
    integer lWidth
    integer lHeight


    id = find(pParent, vWINList)
    if id != 0 then
        return 0
    end if

    if pHeight <= 0 then
        lHeight = win:getTextHeight(pParent, "M") + 10
    else
        lHeight = pHeight
    end if

    id = win:createEx(Label, "", pParent, 0, 0, 0, lHeight, 
                      WS_BORDER, WS_EX_CLIENTEDGE)
    win:setHandler(pParent, w32HResize, routine_id("Resize_Window"))
    vWINList &= pParent
    vSBList  &= id
    vFLDList &= {pFields}
    vFLDIDList &= {{}}

    if atom(pFields) then
        return id
    end if


    x = 0
    for i = 1 to length(pFields) do
        if atom(pFields[i]) then
            lType = Label
            lWidth = pFields[i]
        else
            lType = pFields[i][1]
            lWidth = pFields[i][2]
        end if
        vFLDIDList[$] &= win:createEx(lType, "", id,  x, -1,
                        lWidth, lHeight - 4, WS_BORDER, WS_EX_STATICEDGE)
        x += lWidth + 2
    end for
    return id
end function

global function getFlds(integer sb)

    integer id

    id = find(sb, vSBList)
    if id = 0 then
        return {}
    end if

    return vFLDIDList[id]
end function
--------------


And here is how is could be used ...

----------------
include sb.e as sb

include Win32lib.ew
without warning

--  Window Window1
constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300,
0, 0 )
constant FakeSB = sb:create(Window1, 0, {100, {Button,100}, {CheckBox, 80}})
constant FakeSBFlds = sb:getFlds(FakeSB)

setText(FakeSBFlds[1], "First Field")
setText(FakeSBFlds[2], "Second Field")
setText(FakeSBFlds[3], "Third Field")

setHint ( FakeSBFlds[1],"Content of field1" )
setHint ( FakeSBFlds[2],"Content of field2" )
setHint ( FakeSBFlds[3],"Content of field3" )

setWindowBackColor(FakeSB, Blue)

setWindowBackColor(FakeSBFlds[1], BrightCyan)
setTextColor(FakeSBFlds[1], Brown)

setWindowBackColor(FakeSBFlds[3], Yellow)
setTextColor(FakeSBFlds[3], Red)

procedure Clicker(integer self, integer event, sequence parms)
   setVisible(FakeSBFlds[2], not isChecked(self))
end procedure
setHandler(FakeSBFlds[3], w32HClick, routine_id("Clicker"))

WinMain( Window1,Normal )
----------------


This can be extended to do all sort of neat stuff. Let me know if you find it
useful and what else you would like to do with status bars?

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

12. Re: Where do I call setHint for statusbar?

Derek Parnell wrote:
> 
> Andrew Katz wrote:
> > I see a problem with how we interpret tool tips. Ideally, both the text in a
> > status bar subfield and its tool tip should be dynamic. I mean, that the 
> > program should be able to change either one at any time. In my program, the
> > hints stay the same (it is my help mechanism).
> 
> Fair enough. I think I agree with you.
>  
> > Even though I do not need this for my program, but I noticed that in the
> > browser firefox, the status bar seems to have controls inside of the
> > subfields. So maybe those are the ones generating the tool tips.
> > 
> > Has anyone successfully written an application using the Euphoria IDE and
> > windows library, with controls inside of subfields of a status bar?
> 
> Here is a basis of something you might be able to use...
> 
> }}}
<eucode>
> ----------------
> constant TheProgramType="exw"
> 
> include Win32lib.ew
> without warning
> 
>
> --------------------------------------------------------------------------------
> --  Window Window1
> constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300,
> 0, 0 )
> constant FakeSB = createEx( Label, "", Window1, 0,{w32AltEdge, -40}, 0.9999,
> 40, WS_BORDER, WS_EX_CLIENTEDGE )
> ---------------------------------------------------------
>
> --------------------------------------------------------------------------------
> 
> sequence textsize
> textsize = getTextExtent(Window1, "M")
> textsize[2] += 10
> constant f1 = createEx(Label, "1st subField", FakeSB,  2, -1, 100,
> textsize[2]-4,
> WS_BORDER, WS_EX_STATICEDGE)
> constant f2 = createEx(Label, "2nd subField", FakeSB,104, -1, 100,
> textsize[2]-4,
> WS_BORDER, WS_EX_STATICEDGE)
> 
> -- Ensure 'statusbar' always spans the window.
> procedure Resize_Window(integer self, integer event, sequence parms)
>     setRect(FakeSB, 0, {w32AltEdge, -textsize[2]}, 0.9999, 
>                            textsize[2], 1)
> end procedure
> 
> setHandler(Window1, w32HResize, routine_id("Resize_Window"))
> setHint ( f1,"Content of field1" )
> setHint ( f2,"Content of field2" )
> 
> WinMain( Window1,Normal )
> ----------------
> </eucode>
{{{

> 
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

This is great! One problem - when the window is maximized, the tool tips show
below the screen, so they cannot be seen. Is this a Windows thing or is it
something in your library? I noticed that in firefox, the tool tips for
stuff in the status bar shows above the items, or below but over my taskbar
so it can be seen.

In incorporating this code, I am thinking two things.

One, how much can be done in the IDE? What is the role of the IDE in such
a case? Since I am not going to abandon the IDE, I want to do as much as
possible in that tool. Because if I use the IDE as a starting point, and
then start to do alot of my own 'tricks', and want to go back into the IDE,
things can break.

Two, there is so much here I do not understand, so I am calling it tricks.
Alot of what I do not know is in the documentation, so I will read as much
as I can. I also think that the HTML for the documentation is generated
from your source code in the library. [or am I imagining things?]

This w32AltEdge constant seems not to be a constant.

This 0.9999 does seem to be a trick. What does that do?

I guess knowing what WS_ and WS_EX_ to use comes from experience.

Sizing controls based upon the font being used, and knowing to test the letter
M for height - this is definitely a trick.

There is not much documentation for createEx - what does -1 do? And what does
passing a sequence do? create has alot of documentation for me to read, so
forgive me if I am being dumb for now.

Setting handlers is really interesting and can be used for alot of
flexibility. I was concerned with it conflicting with IDE generated ones,
but that is not an issue since they are cascading. One needs to make sure
that each routine is self contained and does not depend on the other.

Thanks. And I have yet to look at your other code in the other forum post.

Andy Katz

new topic     » goto parent     » topic index » view message » categorize

13. Re: Where do I call setHint for statusbar?

Andrew Katz wrote:
In incorporating this code, I am thinking two things.

One, how much can be done in the IDE? What is the role of the IDE in such
a case? Since I am not going to abandon the IDE, I want to do as much as
possible in that tool. Because if I use the IDE as a starting point, and
then start to do alot of my own 'tricks', and want to go back into the IDE,
things can break.


Since IDE is my contribution I will answer your questions regarding using IDE
and Derek's example.

IDE can be used in many ways. You can use the 'ToolKit-drop on Design' method to
create all your controls or you can use Code Editor's Window1 General event to
code create and createEx statements. When I am lagging behind Win32lib new
development, users often code a vast majority of their program in Window1 General
event and in a particular Controls' (Control General) event. This is perfectly
legal and doesn't need to be changed once I've caught IDE up. So all your coding
is in IDE and nothing will break as long as your coding is accurate.

For example let's take Derek's exw:
The following statement will be generated by IDE. You would change width and
height in Properties for Window1.
constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300,
0, 0 )

The following lines of code could be entered in Window1 General event:
constant FakeSB = createEx( Label, "", Window1, 0,{w32AltEdge, -40}, 0.9999,
40, WS_BORDER, WS_EX_CLIENTEDGE )
---------------------------------------------------------
--------------------------------------------------------------------------------
 
sequence textsize
textsize = getTextExtent(Window1, "M")
textsize[2] += 10
constant f1 = createEx(Label, "1st subField", FakeSB,  2, -1, 100,
textsize[2]-4,
WS_BORDER, WS_EX_STATICEDGE)
constant f2 = createEx(Label, "2nd subField", FakeSB,104, -1, 100,
textsize[2]-4,
WS_BORDER, WS_EX_STATICEDGE)

Code the following in Window1 w32HResize event 
-- Ensure 'statusbar' always spans the window.
procedure Resize_Window(integer self, integer event, sequence parms)
    setRect(FakeSB, 0, {w32AltEdge, -textsize[2]}, 0.9999, 
                           textsize[2], 1)
end procedure
setHandler(Window1, w32HResize, routine_id("Resize_Window"))

Now the following can be coded after the setHandler statement above. That is a
little known IDE trick.
setHint ( f1,"Content of field1" )
setHint ( f2,"Content of field2" )

The following line is generated by IDE
WinMain( Window1,Normal )

As far as your own 'tricks', you probably can code them somewhere in Code Editor
as well.

I'll leave Question 2 for Derek to answer....

judith evans

new topic     » goto parent     » topic index » view message » categorize

14. Re: Where do I call setHint for statusbar?

I have saved sb.e and I am using it in my application. There is alot to
understand and many thinks in Euphoria which I did not know about yet
concerning include files and scoping procedures.

I have 3 concerns which may be with sb.e or with Win32lib or with Windows
itself.

1. When I drag the 'status bar' up and down (testing height resizing) some
of my controls are covered and some cover the status bar and sometimes stuff
from these controls finds itself written onto the 'status bar'. I mean the
user interface gets dirty, not that controls are captured. It would be nice
if I could show you, but the forum is text only.

2. Is there a way to have a label subfield at the last subfield? I mean like
you did with -1 in the real status bar? I faked it by making my last subfield
really long, but it does not have a far right edge.

3. As I mentioned before, tool tips show underneath when the window is
maximized. This is something I know does not need to be this way, because
firefox add ons show tool tips above when maximized.

Thanks for everything.

Andy Katz

new topic     » goto parent     » topic index » view message » categorize

15. Re: Where do I call setHint for statusbar?

Andrew Katz wrote:
> 
> 
> I have saved sb.e and I am using it in my application. There is alot to
> understand and many thinks in Euphoria which I did not know about yet
> concerning include files and scoping procedures.
> 
> I have 3 concerns which may be with sb.e or with Win32lib or with Windows
> itself.
> 
> 1. When I drag the 'status bar' up and down (testing height resizing) some
> of my controls are covered and some cover the status bar and sometimes stuff
> from these controls finds itself written onto the 'status bar'. I mean the
> user interface gets dirty, not that controls are captured. It would be nice
> if I could show you, but the forum is text only.

  You can upload your picture to

http://www.RapidEuphoria.com/uploads/mypic.bmp

Just like you upload a file to the archives.

Then post your upload link in the forum.

This upload will only be held temporarily. {Week or so, ask Rob).

> 

> 
> 2. Is there a way to have a label subfield at the last subfield? I mean like
> you did with -1 in the real status bar? I faked it by making my last subfield
> really long, but it does not have a far right edge.
> 
> 3. As I mentioned before, tool tips show underneath when the window is
> maximized. This is something I know does not need to be this way, because
> firefox add ons show tool tips above when maximized.
> 
> Thanks for everything.
> 
> Andy Katz


Don Cole

new topic     » goto parent     » topic index » view message » categorize

16. Re: Where do I call setHint for statusbar?

don cole wrote:
> 
> Andrew Katz wrote:
> > 
> > 
> > I have saved sb.e and I am using it in my application. There is alot to
> > understand and many thinks in Euphoria which I did not know about yet
> > concerning include files and scoping procedures.
> > 
> > I have 3 concerns which may be with sb.e or with Win32lib or with Windows
> > itself.
> > 
> > 1. When I drag the 'status bar' up and down (testing height resizing) some
> > of my controls are covered and some cover the status bar and sometimes stuff
> > from these controls finds itself written onto the 'status bar'. I mean the
> > user interface gets dirty, not that controls are captured. It would be nice
> > if I could show you, but the forum is text only.
> 
>   You can upload your picture to
> 
> <a target=_top
> href="http://www.RapidEuphoria.com/uploads/mypic.bmp">http://www.RapidEuphoria.com/uploads/mypic.bmp</a>
> 
> Just like you upload a file to the archives.
> 
> Then post your upload link in the forum.
> 
> This upload will only be held temporarily. {Week or so, ask Rob).


Not required. I've reproduced the problem and fixed it already.


> > 2. Is there a way to have a label subfield at the last subfield? I mean like
> > you did with -1 in the real status bar? I faked it by making my last
> > subfield
> > really long, but it does not have a far right edge.

I've added this capability now.

> > 3. As I mentioned before, tool tips show underneath when the window is
> > maximized. This is something I know does not need to be this way, because
> > firefox add ons show tool tips above when maximized.
> > 

I've fixed this too.


I'm now having another issue though. When a control is destroyed, and a new
control is created (and gets the same ID value) then tooltips no longer work for
that control. I'm still looking at that one.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

17. Re: Where do I call setHint for statusbar?

Derek Parnell wrote:
> 
> don cole wrote:
> > 
> > Andrew Katz wrote:
> > > 
> > > 
> > > I have saved sb.e and I am using it in my application. There is alot to
> > > understand and many thinks in Euphoria which I did not know about yet
> > > concerning include files and scoping procedures.
> > > 
> > > I have 3 concerns which may be with sb.e or with Win32lib or with Windows
> > > itself.
> > > 
> > > 1. When I drag the 'status bar' up and down (testing height resizing) some
> > > of my controls are covered and some cover the status bar and sometimes
> > > stuff
> > > from these controls finds itself written onto the 'status bar'. I mean the
> > > user interface gets dirty, not that controls are captured. It would be
> > > nice
> > > if I could show you, but the forum is text only.
> > 
> >   You can upload your picture to
> > 
> > <a target=_top href="<a
> > href="http://www.RapidEuphoria.com/uploads/mypic.bmp">http://www.RapidEuphoria.com/uploads/mypic.bmp</a>"><a
> > href="http://www.RapidEuphoria.com/uploads/mypic.bmp">http://www.RapidEuphoria.com/uploads/mypic.bmp</a></a>
> > 
> > Just like you upload a file to the archives.
> > 
> > Then post your upload link in the forum.
> > 
> > This upload will only be held temporarily. {Week or so, ask Rob).
> 
> 
> Not required. I've reproduced the problem and fixed it already.
> 
> 
> > > 2. Is there a way to have a label subfield at the last subfield? I mean
> > > like
> > > you did with -1 in the real status bar? I faked it by making my last
> > > subfield
> > > really long, but it does not have a far right edge.
> 
> I've added this capability now.
> 
> > > 3. As I mentioned before, tool tips show underneath when the window is
> > > maximized. This is something I know does not need to be this way, because
> > > firefox add ons show tool tips above when maximized.
> > > 
> 
> I've fixed this too.
> 
> 
> I'm now having another issue though. When a control is destroyed, and a new
> control is created (and gets the same ID value) then tooltips no longer work
> for that control. I'm still looking at that one.
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

Thanks. Let me know when you have sb.e I guess it would be an upload in the
recent contributions area? My program is also an ongoing project. Should I
announce it on this forum? Also, I did not see any applications in the
contributions area, so I do not know if I should upload mine there?

Andy Katz

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu