ooDialog Combobox color depends on amount of elements

This is a discussion on ooDialog Combobox color depends on amount of elements within the REXX forums in Programming Languages category; Hi, I can see a problem that seems to be related to the amount of elements that are added to an oodialog. My application has almost 1000 ooDialog elements and I have the problem that the background color of the dialog is displayed also in the combobox elements when the combobox is opened. I have created a test application and if a specific amount of elements are added to the application itself, the color of the comboboxes seems to change. It seems that there is a limit of elements to be added to ooDialog, because if some more elements are ...

Go Back   Application Development Forum > Programming Languages > REXX

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-07-2008, 11:21 AM
mberg
Guest
 
Default ooDialog Combobox color depends on amount of elements

Hi,
I can see a problem that seems to be related to the amount of elements
that are added to an oodialog.
My application has almost 1000 ooDialog elements and I have the
problem that the background color of the dialog is displayed also in
the combobox elements when the combobox is opened.
I have created a test application and if a specific amount of elements
are added to the application itself, the color of the comboboxes seems
to change.
It seems that there is a limit of elements to be added to ooDialog,
because if some more elements are added I receive a popup with the
message:

"Messages have exceeded the maximum number of allocated table entries.
No message can be added"

Sometimes I receive the Message:

"Dialog Control elements have exceeded the maximum number of allocated
color table entries. The Color for dialog ontrol cannot be added"

Changing the max elements when self~CREATE() is performed to a higher
value does not help.

Thanks for any helping information .... Martin
Reply With Quote
  #2  
Old 07-08-2008, 08:00 AM
Mark Miesfeld
Guest
 
Default Re: ooDialog Combobox color depends on amount of elements

On Jul 7, 8:21*am, mberg <mb...@de.ibm.com> wrote:
> Hi,
> I can see a problem that seems to be related to the amount of elements
> that are added to an oodialog.
> My application has almost 1000 ooDialog elements and I have the
> problem that the background color of the dialog is displayed also in
> the combobox elements when the combobox is opened.
> I have created a test application and if a specific amount of elements
> are added to the application itself, the color of the comboboxes seems
> to change.
> It seems that there is a limit of elements to be added to ooDialog,


Martin, that's right there are limits to the nunber of things you can
add to 1 dialog. The information that is used to control each dialog
is stored in tables. The size of the tables is fixed.

> because if some more elements are added I receive a popup with the
> message:
>
> "Messages have exceeded the maximum number of allocated table entries.
> No message can be added"


The message table has room for 500 entries.

> Sometimes I receive the Message:
>
> "Dialog Control elements have exceeded the maximum number of allocated
> color table entries. The Color for dialog ontrol cannot be added"


The color table table has room for 1000 entries. You only need an
entry for a dialog control where you change the color of the control
from the default color. Most people leave dialog controls with their
default color.

> Changing the max elements when self~CREATE() is performed to a higher
> value does not help.


The max elements number you use in self~create() refers to the number
of dialog controls, not to amount of information that is stored for a
single dialog.

Having one thousand controls in a single dialog is a huge number of
controls. I think the best advice is try and design your application
so it doesn't have so many controls in one dialog.

I'll take a look at changing the number of table entries depending on
the number of max elements when the dialog is created. Making it
relative to the number of elements, rather than fixed.
But, at some point you are going to have problems if you add too many
controls to one dialog.

For instance, each time the OS sends a message to a dialog, the
message table has to be searched to see if that message is one of the
ones in the message table. If the message table gets too big, your
dialog will seem sluggish to your users. Especially to users on a
slower computer. I don't know what the 'too' many number is on
today's computers.

--
Mark Miesfeld
Reply With Quote
  #3  
Old 07-09-2008, 08:38 AM
mberg
Guest
 
Default Re: ooDialog Combobox color depends on amount of elements

On Jul 8, 2:00 pm, Mark Miesfeld <miesf...@gmail.com> wrote:
> On Jul 7, 8:21 am, mberg <mb...@de.ibm.com> wrote:
>
> > Hi,
> > I can see a problem that seems to be related to the amount of elements
> > that are added to an oodialog.
> > My application has almost 1000 ooDialog elements and I have the
> > problem that the background color of the dialog is displayed also in
> > the combobox elements when the combobox is opened.
> > I have created a test application and if a specific amount of elements
> > are added to the application itself, the color of the comboboxes seems
> > to change.
> > It seems that there is a limit of elements to be added to ooDialog,

>
> Martin, that's right there are limits to the nunber of things you can
> add to 1 dialog. The information that is used to control each dialog
> is stored in tables. The size of the tables is fixed.
>
> > because if some more elements are added I receive a popup with the
> > message:

>
> > "Messages have exceeded the maximum number of allocated table entries.
> > No message can be added"

>
> The message table has room for 500 entries.
>
> > Sometimes I receive the Message:

>
> > "Dialog Control elements have exceeded the maximum number of allocated
> > color table entries. The Color for dialog ontrol cannot be added"

>
> The color table table has room for 1000 entries. You only need an
> entry for a dialog control where you change the color of the control
> from the default color. Most people leave dialog controls with their
> default color.
>
> > Changing the max elements when self~CREATE() is performed to a higher
> > value does not help.

>
> The max elements number you use in self~create() refers to the number
> of dialog controls, not to amount of information that is stored for a
> single dialog.
>
> Having one thousand controls in a single dialog is a huge number of
> controls. I think the best advice is try and design your application
> so it doesn't have so many controls in one dialog.
>
> I'll take a look at changing the number of table entries depending on
> the number of max elements when the dialog is created. Making it
> relative to the number of elements, rather than fixed.
> But, at some point you are going to have problems if you add too many
> controls to one dialog.
>
> For instance, each time the OS sends a message to a dialog, the
> message table has to be searched to see if that message is one of the
> ones in the message table. If the message table gets too big, your
> dialog will seem sluggish to your users. Especially to users on a
> slower computer. I don't know what the 'too' many number is on
> today's computers.
>
> --
> Mark Miesfeld


Reply With Quote
  #4  
Old 07-09-2008, 11:07 AM
mberg
Guest
 
Default Re: ooDialog Combobox color depends on amount of elements

On 8 Jul., 14:00, Mark Miesfeld <miesf...@gmail.com> wrote:
Hi Mark, thanks for your answer.
The problem is, that the application has a background color and so
each text element that is added to the dialog needs to have the same
background color otherwise a grey box appears around the text.
To prevent this I add the background color of the dialog
(sel~BackgroundColor() ) also to each text element and ofcourse to
Groupboxes etc.
To prevent this I would need to have an option to set the text
transparent.
I found aDialogControl~TransparentText(--dc--) but I was not able to
use that.
I tried this
handle = self~getself()
dc = self~GetWindowDC(handle)
self~TransparentText(dc)
self~AddText(...
But already the handle self~getself() does not work, because I get 0.
It seems that ~getself() cannot be used in method definedialog.
Later in method Run I use the self~getself() and i get a return of
787986.

What I need is an option set a textobject "transparent".

Thanks for a hint... Martin

Reply With Quote
  #5  
Old 07-09-2008, 12:59 PM
mberg
Guest
 
Default Re: ooDialog Combobox color depends on amount of elements

On 8 Jul., 14:00, Mark Miesfeld <miesf...@gmail.com> wrote:
Hi Mark, thanks for your answer.
The problem is, that the application has a background color and so
each text element that is added to the dialog needs to have the same
background color otherwise a grey box appears around the text.
To prevent this I add the background color of the dialog
(sel~BackgroundColor() ) also to each text element and ofcourse to
Groupboxes etc.
To prevent this I would need to have an option to set the text
transparent.
I found aDialogControl~TransparentText(--dc--) but I was not able to
use that.
I tried this
handle = self~getself()
dc = self~GetWindowDC(handle)
self~TransparentText(dc)
self~AddText(...
But already the handle self~getself() does not work, because I get 0.
It seems that ~getself() cannot be used in method definedialog.
Later in method Run I use the self~getself() and i get a return of
787986.

What I need is an option set a textobject "transparent".

Thanks for a hint... Martin
Reply With Quote
  #6  
Old 07-10-2008, 04:35 AM
mberg
Guest
 
Default Re: ooDialog Combobox color depends on amount of elements

On 8 Jul., 14:00, Mark Miesfeld <miesf...@gmail.com> wrote:

Hi Mark,
did some more testing and using this code I'm able to write
transparent text.

fontobj = Font_Object~GetFont() -- this is specific to
my implementation to get the current font object
object = self~GetStaticControl(Data.id) -- connect to the text
to be drawn
dc = object~GetDC()
object~FontToDC(dc, fontobj)
object~TransparentText(dc)
object~WriteDirect(dc,1,1,textobj.1)
object~FreeDC(dc)

The above code instead of self~SetStaticText(Data.id,'TEXT
TEXT') will display the text on the dialog transparent. ;-))
But when the next self~Update() method is called, or when I switch to
any other window and come back to to the dialog window (ALT+TAB) the
text disappeares..... ;-((
It seems that the text needs to be written again and again ?

So to use the ~TransparentText method I would need to write a own
additional method that is started whenever I call ~Update() and this
routine needs to rewrite all text dialog objects ?
Is that what happens within the ooDialog implementation, the elements
are redrawn again and again ?

........ Martin


Reply With Quote
  #7  
Old 07-10-2008, 09:58 AM
Mark Miesfeld
Guest
 
Default Re: ooDialog Combobox color depends on amount of elements

On Jul 10, 1:35 am, mberg <mb...@de.ibm.com> wrote:
> On 8 Jul., 14:00, Mark Miesfeld <miesf...@gmail.com> wrote:
> did some more testing and using this code I'm able to write
> transparent text.
>
> fontobj = Font_Object~GetFont() -- this is specific to
> my implementation to get the current font object
> object = self~GetStaticControl(Data.id) -- connect to the text
> to be drawn
> dc = object~GetDC()
> object~FontToDC(dc, fontobj)
> object~TransparentText(dc)
> object~WriteDirect(dc,1,1,textobj.1)
> object~FreeDC(dc)
> ...
> Is that what happens within the ooDialog implementation, the elements
> are redrawn again and again ?


Martin,

The windows, dialogs, controls, etc., are drawn by the OS. Any time a
window is covered and then uncovered it needs to be redrawn by the
OS. This doesn't have anything to do with ooDialog, it is just the
way things work.

What is happening with your code above is that you are getting a new
device context, writing your text with that, and then freeing the
device context. The next time the OS asks the control to draw itself,
the control uses its own internal device context to redraw itself.

What you are doing is clever, but I don't think it will end up being a
good solution in the long run for you.

For the next release of ooRexx (which is still a ways off) I'll change
the ooDialog code so that the size of the various tables, like the
color table, can vary depending on the number of elements specified in
the create() method. That will solve the problem for you. I think
I'll also add some methods so that you can directly set the max size
of the tables.

In the meantime, I'll look through the ooDialog code and see if there
might be some temporary work around that you can use. If not, the
only thing you can do is somehow reduce the number of elements in your
dialog.

--
Mark Miesfeld
Reply With Quote
  #8  
Old 07-10-2008, 10:03 AM
Mark Miesfeld
Guest
 
Default Re: ooDialog Combobox color depends on amount of elements

On Jul 9, 8:07 am, mberg <mb...@de.ibm.com> wrote:

> I tried this
> handle = self~getself()
> dc = self~GetWindowDC(handle)
> self~TransparentText(dc)
> self~AddText(...
> But already the handle self~getself() does not work, because I get 0.
> It seems that ~getself() cannot be used in method definedialog.


Just as a FYI. The handle is the window handle of the underlying
operating system window. There is no handle until the dialog window
has actually been created by the OS. In defineDialog(), the
underlying dialog does not yet exist.

--
Mark Miesfeld

Reply With Quote
  #9  
Old 07-10-2008, 02:42 PM
mberg
Guest
 
Default Re: ooDialog Combobox color depends on amount of elements

On 10 Jul., 16:03, Mark Miesfeld <miesf...@gmail.com> wrote:
Hi Mark,
what about an additional option "TRANSPARENT" for the
self~ADDTEXT(....)



>>-aUserDialog~AddText(--x--,--y--,--+----+--,--+----+--,--text-->

+-cx-+ +-cy-+
>--+----------------------------------------+--)----------------><

+-,--+----------------------+--+-------+-+
| .---------------. | +-,--id-+
| V | |
+-"----+-HIDDEN----+-+--"-+
+-SIMPLE------+
+-RIGHT-------+
+-CENTER------+
+-BORDER------+
+-TRANSPARENT-+

.... martin
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:29 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.