Adding empty spaces to Nav Bar widget

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Adding empty spaces to Nav Bar widget

Post by jameshale » Tue Apr 11, 2023 7:42 am

I have been updating the interface of one of my apps to use the Navigation Bar widget in place of individual buttons.
Coupled with the Responsive Layout, it seemed an easy way to ensure they would be correctly placed even when the card was resized or re-oriented. However the widget doesn't really give you much in placing the buttons with the exception of the order that they appear.
But then I thought what about having blank buttons where I want space.
What do I mean?
Screenshot.jpg
Screenshot.jpg (11.36 KiB) Viewed 2382 times
and here when one button was no longer needed.
Screenshot 1.jpg
Screenshot 1.jpg (8.95 KiB) Viewed 2382 times
How is this done?
Simply create a bank icon to add to the SVG icon Library.
Drag a SVG widget to your card, open its PI and delete the path data, and the widget shows a blank space.
In an opencard handler add this widget to the SVG library, here I named my SVG widget "blank"

Code: Select all

put the iconpath of widget "blank" of cd "store" into ip
get addicon("blank",ip,12)  
This is now in the "custom" SVG library.
To be able to access this in the IDE to actually use it in the Nav Bar PI you will need to tell the IDE this is what you want to use.
So before attempting to modify the Nav Bar icons type the following into the message box.

Code: Select all

put setCurrentIconFamily("custom")
Now simple open the PI of the Nav Bar and select you new icon. Of course you will not see it but it will be the first blank space given it was the last icon I just loaded. just before the hearts.
You will notice I have 2 blank icons in this shot. This corresponds to my first image above.
Screenshot 4.jpg
To return to the pr-existing icon library place the following into the message box.

Code: Select all

put setCurrentIconFamily("fontawesome")
Oh to change icons on the fly I have the following code initially.

Code: Select all

set the itemicons of widget "infoNavBar" to "blank,blank,blank,undo"
set the itemlabels of widget "infoNavBar" to " , , ,Back"
And then,

Code: Select all

set the itemicons of widget "infoNavBar" to "remove sign,blank,blank,undo"
set the itemlabels of widget "infoNavBar" to "Close, , ,Back"
enjoy

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Adding empty spaces to Nav Bar widget

Post by Klaus » Wed Apr 12, 2023 6:46 pm

Cool, thank you very much!

Maybe you could add this as an enhancement request including solution to:
https://quality.livecode.com

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Adding empty spaces to Nav Bar widget

Post by jameshale » Fri Apr 14, 2023 3:43 pm


Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Adding empty spaces to Nav Bar widget

Post by Klaus » Fri Apr 14, 2023 3:48 pm

Thank you, James!

Post Reply

Return to “Talking LiveCode”