Page 1 of 2

DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Wed Mar 10, 2010 4:30 pm
by Tom
Hi, Roger.

If a dialog is created with DC-commands, it may be needed to resize/repos objects without using the RESIZE-stuff from eXpress++. Sample: I have a huge dialog with several objects on it and a big browse. If the user selects a special option, some nested browses are displayed (hidden when the dialog comes up, behind the big browse), and if the user deselects the option, they are hidden again - just an example. In other situations, a groupbox should be bigger/smaller depending on the user interaction.

In those cases, I recalculate all object sizes and positions using CurrentSize(), CurrentPos(), SetPos(), SetSize(), SetPosAndSize() and so on (AUTORESIZE is off in those situations). This works, but it's a mess, since on the other hand, some dcget-options like WINDOWROW can be changed by users. So:

What about functions like DC_SetPos() ... using the row/column coordinates? This:

@ 1,1 DCBROWSE oBrowse ... SIZE 20,100

oBrowse:DC_SetPos(2,1) moves this browse to the second "line" (20 pixels downwards if no special option is set)

Just a suggestion. This would be very helpful and ease the coding.

Re: DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Wed Mar 10, 2010 6:24 pm
by rdonnay
Tom -

All DC_Xbp*() classes inherit from DC_XbaseParts() so it would be real easy to make these methods work for all classes, but I'm not quite sure I understand what you want. Could you be a little more clear about what you want each of the methods to do?

Roger

Re: DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Thu Mar 11, 2010 4:00 am
by Tom
Hi, Roger.

I just want to resize/move objects created with DC-commands using the DC-coordinates. It does not have to be a method.

Code: Select all

@ 1,1 DCBROWSE oBrowse ... SIZE 100,25
This may position oBrowse at 7,580 (bottomleft, pixel coordinates). The size of the browse is 700,550 (pixel). CurrentPos() and CurrentSize() may return these values.

Suggestion:

Code: Select all

DC_SetPos(oBrowse,2,1,DC_COORDINATES)
-> moves the browse to 7,560 (pixel), for instance.

Code: Select all

DC_SetSize(oBrowse,80,20,DC_COORDINATES)
-> resizes the browse to 560,400 (pixel) and doesn't move it. The "beginning position" remains.

But I can do this by my own. The offset values (7 pixels: one column, 20 pixels: one row) are inside GetOptions. It was just an idea. If this is not helpful for others, forget it. ;)

Re: DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Thu Mar 11, 2010 8:18 am
by rdonnay
Ok, I think I am understanding now what you want.

I believe that if they were methods, they would be easier to write and to use.

So these methods would use 0,0 as the top left instead of the bottom left and would translate from text-based to pixel-based.

I'll write something and send it to you for testing.

Re: DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Thu Mar 11, 2010 10:27 am
by rdonnay
Tom -

I think this is what you want.

I added the following new methods to DC_XbaseParts().
These will be inherited by all DC_Xbp*() classes:

dcSetPos()
dcSetSize()
dcCurrentPos()
dcCurrentSize()

Here are 2 new files:
http://bb.donnay-software.com:8080/support/_dcclass.prg - Copy to \exp19\source\dclipx directory
http://bb.donnay-software.com:8080/support/dcsetpos.prg - This is my test program

Roger

Re: DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Fri Apr 30, 2010 5:53 am
by Tom
Hi, Roger.

As I reported - this works really good. But it seems that the resizing/repositioning is not reflected by the GetList array. If i.e. a browse is resized with oBrowse:DCSetSize(a), and the dialog containing it is resized using DC_AutoResize() afterwards, the browse resizes to the initial size (the size it had when the dialog was created).

Tom

Re: DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Sat May 08, 2010 8:41 am
by rdonnay
Tom -

Sorry, I missed your post.
I'm working on that problem today.

Ok, I think I have it.
It passes my tests with the original test program.

Copy the attached _DCCLASS.PRG to \exp19\source\dclipx and run BUILD19_SL1.BAT to rebuild DCLIPX.DLL.

Roger

Re: DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Tue May 11, 2010 6:06 am
by Tom
Hi, Roger.

This creates an error at DC_XbpActiveXControl:Init(5153), Parameter has wrong type (<\CLSID\> + <0>).

Tom.

Re: DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Tue May 11, 2010 9:29 am
by rdonnay
This makes no sense.

I added some new code to DC_ActiveXControl() to allow for automatic registering of an OCX, but that code isn't excuted unless you also have the new DCDIALOG.CH with the REGISTER clause.

Could you please send me your DCDIALOG.CH file?

Re: DC_SetPos(), DC_SetSize(), DC_CurrentSize()

Posted: Tue May 11, 2010 9:40 am
by skiman
Hi Roger,

That register clause is a nice addition. Is it already tested for the codejock ocx files?