Communication between smart objects

girlene

New Member
Hi there,

this is my first step in developing smart object applications.
i want to ask how to communicate between smart objects?

assume that i have a smart window, that contain a smart data browser and a smart data viewer which was linked by a smart data object.
the smart data viewer contains details of current row record in smart data browser. data browser itself contains a browser and a combo box.

now i need to get the value of selected combo box value in smart browser and use it for determine a variable's value in smart viewer whenever i add one record (for example to find the last series-number depends on the type i choose in combo box).

please tell me how to do this.

thanks,
Lynn
 
Hi there,

now i need to get the value of selected combo box value in smart browser and use it for determine a variable's value in smart viewer whenever i add one record (for example to find the last series-number depends on the type i choose in combo box).

Hi there,

You need to establish a method of grabbing the combo-box value from within the viewer. There are lots of potential methods of doing this - here's an example:

1. In the smartDataBrowse, on value-changed of the combo, set a user property in the container with the combo's screen-value as the property value:

Code:
DEFINE VARIABLE hContSource AS HANDLE      NO-UNDO.
 
hContSource = DYNAMIC-FUNCTION("getContainerSource").
 
IF VALID-HANDLE(hContSource) THEN
    DYNAMIC-FUNCTION("setUserProperty" IN hContSource,"myComboValue",cbMyCombo:SCREEN-VALUE).

So, the container will now be storing the last-known value of the browse's combo-box.

2. In your viewer, create an override procedure for addRecord. We now need to get the current value of the user property from the container:

Code:
DEFINE VARIABLE hContSource   AS HANDLE      NO-UNDO.
DEFINE VARIABLE cMyComboValue AS CHARACTER   NO-UNDO.
 
hContSource = DYNAMIC-FUNCTION("getContainerSource").
 
IF VALID-HANDLE(hContSource) THEN
    cMyComboValue = DYNAMIC-FUNCTION("getUserProperty" IN hContSource,"myComboValue").

You can now do whatever you need to with the combo value.

As I said, there are lots of other alternatives for this (custom smartLink, lots of procedures everywhere, passing object handles around), but this method is nice because it involves a low volume of custom code being created in your objects.

(perhaps you could question the need to have the combo within the browse object anyway - could it be in the container instead? And then you could use a dynamic smartDataBrowse and remove the need to have a static smartDataBrowse completely?)

Hope this helps,

Andy.
 
Have an application mode status.
By which the combox box value-changed event PUBLISHES a status.
The subscribing SmartDataObject then will set the UI ... / perform actions as required
 

girlene

New Member
Re: Communication between smart objects - solved

thanks all for helping..

before, i was not understand about the uses of handles.
now, i can see it clearly and this problem is solved.

i've made a procedure in smart viewer which was called in smart browser using handles, and it work properly.

thanks :)
 
You decided to use the old 4GL method by using handles, this is dirty and longer. ABL is much more efficient and by using named events makes functionality more application based, instead of objectized requiring lots more code. Good look ion the future.
 
Top