1. [Win32Lib] Click on Label

Can a label respond to an onClick event? (I searched the message archive 
and couldn't find the answer, which is odd. I thought I remember this 
coming up before.)

new topic     » topic index » view message » categorize

2. Re: [Win32Lib] Click on Label

C. K. Lester wrote:

>
> Can a label respond to an onClick event? (I searched the message 
> archive and couldn't find the answer, which is odd. I thought I 
> remember this coming up before.)

Okay, no... (it's in the docs. sorry)

So how do I simulate it? I need to be able to click on the label or "a" 
label-lookalike control.

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

3. Re: [Win32Lib] Click on Label

Jerry Story wrote:

>
>
>euphoric wrote:
>  
>
>>Can a label respond to an onClick event? (I searched the message 
>>    
>>
>>>archive and couldn't find the answer, which is odd. I thought I 
>>>remember this coming up before.)
>>>      
>>>
>I found a little trick. Put a button under the label. Then the "label" 
>responds to clicking. Clicking puts the button on top so you need to put 
>the label back on top.
>  
>
Tricky.

Derek, can I instead make a button white (or whatever color I need to 
"hide" it) and left-justify the text on it?

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

4. Re: [Win32Lib] Click on Label

C. K. Lester wrote:

>> Can a label respond to an onClick event? (I searched the message
>> archive and couldn't find the answer, which is odd. I thought I
>> remember this coming up before.)
>
> Okay, no... (it's in the docs. sorry)
>
> So how do I simulate it? I need to be able to click on the label or "a"
> label-lookalike control.

You could use the latest Arwen version, it has got a HyperText control.
(I just can't remember who suggested to add such a control to Arwen.) smile

Regards,
   Juergen

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

5. Re: [Win32Lib] Click on Label

----- Original Message ----- 
From: "Juergen Luethje" <j.lue at gmx.de>
To: <EUforum at topica.com>
Subject: Re: [Win32Lib] Click on Label


> 
> 
> C. K. Lester wrote:
> 
> >> Can a label respond to an onClick event? (I searched the message
> >> archive and couldn't find the answer, which is odd. I thought I
> >> remember this coming up before.)
> >
> > Okay, no... (it's in the docs. sorry)
> >
> > So how do I simulate it? I need to be able to click on the label or "a"
> > label-lookalike control.
> 
> You could use the latest Arwen version, it has got a HyperText control.
> (I just can't remember who suggested to add such a control to Arwen.) smile
> 

A Hypertext controls implies that you can respond to clicks on specific
words/phrases which maybe highlighted in some manner. Is this what you need?
Otherwise, if its okay to just respond to a click anywhere in the text, then you
can use a simple child window.

Here is an extended example program...

--------------
include win32lib.ew 
without warning
integer MainWin
integer ChildWin                     

atom TColor

TColor = Red

-- Create a window and get it's ID.
MainWin =  createEx(Window, "Basic Window",0,10,20,200,100,0,0)
ChildWin =  createEx(Window, "Child Window",MainWin,10,20,88,20,
            {WS_CHILD,WS_CLIPSIBLINGS,WS_VISIBLE},0)
                                                                       

procedure Paint_ChildWin(integer self, integer event, sequence parms) 
    sequence lSize
    sequence lText
    sequence lPos
    
    -- Build the text to display.
    lPos = getPointerPos()
    lText = sprintf("%s %d %d", {getText(ChildWin), lPos[1], lPos[2]})
    
    -- Resize the control to hold the text.
    lSize = getTextExtent(ChildWin, lText)+4 
    setCtlSize(ChildWin, lSize[1], lSize[2])
    
    -- Blank of the control with its BG Color
    setWindowBackColor(ChildWin, White)      
    
    -- Draw its border
drawLines(ChildWin, {BrightWhite,
    {0,0,lSize[1]-1,0},{lSize[1]-1,lSize[2]-1},
                         Black,{0,lSize[2]-1},{0,0}})
                         
    -- Set the text color and draw the text.                         
    setTextColor(ChildWin, TColor)
    wPuts({ChildWin, 2, 2 }, lText)
    
end procedure
setHandler(MainWin, w32HPaint, routine_id("Paint_ChildWin")) 

procedure Click_ChildWin(integer self, integer event, sequence parms) 
    if TColor = Red then
        TColor = Blue
    else
        TColor = Red
    end if
    
    Paint_ChildWin(self, w32HPaint, {})
end procedure
setHandler(ChildWin, w32HClick, routine_id("Click_ChildWin")) 

-- Start to application running, using 
WinMain( MainWin, Normal)  

--------------
-- 
Derek

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

6. Re: [Win32Lib] Click on Label

Derek Parnell wrote:

>...if it's okay to just respond to a click anywhere in the text,then you can
>use a simple child window.
>
>Here is an extended example program...
>  
>
<code snipped>

Yeah, that will work fine.

To satiate curiosity, why don't labels respond to events?

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

7. Re: [Win32Lib] Click on Label

CoJaBo wrote:

>Is this what you mean:
>SS_NOTIFY will enable events
>  
>
Hey, thanks CojaBo! That will probably be easier than managing a child 
window... right? :)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu