Powerbuilder 7.0 - Pass value from an event to another event - event-handling

i'm currently using Powerbuilder 7.0. So i got an object that need to modify 2 events. It is an inventory program, which will check if the item are below the level, it will pop out a message to show current available qty and reorder level qty.
So event stock_reorder_level are for displaying the message, and event stock_checking are for the checking of stock qty. Now i've done the message, but it shows 0 for available and reorder qty. The value for the qty are defined on event stock_checking, i wasn't sure how to pass the value of qty to the stock_reorder_level event. Below are some of the coding i've done.
event stock_reorder_level
event stock_checking
My question: how to pass dec_totPrdQty and dec_stockReorderLevel to event stock_reorder_level.

You need to:
Add adec_prdqty and adec_reorderlevel as parameters to the event definition for stock_reorder_level instead of the two local variables.
pass the two values as arguments when you call stock_reorder_level. EX:
THIS.EVENT ue_reachStockReorderLevel(al_row, dec_totPrdQty, dec_stockReorderLevel)
You toggle the event definition in PowerBuilder's script painter with the button "Show/Hide Prototype" located in the top right-hand corner.

Related

How to get reference to a trigger box

In a simple level I have a trigger box with event dispatcher that is called on event ActorBeginOverlap. I have in the same level a cube blue print and I want to assign the event dispatcher of the trigger box to the event BeginPlay of the cube so I tried like in the picture but it does not work so what is the correct way to do this ?
you need to set the object you want to cast to MyTriggerBox_Blueprint
You have to get which instance of that triggerBox you want, If you have 50 of them in a level, you have to specify which one you want to cast to. If you have only 1 of them in a level and you want to only talk to that one then use GetActorsOfAllClass then get( a copy) 0 of that array and plug it in as the object

Update bean properties on button click

I'm new to ZK framework and trying to implement a simple thing but ZK's different approach is boggling my mind:
I have a grid with a model as a Person list. All grid fields are editable textboxes and are populated with Person's name and surname (2 columns). What I'm trying to do is:
-- Implement a "Save All" button, which will bind all changed values to respecting Person's name and surname properties.
Simply, on "Save All" click, save all changed values. But I don't want to change anything before button click, so there will be no #save on textboxes, just #load.
What I did so far:
-- On textboxes' onChange event, save textbox's value on a temporary Person object's property (either name or surname), and add that Person to a changedPersonsList. On SaveAll button's click, replace my model's Persons with changedPersonsList Persons... But then I can't know which Person is which without implementing an ID field.
Everything would be SOO easy if I just can send label values on SaveAll click along with row number.
You can control the timing of data binding with condition keywords..
<textbox value="#load(vm.text) #save(vm.text, before='saveAll')"/>
<button onClick="#command('saveAll')"/>
Here we use the before condition to coordinate when the value should be saved: not when it is changing (like normal) but when the saveAll command is about to be executed.
You can read more about this in the ZK documentation.

VB Datarepeater control in Visual Studio 2010 - currentItemIndex updated before textbox leave event when using mouse

I'm using a datarepeater control, version 10.0 in visual studio 2010. The CurrentItemIndex seems to update before the textbox leave event when I use the mouse to move to the next row. So, when I retrieve the value from the textbox, I don't now what ItemIndex it is associated with. This doesn't happen when the keyboard is used to move to the next row. Anyone see this happen. Version 9.0 on the datarepeater did work this way.
To answer you directly, here are some C# snippets. I'm assuming that you already have the TextBox object (or other control) as implied in your question. I will also assume that you're inside an event handler (e.g. TextChanged). If you haven't already done it, you need to use the object sender parameter and not the design-time declared TextBox control (i.e. do not use TextBox1, or similar object) because it will just refer to the DataRepeaterItem template control and not the individual control for the data row you're interested in.
TextBox itemTextBox = sender as TextBox;
//* DataRepeaterItem is a control which contains other controls for each data "row"
DataRepeaterItem drItem = itemTextBox.Parent as DataRepeaterItem;
//* Retrieve the particular data item
int idx = drItem.ItemIndex;
//* If DataRepeater is bound to a BindingSource, for example,
//* one can retrieve the underlying data item
object dataItem = myBindingSource.List[idx];
I've experienced various bugs and challenges with control focus and data updates with the DataRepeater. There is no guarantee of exactly which order the events fire: Leave, LostFocus, CurrentItemChanged, etc. And as you've observed, it differs depending on whether you use the mouse within the DataRepeater or to/from another control on the form or using the keyboard. There may indeed be an established algorithm, but I have observed differences from documentation. The situation is complicated when the data-handling framework (e.g. BindingSource, CurrencyManager) also subscribes to these events and updates things out of order from what you might expect or want. I don't have a suggestion on how to handle these issues, but I hope the code above can at least get you access to the particular index and data for the control you're in.

Get Value on a Window with GridPanel using ExtJS

I have a situation here: I have a form field with trigger xtype, what I want to happen on my trigger function is to open a window with a list or grid of data in it. I want to get the value of those data and assign it as the value of my form field with trigger. Can anyone help me solve this problem. Thank you very much.
You have multiple solutions for this.
You can make use Saki's simple message bus to do the communication between extjs components.
You can create an custom event for your trigger field. When user selects a record in your window, fire the event with the selected record.
Inside your onTriggerClick :
Display your window with grid / view for user selection
Inside your Window (on some submit button):
onSubmitClick: function(){
// Get the selected record & fire event
var selected = grid.getSelectionModel().getSelected();
triggerFieldObject.fireEvent('recordSelect',selected);
}
Inside your event processing (Will be on TriggerField):
onRecordSelect: function(record) {
// Now you have access to the selected record.. process it,
// Set the trigger field value etc
this.setValue('Your Value for Trigger Field');
}
Note: This is a skeleton code and not a complete solution. You will need to add your code according to your requirements.

SilverLight 4 DataGrid & MVVM: Using SelectionChanged trigger to check checkbox, but NotifyPropertyChanged causes crash

I have a DataGridCheckBoxColumn in my DataGrid which is to indicate the rows the user has selected. I want the checkboxes to be checked/unchecked with a single click. Making the column editable (i.e. IsReadOnly="False") means the user has to click twice (first click just selects the row, 2nd click changes the checkbox), so I decided to set/clear the property the column is bound to in the view model code in response to the SelectionChanged trigger firing.
Setting/clearing the property works fine, however as soon as I call NotifyPropertyChanged("name of collection the grid is bound to") to get the view to show the change, this causes the SelectionChanged trigger to fire again. This loops about 10 times until an exception is thrown.
If I remove the call to NotifyPropertyChanged, the SelectionChanged trigger fires once, but of course I don't see any change in the UI. The collection is a PagedCollectionView if this makes any difference.
How can I get this to work? Note - I am using MVVM pattern, so everything is done with bindings to View Model (no code behind).
Thanks
Sounds like you have a infinite loop by design.
but try using the selectionchanging instead of selectionchanged,
or put a isloading flag in your viewmodel and dont call the inotify if the isloading is true
I found a very simple solution that doesn't involve triggers or code behind. See: Silverlight single-click checkbox DataGrid columns
It seems to work by using a column template, but only providing the CellEditingTemplate and no CellTemplate.