Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Window with custom headerControls drags on body

    Hi, I have a problem as follows.

    If a Window is defined with headerControls with a custom canvas in the array and if the Window is set to with canDragReposition then the window become draggable incorrectly by click/dragging on the body of the window rather than just the header.

    The following illustrates the problem:

    Code:
    isc.Window.create({
      width:200,
      canDragReposition: true,
      items: [ isc.Label.create({height:1,contents:"drags only on header"}) ]
    })
    
    isc.Window.create({
      top:150,
      width:200,
      canDragReposition: true,
      headerControls: [isc.Label.create({contents:"custom header"})],
      items: [ isc.Label.create({height:1,contents:"drags on body"}) ]
    })
    This problem happens in v8.3 but also in latest v11.

    Many thanks for any help with this problem.

    #2
    The problem is that the normal behavior of the window is that the automatically created headerLabel is the only piece that is make canDragReposition:true, and the setting on the Window as a whole is then automatically set to false. With you creating your own complete replacement header, there's no way for the Window to know what to do with your canDragReposition setting.

    You should first of all consider whether you really want to wipe out all the built-in controls and use your own. You may want to instead just insert some controls and leave the existing headerLabel there.

    Alternatively if you want part of your custom header to initiate drags in the same way that the built-in headerLabel does, these settings would do it:

    Code:
    isc.Window.create({
      ID:"myWindow",
      top:150,
      width:200,
      canDragReposition:false,
      headerControls: [isc.Label.create({contents:"custom header", dragTarget:"myWindow", canDragReposition:true})],
      items: [ isc.Label.create({canDrag:false, height:1,contents:"drags on body"}) ]
    })

    Comment


      #3
      That's great, thank you. Makes sense. Adapting what you said I set headerProperties with canDragReposition/dragTarget.

      Code:
      isc.Window.create({
        ID:"myWindow",
        top:150,
        width:200,
        canDragReposition:false,
        headerControls: [isc.Label.create({contents:"custom header"})],
        headerProperties: { dragTarget:"myWindow", canDragReposition:true },
        items: [ isc.Label.create({height:1,contents:"does not drag on body :)"}) ]
      })

      Comment

      Working...
      X