Several uses of parameters.

zhaozj2021-02-16  41

Several uses of parameters.

One time you need to pass parameters between several windows, which is the most thought to define a global variable.

It can be done later and not ideal.

Finally, I learned the parameter transmission to others, solved a lot of problems, and it is not easy to make mistakes.

Now write it out with you, and keep yourself in order to see. -------------------------------------------------- -------- First explain the function meaning of the parameter transmission: message.stringparm (biography is character) Message.doubleparm (biography is a value) Message.PowerObjectParm (biography can be a window, object, Structural, etc.) ) ------------ Write the following code to accept the following code to accept the parameters: long ll_newll_new = message.doubleparm / * This will receive the parameters you want. * / ------------------------------------------------ -----------

The above is just a passage of a parameter. For the passage of multi-parameters, there are three ways: 1. Deliver to the destination, divide the structure object 3. Delivery to use the object to pass me now master On the first two, the last thing I don't understand. I will add it later.

Now, it is: 1. Delivery to the destination to divide, but also to combine multiple parameters into a transfer, need to join the split when combined --- you define it. After receiving the parameters, divide it into multiple. * Write the following code in related events in the W_OLD window: / * For example, a combined self-confidence is Pass_old = "123 | 4567" --- Note that the first 123 and 4567 may be a long type, do not tighten, conversion type Extra * / string pass_oldpass_old = string (ll_pre) "| string (ll_tra) // ll_pre = 123, LL_TRA = 4567OpenWithParm (w_new (// new window), pass_old ---------- * Write the following code in the related events of the W_New window (new window): Integer li_fen / * Defines the location of the segmentation * / long ll_newpre, ll_newtra / * is used to store two parts * / string pass_newpass_new = message.stringparm

Li_FEN = POS (Pass_new, "|") / * Determines and record the position of the splitter * /

LL_Newpre = long (Left (Pass_new, li_fen - 1))

LL_NewTRA = long (right (pass_new, len (pass_new) - li_fen))

/ * The above is the first method ----- use character packets to split to destination * / ------------------------ -------------- coming to say: 2. Create a structure object in the library file, note that it is created because it is an object like a window, not with Sentences are defined. Structure S_INFO Variable Name Variable Type ID Long Name Char Sex Char / * First Take this. * / ** Write the following code in the related events of the W_OLD window: S_INFO LSTR_PRELSTR_PRE.ID = 1 / * Assignment value lstr_pre.name = "zhdleo" / * assignment Name LSTR_PRE.NAME = "Male" / * the value assigned sex openwithparm (w_new (// new window), lstr_pre) ** write the following code in w_new window (new window) Related event: s_info lstr_tralong tra_idstring tra_namestring tra_sex / * defined to receive variable lstr_tra = message.PowerObjectParm / * Receive parameter tra_id = lstr_tra.id tra_id = lstr_tra.nametra_id = lstr_tra.sex / * assignment

/ * The above is the second method ------ pass the structure object ----------------------------------------------------------------------------------------------------------------------------------------------------- ---------- I personally think that the second method is still very excellent, not only clear, but also defines structures, it can be seen, it is easy to understand.

As for the third, I still have to study slowly.

If you have a good method, or more clear, or more, please e-mail: zhdleo@163.com

转载请注明原文地址:https://www.9cbs.com/read-27315.html

New Post(0)