IonicWind Software

IWBasic => General Questions => Topic started by: JoaoAfonso on July 07, 2008, 12:26:20 PM

Title: Child window in a dialog
Post by: JoaoAfonso on July 07, 2008, 12:26:20 PM
Good evening.

I am having a problem with a dialog with a child window, and even not tried every solution, I ask here for tips.

I pretend to scroll down and up a big window inside the same dialog. Sometime ago I was advised to use a child window, and when clicking in scroll bar, or using mouse middle button scroll, it scrolls the window up or down (this was the only way of having a window of 3000 pixels height inside a dialog of 600 pixels height, with the ability to scroll up and down). The point is this: when I click in some controls in the dialog, after scrolling the window, my program executes also the controls of the window behind the controls of the dialog.

So the question is this: how to set the order of control execution? I mean, when a person clicks with left button of mouse, how to say I want to execute the control of the dialog in spite of the window?

Thanks
Title: Re: Child window in a dialog
Post by: LarryMc on July 07, 2008, 01:46:15 PM
Joao

I'm confused.  It sounds like you're saying you have dialog controls that are covered by a scrolling window?

Maybe showing so code will help.

Larry
Title: Re: Child window in a dialog
Post by: JoaoAfonso on July 07, 2008, 05:14:43 PM
I need to show in my program a window that can reach something like 2000 pixels in height (it is dinamically created). To show that window using a scroll, I was advised to create a child window inside a parent dialog. In this way, the dialog can have 600 pixels in height, and I can scroll up and down the child window safely and with a good appearence. The window has controls all over the 2000 pixels (I have it filled with buttons of 16 pixels each - sounds strange, but it's the point :P), and I also need to have some controls in the dialog because I want them to be shown permanently (one of those is a calendar).
Someone helped me sometime ago with the scrolling thing, via this routine:

SUB sizeSubwin(verticalpos:INT,dial:dialog,wind:window)
INT l,t,w,h,t_ajustado,tempint
SETSCROLLPOS dial,-2,verticalpos
GETSIZE wind, l,t,w,h
IF verticalpos<0
SETSIZE wind, 0,192,w,h
ELSE
IF verticalpos>h-500
tempint=h/16
t_ajustado=193-(16*(tempint-30))
SETSIZE wind, 0,t_ajustado,w,h
ELSE
SETSIZE wind, 0,-verticalpos+192,w,h
ENDIF
ENDIF
ENDSUB


In resume:
- first 200 pixels of the dialog are used for the permanent controls I want to show.
- the next 400 pixels are for show the parcial window W1 (which has 2000 pixels).
- when I start the dialog, just the first 400 pixels of window w1 are shown (0 to 400; from 400 to 2000 is hidden).
- scrolling down the window, it will show the rest of it (lets assume I now see from pixel 600 to pixel 1000 - 0-600 is hide at the top, 1000-2000 is hide below).
- the problem was when I click in the first 200 pixels at this time, the action of my program was to activate the controls of the window (which at this time is hidden) in spite of the dialog controls.

I have now fixed the problem using the following functions and code:
TYPE POINT
DEF x AS INT
DEF y AS INT
ENDTYPE
DECLARE IMPORT, _GetCursorPos ALIAS GetCursorPos(lpPoint AS POINT),INT


GETSIZE d12,l,t,w,h

GETSIZE will tell me, using the t INT, the position of the window in the screen.
GetCursorPos will tell me, using the lpPoint.y INT, the position of the cursor in the screen too.
I just want to accept clicks in the window controls below 238 pixels. In this way, I did the following:

CASE @IDCONTROL
GETSIZE d12,l,t,w,h:_GetCursorPos(coord):coord.y=coord.y-t
IF coord.y>238


I can now scroll window up and down, and in any screen resolution, that this will prevent it.