Force Titanium (iPhone) navigation group window to refresh - iphone

I am developing a data-driven application for iPhone using Appceleartor Titanium engine.
To cut it short, I have one window with first_name variable (label) on it and a button.
You click on the button, it bring you to the second window (through navigation group). ANd in this second window you can change the first_name variable.
So the question is, as the user click "Back" Button to go back to the first window in the navigation group, how do I reflect the first_name variable change?
(The first_name variable is just an abstract, the actual data change is actually a lot bigger, and it usually is not one window after another but could drill down to 4, 5 different windows)

eventListener. add in the first window something like
window0.addEventListener('refreshLabel',function(e){
label.text = e.value;
});
and in the second window fire the event
button.addEventListener('click',function(e){
window0.fireEvent('refreshLabel',{value:"myNewContent"});
};

You can put an event listener on the label and fire an update when the contents should he changed.
You can create an update method for the label and place it in the gloval namespace making it available to he called from the othe window.

Related

MS Access Form Development: Hide Objects when an Option Button is Pressed without coding for each Object that needs to be hidden

MS Access Development Question:
I have 3 options and I need each one associated with a different set of objects. Therefore, if you click option 1, a set of objects will appear in a box I'm referring to as "Report Parameters". If I click option 2, the objects in the "Report Parameters" box will disappear and a new set of objects will appear.
I didn't want to write code to switch each object from visible = true to visible = false. I thought that would take too long, especially if the number of option buttons or the objects related to it grow.
So I'm trying several things...
I tried putting all objects, that relate to a particular option, in a Subform. Therefore, I would have three subforms and that would sit in the same position on my main form. When you click on an option, the subform for that option is made visible any anything else is hidden. But I have a background picture that needs to be visible on the main form and you can't make the subform background transparent.
I used Tab Controls; however, I didn't want to use the tabs to control the switch between objects. I can hide the tabs but you can still switch between them if you click the space where the tab should be. It can be made transparent though so that helps a lot.
I need something in-between a Subform and Tab Control but I've hit a dead end. Does anyone have any other suggestions or recommendations? Or am I stuck coding for each object?
I'm an experienced VBA developer. My last option was to run a query against the form and pull all object names and save it to a table. Since the syntax of the name for each object connects it to a button, I can always run a loop that makes all objects visible/invisible if the object's name corresponds with a specific option... but... I guess I'm trying to find a shortcut. Let me know what you think! Thanks.
I was able to resolve my issue. I just needed to do some thinking... so writing up this question was a bit premature. I'll write down what I did in the event that someone has the same issue I have.
First, I used the Tab Control object to resolve my issue. I made the control transparent and named each page to reflect the Option Button I was selecting.
I then mapped each option to a button in the VBA code of the button. Therefore, when the button is selected it does several things.
First, it makes the default value of any of the other options equal to false. I also set the visibility of their corresponding pages to false.
Second, I select the page I need visible and set the visibility to true. I also make it my active page.
Lastly, as a safety measure, if the option button is already selected, and you select it again, by setting the value of that option to true. This is to prevent it from changing to false. One option should always be selected.
Hope that all made sense!

Access Menu sub form - No default Tab stop

I have a main form...imagine that...that for most of my users will be the only form they use. Naturally, it contains tabs with sub forms.
I have a navigation sub form on the left side of this form that changes based on the user's rights level. Currently, this sub form is all buttons...and 1 always is selected as the default tab stop for that form.
I don't want to highlight any of them at first...and I can remove the highlight by switching off Tab Stops for all buttons. However, I'm not sure that I want to remove that functionality all together...and it still highlights a button. I'd just like for there to not be a default button highlighted.
As you can see, Add Course is 'selected'. I can't seem to find the correct terminology to search for a way to do this. I tried using a smaller button set behind another button, but since it has the focus, it moves to the front. Using a text field with the same colors as the background shows the cursor in a random, blank area...not visually ideal.
I'm sure that there is someone here clever enough to have this figured out. Please enlighten me. I don't care if this can be handled in VBA code or through design view.
"Focus" is the word you're looking for - you don't want any visible control to have the focus when opening the form.
The easiest method is an invisible button: create a button with Transparent = True, and an empty OnClick (i.e. the button does nothing, even when accidentally clicked).
Move this button to the top in the Tab Order, so it has the focus when opening the form.
But if your users use TAB to walk through the buttons, there will be one position where the focus disappears (when circling around from the last to first control). I don't know if it will confuse them.
Create a button on the main form itself.
Named is cmdDummyButton with the following GotFocus event code.
Set the tab order property to 0 (ie first)
Make the button transparent.
This will cause no control on the form to have the focus when it starts up.
Private Sub cmdDummyButton_GotFocus()
Static IveHadFocusAlready As Boolean
If Not IveHadFocusAlready Then
Me.cmdDummyButton.Enabled = False
IveHadFocusAlready = True
End If
End Sub
Sweet.

do i have to create smartgwt tab pane each time?

I have a constant pane for a tab which is VLayout (lets say 'Layout-A').
Since it takes time to create this layout each time, i create only once.
A Tab (lets say "Tab-A") displays this Vlayout. But it is closable.
When tab is opened for the first time, it is ok. I can see Layout-A.
But when i close and reopen this tab, i create Tab-A using 'new' and set its pane to Layout-A. Tab is empty.
Do i have to create my Layout-A each time when i open the Tab-A?
Thanks...
I didn't find the source (just a comment), but I know that in the past I did some testing on that and I was playing with
theTabSet.updateTab(indexOfTheTabToRemove, null); You can look with the console and on the elements which are destroyed.
Look at the javadoc of removeTabmethod.
So we have to set the pane to null, remove the tab which will not destroyed the pane you want to use and you will be able to reattribute to the tab when you want it.
There is one link talking about this case..... (look at the end of the post)

How can I display a dialog canvas in Oracle Forms Builder?

I have built a form in which the user can view multiple rows of data pulled from a table. The user has the option to select a row, then pressing a button to reject the data in that row, (to be marked as rejected in some STATUS field).
I have also designed a rejection confirmation dialog with the ability for the user to enter some comments or reason for rejection.
I have set up the dialog canvas to appear on its own window with the Type proeperty set to Dialog.
When the user selects a row to reject, here is the code that gets executed:
BEGIN
GO_BLOCK('BLK_ALL_RECORDS');
FIRST_RECORD;
IF :FRM_ALL_ROWS.CHK_SELECT = 1 THEN
:FRM_REJECTION.ID := :FRM_ALL_ROWS.ID;
GO_BLOCK('BLK_REJECTION');
SHOW_VIEW('CNV_REJECTION');
EXIT;
ELSE
NEXT_RECORD;
END IF;
END;
And the rejection form has two buttons, one to confirm and one to cancel. Let's just focus on the cancel button for now. Here is the code that is executed once the Cancel button is pressed:
:BLK_ALL_ROWS.CHK_SELECT := 0; /* Forces removal of the check mark */
GO_BLOCK('BLK_ALL_RECORDS');
HIDE_VIEW('CNV_REJECTION');
The only problem is : once the dialog form appears, it hides the parent form, until the form is dismissed. How can display the dialog form ontop of the parent form with both of them visible (in a modal way?)
The navigation between different canvases can be little bit tricky to get to work. Hard to say what is the problem with not having the form in front of me but the first thing I should do is making sure that the 'Raise on entry' canvas property of the 'main' canvas is set to 'Yes'. This should force this canvas to be displayed when you are moving the cursor back to block 'BLK_ALL_RECORDS'.
Another alternative could be to use SHOW_VIEW() in the cancel dialog logic to force the main canvas to be displayed.
I found out what was the problem finally.
The parent Window had a property [Hide On Exit] which is defaulted to Yes and that made the parent form disappear everytime another window is on display. I set it to NO and called the other form. This time both windows are visible, with the modal one always on top.

Open "Modal" Widow and close in TabGroup Based Application

Should Also have specified, I am developing this using Titanium Mobile.
I have a tabbed application. I have the need to open a "modal" like window for the purpose of allowing the user to enter some settings.
For example, you click the 3rd tab in the tabGroup. Some logic runs to see if a setting is set before continuing to create the view. The setting is not in place, so a new window animates in asking you to create this setting. After you create the setting, it closes and the view continues to render, or refreshes.
I cannot for the life of me figure this out. I have created the window, animated it into the current tab, and I have even successfully closed it. Getting the view to refresh or re-load is what is difficult. Also, the navigation bar offers the user the ability to navigate back to the window to change the setting, which I also do not want.
Any way to accomplish this?
I have the same need for logging the user into the application.
Use this code:
windowbject.open({modal:true});
This will only works in iOS.
And you want to refresh view which is behind this modal window then you have to add "focus" eventlistener to the window and write code in it.This code will execute when ever window got focus.
So when you close "modal" view then window behind it will get focus.
I hope this will help you.