barx Well-Known Member Licensed User Longtime User Sep 14, 2015 #1 How do you move / re-size elements / views in code? I have the following code Code: Copy Log(SearchAccordion.Top) SearchAccordion.Top = SearchAccordion.Top - mnuSearch.Height Log(SearchAccordion.top) The log shows that the .Top value does change but the nothing on the screen moves. Project added for help Basically I want to see the accordion move up when the Seach Close button is clicked. my ideal effect is to fade out, move, fade in using setAlphaAnimated but if I have fade out and fade in after, nothing happens. Guess that is 2 questions, my bad, lol Attachments DMS Order.zip DMS Order.zip 4 KB · Views: 346
How do you move / re-size elements / views in code? I have the following code Code: Copy Log(SearchAccordion.Top) SearchAccordion.Top = SearchAccordion.Top - mnuSearch.Height Log(SearchAccordion.top) The log shows that the .Top value does change but the nothing on the screen moves. Project added for help Basically I want to see the accordion move up when the Seach Close button is clicked. my ideal effect is to fade out, move, fade in using setAlphaAnimated but if I have fade out and fade in after, nothing happens. Guess that is 2 questions, my bad, lol
Daestrum Expert Licensed User Longtime User Sep 15, 2015 #2 try this for question #1 To move up Code: Copy Dim jo As Javaobject = SearchAccordian jo.RunMethod("setTranslateY",Array(-mnuSearch.Height)) To move back down when search opens Code: Copy Sub mnuSearch_MouseClicked (EventData As MouseEvent) mnuSearch.SetLayoutAnimated(500, 0, mnuSearch.Top, mnuSearch.Width, mnuSearch.Height) Dim jo As JavaObject = SearchAccordian jo.RunMethod("setTranslateY",Array(0.0)) End Sub note: translate is relative to the original position which is why offset 0.0 puts it back in original position. Last edited: Sep 15, 2015 Upvote 0
try this for question #1 To move up Code: Copy Dim jo As Javaobject = SearchAccordian jo.RunMethod("setTranslateY",Array(-mnuSearch.Height)) To move back down when search opens Code: Copy Sub mnuSearch_MouseClicked (EventData As MouseEvent) mnuSearch.SetLayoutAnimated(500, 0, mnuSearch.Top, mnuSearch.Width, mnuSearch.Height) Dim jo As JavaObject = SearchAccordian jo.RunMethod("setTranslateY",Array(0.0)) End Sub note: translate is relative to the original position which is why offset 0.0 puts it back in original position.
Erel B4X founder Staff member Licensed User Longtime User Sep 15, 2015 #3 I recommend you to create the main layout with the internal designer. You can add a pane in the internal designer and then load a fxml layout to this pane with the Accordion. The reason that the accordion doesn't change its position is that the anchors are defined. You need to either change the anchors at runtime or disable them. Upvote 0
I recommend you to create the main layout with the internal designer. You can add a pane in the internal designer and then load a fxml layout to this pane with the Accordion. The reason that the accordion doesn't change its position is that the anchors are defined. You need to either change the anchors at runtime or disable them.
barx Well-Known Member Licensed User Longtime User Sep 15, 2015 #4 Erel said: I recommend you to create the main layout with the internal designer. You can add a pane in the internal designer and then load a fxml layout to this pane with the Accordion. The reason that the accordion doesn't change its position is that the anchors are defined. You need to either change the anchors at runtime or disable them. Click to expand... The main reason I used SceneBuilder is, one of the first elements in the layout is a horizontal split pane, something that is not available in b4j. I think i would have to do many imports to get the results. The trickiest part seems to be getting things to move / position. Quite comlicated with min/max/pref height/width and left/top ect Upvote 0
Erel said: I recommend you to create the main layout with the internal designer. You can add a pane in the internal designer and then load a fxml layout to this pane with the Accordion. The reason that the accordion doesn't change its position is that the anchors are defined. You need to either change the anchors at runtime or disable them. Click to expand... The main reason I used SceneBuilder is, one of the first elements in the layout is a horizontal split pane, something that is not available in b4j. I think i would have to do many imports to get the results. The trickiest part seems to be getting things to move / position. Quite comlicated with min/max/pref height/width and left/top ect