How do you access widget ids from one widget to another in Kivy? - kivy

I’m using Kivy Screen Manager and do not understand how to access ids from one widget to another.
Example: Having 2 different Screens with a text input box on screen 1 and a label on screen 2.
How do I get whatever the user inputs on Screen 1 to automatically update the label on Screen 2?
I can get it to work if the text input and label are on the same Screen using the self.root.ids.”id_name_example” but it doesn’t update from one screen to the next.

You can (and should) use kivy properties, when set value to property it will automatically update UI
https://kivy.org/doc/stable/api-kivy.properties.html
Another (not very optimal) option here is to refresh you screen when you open it.
<YourScreen>:
name: 'your_screen'
orientation: 'vertical'
on_pre_enter:
root.refresh_your_screen()
# Root widget
BoxLayout:
orientation: 'vertical'
id: 'your_screen_root'
And YourScreen.py will contain refresh_your_screen()
def refresh_my_screen(self):
# Remove all
for widget in self.ids.your_screen_root.children:
widget.clear_widgets() # remove all child's from Layout
self.ids.your_screen_root.clear_widgets() # remove all layouts from root
# Add actual widgets

Related

How to make Filemaker textbox resizable according to content

I'd like to create a layout to show this table in list view, the point is to make the text field resizable according to content. I have try several method, but all fails. I am using FileMaker 12.
Any help much appreciated.
For Browse mode you can set layout objects to dynamically resize based on the layout size, but not on the object contents. If you need this functionality in Browse mode you will probably need to use a web-viewer.
In Preview mode you can use sliding left and sliding up for reduction of the size of the layout objects, but there is no option to expand.
In Browse and Find modes, if a field isn't set to have a scroll bar, the field will expand while the user is entering data, but only then. It will return to the default size when the user navigates to another field or another record.
In Preview mode, you can make the field larger than it could possibly need and set it to slide up and also reduce the size of the enclosing part. But the user won't be able to interact with the interface of the layout (can't click buttons, change data, etc.).
A workaround might be to use a tooltip. If you set the tooltip to the contents of the field itself, then the user can hover over the field to see any expanded contents.
If you really need exactly the functionality that you mention (which I would define as having field height and enclosing body part expand in list view based on the field's content length while in FileMaker), the only way I could see doing it would be to use custom web publishing to create a web page and use FileMaker's web viewer to show that web page. F 'n' web has an article that might be of some assistance if you go this route.

iOS. Settings bundle. Custom Child pane

I have added Settings.Bundle to my app. I want to create several Child panes and I need to perform in them customization, like a cell in table view :(UITableViewCellStyleValue1 or any other).
It is possible to do such thing?
In my Root.plist I have specified 'Settings Page Title', but when my app is executed the title is not used.
The last Item(String) from 'Preference Items' is not displayed, why it's like that?
This is how I would like to customize Child Panes ( I mean text & position not color of background):
Is it possible to change fonts,frames of corresponding labels from code?
BTW, how to create preferences as Facebook, twitter, Flickr apps have?

How to update entire UI for the application according to user selection?

I have an application requirement where user chooses color & font for title, labels, textfields. Images for logo, etc.
Here is the brief scenario:
Some screen which provides base application use
Settings screen, where user can update UI: Here I have provided textfields where user can enter color schemes for all provided labels and image selection.
For example, Line color, Line Shadow color, Font Color, Divider Color. User input will be R,G,B values (like, 123, 255, 89)
Once user save this configuration, entire application UI should be changed for all the viewControllers accordingly.
What would be the preferable way to achieve this?
I do already have all the IBoutlets for each and every label, textfields, imageviews. - Just FYI.
Thanks in advance for help.
The simple, non-complicated way of getting this working is to store all these choices in NSUserDefaults - and have all the customisable controls draw themselves using the property settings there.

How to access filed on the screen using Screen Object ( UiApplication.getUiApplication().getActiveScreen())

My Query is How to access Fields on the stacked screen using Screen Object ?
The exact problem is as follows:
I have one screen which has one text field (ClientName) when user clicks on that field , application will then push a new screen and it will allow the user to search in remote database using MyWebSerivces. and when user selects the one client from the search result ,i want to set the text Field on the previous screen with the text that user has selected on the current screen..
i have tried the pushScreen( new screen("text) ) and that might be the result if i want to do this operation only once but this is not the option for me since there is two more such field which will go to other screen to fetch the data from webservices . and if i every time i push new screen then after every pushscreen operation i will only get one field set with the desired text
This not a blackberry (or any specific programming language) related question. This is a question of application architecture and common sense. If one screen should change a Field of another screen, then just pass a reference of the Field to the screen that will change it.
hi i once had same problem and i did like this:
Screen1
------------------
Client Name | text field |
------------------
When user clicks on this text field or any button you push Screen2
In screen 2 when user selects a particular value then u do this.
1) take a static variable in main class say clientName.
2) set value of this variable.
3) pop active screen
UiApplication.getUiApplication().getActiveScreen();
when this code is called then u come back to Screen1
Now in screen1 a method is called
public void onExposed()
{
//here u can set the text in textfield using the static variable
invalidate(); // for repainting
}
i have found the answer to my question. the solution was there lying in my question but at first i was not able to find it.
solution was very simple
when i wrote i want to use
UiApplication.getUiApplication().getActiveScreen()
that was almost the right way and i was proceeding in right direction but the thing that i was missing was " I was not casting the screen (that i have just retrieved form the stack top ) to its type
only thing i should have done is "should have casted screen to its type.like this
UiApplication.getUiApplication().posScreen(this)
(MyScreen1) UiApplication.getUiApplication().getActiveScreen()
now i am able to access all the fields on the retrieved screen (MyScreen1)
things to keep in mind
make sure u cast the screen to its type only otherwise bb will give u resource not found error
Benifits of using screen on Stack
u can use already created screen from the stack no need to create new one
if u will create new screen it will be stacked in memory and will consume more and more memory even if its of no use ( make habit to pop the screen if it is of no use instead of leaving it on stack))
no need to create any static variable since u will be able to set all the field right away from other screen

How to create the screen in optimized way?

Hello everybody I am trying to create a screen (to see the image click here)
I have set it's backround image also created required list components which are click able by extending Field class. Now my problem is I am not able to set that rounded white color as backround of the list. Please help me. And also because I am new to the blackberry please also tell me the optimized way to create this screen.
i think like this
1) header bar - create manager and embed 2 buttons and 1 label in it
2) bottom bar - create a global class that contains the buttons and define a method that responds to the click event of these buttons
call that class in this main screen
3) for middle part use a list field which is scrollable

Resources