> The canvas motion_cb is only called when the mouse moves over the canvas.
I cannot mouse motion when it is over the text?

 If the callback is defined in a given control it is supposed to be called
only for that control.

 You actually don't need it for the text. Because the user will be able to
move the text around by clicking and draging the canvas.

 I think that now you should not use the scrollbox. You are still learning
how things works and what you are trying to do is not simple nor commonly
used.

  When using cbox you have to position the child manually using the
attributes described in the cbox documentation.

Best,
Scuri




On Fri, Aug 22, 2014 at 2:19 AM, Milind Gupta <[email protected]>
wrote:

> Hi Antonio,
>            I think I did not understand the methodology you described in
> the previous email. I tried the following program:
>
> --IupDialog Example in IupLua
> --Creates a simple dialog.
>
> require( "iuplua" )
>
> cv = iup.canvas {size="300x5", xmin=0, xmax=99, posx=0, dx=10}
> vbox = iup.scrollbox{
>                         iup.cbox{
>                             iup.vbox{
>                                 cv,
>                                 iup.text{size = "300x100", expand="YES",
> value="I ignore the 'g' key!", border="YES"}
>                             }
>                         }
>                     }
> dlg = iup.dialog{vbox; title="Dialog", size="100x100"}
> dlg:show()
>
> function cv:motion_cb(x, y, r)
>   print(x, y, r)
> end
>
> if (iup.MainLoopLevel()==0) then
>   iup.MainLoop()
> end
>
> The canvas motion_cb is only called when the mouse moves over the canvas.
> I cannot mouse motion when it is over the text?
>
> Thanks,
> Milind
>
>
> On Tue, Aug 19, 2014 at 6:53 AM, Antonio Scuri <[email protected]>
> wrote:
>
>>  Hi,
>>
>>  What I suggest does not need to use CD to draw on the canvas. The idea
>> is to use the canvas just to handle mouse messages, and use BGCOLOR to set
>> a background color for the handler.
>>
>>  Something like this:
>>
>> IupCbox(
>>    IupVbox(
>>       IupCanvas(NULL),
>>       IupText(NULL),
>>       NULL),
>>    NULL);
>>
>> If the cbox is not occupying the whole dialog then you can place it
>> inside a IupFrame or a IupBackgroundBox, so you can set the background to
>> white.
>>
>> Then set BGCOLOR of the IupCanvas to something different then white to
>> use it as a handler, to move the vbox around the cbox.
>>
>> You must set CX and CY on the vbox so it will be positioned inside the
>> cbox.
>>
>> Then implement the button_cb and motion_cb callbacks of the canvas, and
>> use the drag delta of the canvas to change cx and cy. Take a look at the
>> source code of the IupSbox or the IupSplit that both use this same approach
>> to implement a moving handler.
>>
>> Best,
>> Scuri
>>
>>
>>
>>
>>
>> On Sat, Aug 16, 2014 at 12:51 PM, Karagy <[email protected]> wrote:
>>
>>> I ran this example using iuplua5.1.exe version 3.11.
>>>
>>> 8/16/2014 18:16, Milind Gupta пишет:
>>> > Hi Karagy,
>>> >            Thanks for looking at it. I tried running the file you send
>>> but I
>>> > get the following error:
>>> >
>>> > lua: cd_buttons.wlua:112: attempt to call field 'backgroundbox' (a nil
>>> > value)
>>> > stack traceback:
>>> >          cd_buttons.wlua:112: in main chunk
>>> >          [C]: ?
>>> >
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Iup-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Iup-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Iup-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to