cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Show popup on view navigation

micah
12-Amethyst

Show popup on view navigation

I'm looking for the code to show a popup as soon as a 3D view is launched.

2 REPLIES 2

depenidng on project type - if mobile project:

One possible option is to use the 2D Canvas - popup widget (which displays a predefined popup) . The popup could contain any other 2D canvas widgets - grid , labels , buttons etc. You can link (binding) e.g. the OK button click service to hide the popup dialog when it completed - when you click the OK button it will hide the dialog.

2020-11-04_10-13-28.jpg

Tho show the popup you can use showpopup method of the popup widget when you enter the view  in the Studio event view loaded or after enter. The definition is in the event code is in the  <View Name>.js  e.g. Home view - Home.js:

 

//This function will execute each time the view is loaded
$scope.$on("$ionicView.loaded", function (event) {
// or :$scope.$on('$ionicView.afterEnter', function()  {
  console.info("after enter a view") 
// will display the popup here
$scope.triggerPopup('TestPart','PartID12345');
})
//=============0
// this function will show the popup-1 widget and will set some widget texts
$scope.triggerPopup = function (partname,partID) {

  twx.app.fn.triggerWidgetService('popup-1', 'showpopup');
  $scope.view.wdg.partName.text = partname;
  $scope.view.wdg.partID.text = partID;

}

 

because you mentioned 3D view  is launched - believe you meant an eyewear project where is no 2d Canvas.

Currently there is no popup functionality available. The only workaround so far I know is to use different 3d widget as popups. If you have a model - then the event "modelLoaded" where you can show some elements and try to observe the click event on them e.g. to hide them when the user click on 3d widget ( I did not test if the $ionicView.loaded  event work for only 3D canvas )

Top Tags