B4J Question Selection mouse area ?

hookshy

Well-Known Member
Licensed User
Longtime User
Node width and height ?
I see these two properties are read only ! Is'n yet possible using other methods to change a node dimensions ?

Give me a hint !
Question > How do you make a selection pane that will confirm your mouse position and selected nodes !
I select 3 images but I want the user to see the selection area on a transparency pane ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It depends on the type of node. Most types allow you to change the width and height with the PrefWidth / PrefHeight properties.

Question > How do you make a selection pane that will confirm your mouse position and selected nodes !
I select 3 images but I want the user to see the selection area on a transparency pane ?
You will need to implement the logic yourself. You can use a Canvas node to draw the selection.
 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
I have totaly missed prefwidth and prefheight ...used to width and heith from B4a ...
so I made a small example that I am working on

Thanks Erel from the reminder!

B4X:
Sub pnl_tixi_MousePressed (EventData As MouseEvent)
'pnl_tixi pane parent

pnl_s.Initialize("pnl_s") ' selection indicator
pnl_tixi.AddNode(pnl_s,EventData.X,EventData.Y,1dip,1dip)
pnl_s.Style="-fx-background-color: #ff5a218a;" 'a red transparent color
px0=EventData.X ' a process global variable
py0=EventData.Y 'a process global variable

End Sub

Sub pnl_tixi_MouseDragged (EventData As MouseEvent)

If EventData.X>px0 AND EventData.Y>py0 Then
pnl_s.Left=px0
pnl_s.Top=py0

Else If EventData.X<px0 AND EventData.Y> py0 Then
pnl_s.Left=EventData.X
pnl_s.Top=py0

Else If EventData.Y<py0 AND EventData.X>px0 Then
pnl_s.Top=EventData.Y
pnl_s.Left=px0

Else If EventData.Y<py0 AND EventData.X<px0 Then
pnl_s.Top=EventData.Y
pnl_s.Left=EventData.X

End If


pnl_s.PrefWidth=Abs(EventData.X-px0)
pnl_s.PrefHeight=Abs(EventData.Y-py0)


end sub

Sub pnl_tixi_MouseReleased (EventData As MouseEvent)

Log("pnl_tixi mouse released")
pnl_s.RemoveNodeFromParent

End Sub
 
Last edited:
Upvote 0
Top