UserObject in an Userobject

Posted on 2003-03-28
Medium Priority
Last Modified: 2013-12-26
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?

Question by:bluecomet
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 8225347
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)


Author Comment

ID: 8225633
I meant create it dynamically on run time, not in design time.

Expert Comment

ID: 8225721
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).


MyUO   luo
window lw

// Get the parent window
lw = of_getparentwindow()

// Instantiate the custom uo

// Assign it to the placeholder
uo_theplaceholder = luo


Accepted Solution

buasuwan earned 500 total points
ID: 8227142
  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)


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question