Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1572
  • Last Modified:

UserObject in an Userobject

Hi folks,

i want to write my own control etc.. So i need to put an userobject a in an userobject b and then put the userobject b on a window.
A userobject a could be, line, rectangle, ellipse, buttons etc.. I know the function openuserobject() but that only works with window! How could i put for example a line on userobject b and to vies it on userobject b and then view the hole object in a window?


$regards
0
bluecomet
Asked:
bluecomet
  • 2
1 Solution
 
bendepCommented:
I don't see the problem.
1. In the userobject painter you can create userobject b containing userobject a (use menu Insert/Control/UserObject).
2. In the window painter you can set userobject b on the canvas (use same menu item)

done.
0
 
bluecometAuthor Commented:
I meant create it dynamically on run time, not in design time.
0
 
bendepCommented:
well, you could create a userobject b with a placeholder for userobject a (the common ancestor of whatever you want to instantiate dynamically).
next, in the userobject, code the OpenUserObject(luo) and set the reference in the same script equal to the placeholder (ancestor).

eg:

ue_postconstruct()
MyUO   luo
window lw
...

// Get the parent window
lw = of_getparentwindow()

// Instantiate the custom uo
OpenUserObject(luo)

// Assign it to the placeholder
uo_theplaceholder = luo

0
 
buasuwanCommented:
Hi,
  you have to use function OpenUserObject() to create userobject a in window first, and then move it to userobject b. but you need a WINAPI function to move userobject a into userobject b.

declare an External Function in userobject b

Function long SetParent(long hWndChild, long hWndNewParent) Library "user32" Alias for "SetParent"

in userobject b.
you will have a new function 'create_uo_a'.

function create_uo_a(integer ai_new_x, integer ai_new_y) return uo_a

uo_a     luo_a
//
window     lw_parentwindow
lw_parentwindow = GetParent()
lw_parentwindow.openuserobject(luo_a , "uo_a", ai_new_x, ai_new_y)
//
long     ll_uo_a_handle, ll_uo_b_handle
ll_uo_a_handle = handle(luo_a)
ll_uo_b_handle = handle(this)

// move uo_a from window into uo_b
SetParent(ll_uo_a_handle, ll_uo_b_handle)

return luo_a



and now you call create uo_a in uo_b from script
I assume that you place uo_b on your window and named 'uo_1'. then create userobject uo_a script is

uo_1.create_uo_a(100, 100)


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now