J jo1234 Active Member Licensed User Longtime User Dec 19, 2014 #1 Hi, how can I change the caption of the back button? I do not want to add a different button, but only localize the caption of the regular back button. Thanks!
Hi, how can I change the caption of the back button? I do not want to add a different button, but only localize the caption of the regular back button. Thanks!
Erel B4X founder Staff member Licensed User Longtime User Dec 19, 2014 #2 The back button caption is the same as the previous page title. So you can change the page title. Upvote 0
J jo1234 Active Member Licensed User Longtime User Dec 19, 2014 #3 Unfortunately not. The button says simply 'Back'. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 19, 2014 #4 Check this example: https://www.b4x.com/android/forum/threads/48170/#content Upvote 0
J jo1234 Active Member Licensed User Longtime User Dec 19, 2014 #5 If the previous page title is long, the back button shows "Back" instead of the previous page title. What bothers me is that the "Back" text is not in the default language of the phone but always in English. The obvious work-around to localize the "Back" text would be to change the long page title to the local translation of "Back" before calling the next page (that works) and change the page title back to the long title when the user returns to the previous page. Not very elegant. It would be better to programmatically set the text of the back button. http://stackoverflow.com/questions/835607/how-to-change-text-on-a-back-button suggests this code: Code: Copy self.navigationItem.backBarButtonItem =[[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil] autorelease]; Just to note, the back button text is set on the view which the next controller was pushed from, not the view controller you currently have shown. Would that be an option in B4i? Thanks a lot! Upvote 0
If the previous page title is long, the back button shows "Back" instead of the previous page title. What bothers me is that the "Back" text is not in the default language of the phone but always in English. The obvious work-around to localize the "Back" text would be to change the long page title to the local translation of "Back" before calling the next page (that works) and change the page title back to the long title when the user returns to the previous page. Not very elegant. It would be better to programmatically set the text of the back button. http://stackoverflow.com/questions/835607/how-to-change-text-on-a-back-button suggests this code: Code: Copy self.navigationItem.backBarButtonItem =[[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil] autorelease]; Just to note, the back button text is set on the view which the next controller was pushed from, not the view controller you currently have shown. Would that be an option in B4i? Thanks a lot!
Erel B4X founder Staff member Licensed User Longtime User Dec 21, 2014 #6 This is equivalent to setting Page.TopLeftButtons. Upvote 0
J jo1234 Active Member Licensed User Longtime User Dec 21, 2014 #7 Unfortunately not. If I set the Page.TopLeftButtons I cannot swipe back to the previous page. What I would like to change is the value for this item that is shown in the watch window: Code: Copy page._NavigationItem._abbreviatedBackButtonTitles.Description with the value Code: Copy <__NSArrayI 0x16e6f4b0>( Back, ) Thanks for your efforts! Upvote 0
Unfortunately not. If I set the Page.TopLeftButtons I cannot swipe back to the previous page. What I would like to change is the value for this item that is shown in the watch window: Code: Copy page._NavigationItem._abbreviatedBackButtonTitles.Description with the value Code: Copy <__NSArrayI 0x16e6f4b0>( Back, ) Thanks for your efforts!
Erel B4X founder Staff member Licensed User Longtime User Dec 21, 2014 #8 You should access internal apis as your app will be rejected by Apple. Try this: Code: Copy Dim no As NativeObject = Page1 no.GetField("navigationItem").SetField("backBarButtonItem", YourBarButton) Upvote 0
You should access internal apis as your app will be rejected by Apple. Try this: Code: Copy Dim no As NativeObject = Page1 no.GetField("navigationItem").SetField("backBarButtonItem", YourBarButton)