Refreshing master window in a splitview app (Titanium) - refresh

I am doing a Splitview App for iPad, I have to refresh my tableview (that is in my master _window) each time the user clicks on a button (this button is in the master_window but on another JavaScript file). How can I do this?

Create a function inside your MASTERWINDOW FILE say
function updateTable(){ // update your table here};
Now, in you App.js file, include your MASTERWINDOW FILE
and do this:
Ti.App.updateTable= updateTable;
Ti.App Will make your function global, so that you can call it from any where in the app.
You can call it inside button click event.

Related

How can I trigger an event when a user clicks a GtkFileChooser or GtkFileChooserButton in GTK+3.0?

I have a function that I'm using to grab properties of a widget when a user changes it's input for undo/redo functionality. I have entries connected such that when a user clicks on them (focus-in-event), the current text is taken and stored. However, I've been having a big problem trying to do this with a file chooser or file chooser button. For some reason, when I click the button or chooser, and I have my handler wired to the focus-in-event signal, the filename is not grabbed. I'm not sure how to grab this value before the user changes it. I'm using glade to attach handlers to signals. Thanks!
You can achieve this by calling the get_filename method within a selection-changed callback. The response signal runs when the ok, or cancel button is clicked, and can be used to set or update which file/folder is selected to perform actions on.

Cant focus Firemonkey application when modal dialog open, unless modal dialog itself is clicked

I have an application in which users, upon logging in, are prompted with a modal dialog where they must choose the facility they wish to work out of. At this stage, the application looks like this:
The modal dialog is shown by calling this method:
bool __fastcall ShowFacChoiceForm()
{
TFacChoiceForm *Form = new TFacChoiceForm( Application );
bool Result = ( Form->ShowModal() == mrOk );
delete Form;
return Result;
}
In this case, TFacChoiceForm inherits from TForm so the ShowFacChoiceForm() function is calling the standard TForm.ShowModal method documented here.
The issue I am running into is that if my application loses focus, it cannot become the active window again unless the modal dialog itself is clicked. To better illustrate this, I will present the following scenario:
Lets say its Friday afternoon and I decide to goof off a bit and read some web comics. With my application open, I open up another window on top of it, like so:
Then, out of nowhere my boss comes in for a performance review, and I attempt to refocus my application by clicking somewhere on the main form. For example, at the position of this red X in the next image.
In the above image, I have clicked at the location of the red X. Now, both the form containing the web comic, and my application are inactive. Thus, my application does not come to the front of the screen.
However, if I am able to click somewhere on the modal dialog, like the red X in the following image...
...then my application comes to the front like one would expect.
To solve this, I have looked at using something like SetForegroundWindow from the Windows API, but I have not been able to find a way to trigger the event, since my main form does not fire events while I have a modal dialog open.
My question is, how can I make sure that if the user clicks anywhere on my application that it is brought to the front? Is there a property I can edit in my form to do this?
If you set modalresult to mrcancel in the ondeactivate of the modal dialog then the main form will get focus when its clicked. You can then check if the user is logged in the mousedown event of the main form and if not, show the modal dialog again.

Making a menu item appear when a certain view is displayed rails

Windows 8.1
Rails 4.1
Ruby 2.0
I have the menus for my application defined in views/layout, and one of those is the header where I have the menu items. There are some additional partials rendered form _header.html.erb as well.
I would like to have an additional menu appear ONLY when I render views/pages/index. How do I go about doing this?
I would look in Javascript. Have you tried listening for the specific body class of that page? Each body gets a dynamically generated attribute of class="controller action". If you listen for body.controller.action, you'll have the event that can trigger you to show (or hide) your menu item.
Pseudo code might look like:
I want a new menu to appear for controller1, action1
when any action fires in any controller
if the class of the body element has both class "controller1" and class "action1"
menu.show()
else
menu.hide()

Ember.js - how do I bind a view to a state manager, and ensure that view is rendered?

I am using a StateManager to control the state of a pop-up modal (e.g., the states are "open.edit", "open.show" and "closed"). I'd like to use a state manager here because the modal is quiet complex and requires it's own transaction (I'm using Ember data).
I am able to set the appropriate data, view and controller on my ModalStateManager.
However, the view (in this case App.ModalView) is never rendered in the DOM. I know this because I've put logging statements in didInsertElement function of my App.ModalView, and those never get logged.
How can I render the view when someone clicks the button to open the modal?
Here's the code that is run on my ModalStateManager when someone clicks to open the modal.
App.ModalStateManager = Ember.State.create({
closed: Ember.State.create({
open: function(manager, modalData) {
var view = App.router.get('applicationController').connectOutlet("modal", modalData);
//this is working
//the view returned is the ModalView; it has a ModalController with expected content
manager.transitionTo('open.show');
}
})
//omitting other states for simplicity
)}
Larger question: How should you build a view that has multiple states and dynamic data, but does not have its own url or state within the router? e.g., Imagine a page with a list of unique items. Clicking an item pops open a modal that shows the item content, allowing the user to edit and save it. The modal doesn't have its own url or state in the router, so its not as easy as setting a dynamic state /:item_id in the router that can be easily wired and updated.
In one of our apps, we have a PanelManager (subclass of StateManager) that handles state for our modals. There is also a PanelController, which has properties that our panel container view binds to for className and visibility. When transitioning from closed to a particular open state (e.g. showingEditPanel), the manager sets the classname and visibility properties and calls connectOutlet on the panelController to show the correct view/controller combo within the panel container. Additional complexity can be modeled with nested states under each open state.

ZK how to remove waiting actions

I have an textbox with onChange method and button to make some actions. But if I type some thing in textbox and not clicking any where , click that button, It calls onClick method and then onChange method.Or first onChange and then OnClick but I should disable all actions after that onChange method.
Add the check to your onClick() method. The onChange() for a text box is fired after a certain period of time or after you deselect your component. If you deselect your component by clicking on a button it sounds pretty natural to me to get the onClik first and then the onChange. There is no way of controlling (as far as I know) these events, except on server side.
Read this !
Keep in mind that you are developing a WEB application and not a Desktop Application. And event if the development of zk applications may look pretty similar to the desktop applications they are not and they have their limitations.
I found solution :
First for Textbox onFocus method I disable next button , and user cant click it.
Second for Textbox onBlure method I enable next button. (To be fired onBlure action user should click somewhere on window or press tab and this fires onChange action)