October 29, 2025, 09:04:04 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Another odd problem

Started by LarryMc, August 21, 2008, 01:37:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

August 21, 2008, 01:37:50 AM Last Edit: August 21, 2008, 01:39:25 AM by Larry McCaughn
I've got a main window that has a tabcontrol.
There are some controls on the parent.
Hiting tab one shows a hidden child window (blue) which has a child(red)
The child (blue) window covers some of the controls on the parent window.

if you click on another window or the desktop and then come back to the parent the child windows are still displayed but the parent's controls are on top.  Code below:
window win_main,win_shape_sel_1,win_shape_sel_2
const TABCTL =500

const PREVIEW_BUTTON_B = 27000
const PREVIEW_BUTTON_A = 27010
const FONTNAME_CB = 801
const FONTSTYLE_CB = 802
const FONTSIZE_CB = 803
const FONT_UL = 804
const FONT_STRIKE = 805

const BUT_LABEL = 1100

const BUT_WIDTH = 14000
const BUT_HEIGHT = 14010
const BUT_ID = 14020
const WINDOW_ID = 14030

OPENWINDOW win_main,0,0,788,660,@MINBOX,0,"main",&whandler_main
setup_main_win()
init_font_select_layout()
openwindow win_shape_sel_1,5,32,200,500,@vscroll|@nocaption,win_main,"hello",&whandler_win_shape_sel_1
SetWindowColor win_shape_sel_1,rgb(255,0,0)
showwindow win_shape_sel_1, @swhide
openwindow win_shape_sel_2,0,0,150,8000,@nocaption,win_shape_sel_1,"",&whandler_win_shape_sel_2
SetWindowColor win_shape_sel_2,rgb(0,0,255)
showwindow win_shape_sel_2, @swhide

WAITUNTIL win_main = NULL
END
'endregion

global SUB whandler_main  'handler
int tab
SELECT @MESSAGE
int x
CASE @IDCREATE
CENTERWINDOW win_main

CASE @IDCLOSEWINDOW
CLOSEWINDOW win_main
CASE @IDCONTROL
SELECT @CONTROLID
CASE TABCTL:'tab control
IF @NOTIFYCODE = @TCN_SELCHANGE
tab = tcGetSelectedTab(win_main,TABCTL)
'clear all hilites
for x = 0 to 5
tcHighlightTab(win_main,TABCTL,x,0)
next x
'highlight current selection
tcHighlightTab(win_main,TABCTL,tab,1)
SELECT tab
case 0:'select shape
showwindow win_shape_sel_1,@SWrestore
showwindow win_shape_sel_2,@SWrestore
case 1:'select shade
showwindow win_shape_sel_1,@SWHIDE
showwindow win_shape_sel_2,@SWHIDE
case 2:'select font
showwindow win_shape_sel_1,@SWHIDE
showwindow win_shape_sel_2,@SWHIDE

string fontname
int size,weight,flags,tcolor
size=8
weight=400
flags=0
tcolor=rgb(0,0,0)
fontname="MS Sans Serif"
fontname = FONTREQUEST(win_main,size,weight,flags,tcolor,fontname)
'set_tab(0)
case 3: 'vert rgbButton
showwindow win_shape_sel_1,@SWHIDE

case 4: 'horz rgbButton
showwindow win_shape_sel_1,@SWHIDE

case 5: 'diag rgbButton
showwindow win_shape_sel_1,@SWHIDE

ENDSELECT
'recalcLayout()
ENDIF

ENDSELECT

ENDSELECT
RETURN
ENDSUB

global sub setup_main_win()

'tab control
TabControl win_main,0,5,783,24,@TABSTOP|@TCS_TOOLTIPS|@TCS_HOTTRACK,0,TABCTL
tcInsertTab win_main,TABCTL,0,"1. Select Shape "
tcInsertTab win_main,TABCTL,1,"2. Select Shading "
tcInsertTab win_main,TABCTL,2,"3. Select Font "
'tcInsertTab win_main,TABCTL,3," Region Vertical  "
'tcInsertTab win_main,TABCTL,4," Region Horizonal "
'tcInsertTab win_main,TABCTL,5," Region Diagonal "
SETFONT win_main,"Arial",8,600,0,TABCTL
'SETFONT win_main,"MS Sans Serif",8,400,0,TABCTL
'tooltips for the tabs
tcSetTip win_main,TABCTL,0,tcGetTabText(win_main,TABCTL,0)
tcSetTip win_main,TABCTL,1,tcGetTabText(win_main,TABCTL,1)
tcSetTip win_main,TABCTL,2,tcGetTabText(win_main,TABCTL,2)
tcSetTip win_main,TABCTL,3,tcGetTabText(win_main,TABCTL,3)
tcSetTip win_main,TABCTL,4,tcGetTabText(win_main,TABCTL,4)
tcSetTip win_main,TABCTL,5,tcGetTabText(win_main,TABCTL,5)
tcSetSelectedTab(win_main,TABCTL,-1)
return
endsub

global sub init_font_select_layout()
int l,t
CONTROL win_main,@COMBOBOX,"",30,50,150,124,@VSCROLL,FONTNAME_CB

SETFONT win_main, "MS sans Serif", 10, 400, 0,FONTNAME_CB

CONTROL win_main,@COMBOBOX,"",185,50,75,92,@TABSTOP,FONTSTYLE_CB
SETFONT win_main, "MS sans Serif", 10, 400, 0,FONTSTYLE_CB

CONTROL win_main,@COMBOBOX,"",265,50,44,124,@VSCROLL|@TABSTOP,FONTSIZE_CB
SETFONT win_main, "MS sans Serif", 10, 400, 0,FONTSIZE_CB

CONTROL win_main,@RADIOBUTTON,"Underline",185,145,70,16,@TABSTOP|@GROUP,FONT_UL
SETCONTROLCOLOR win_main,FONT_UL,0,RGB(255,255,255)
SETFONT win_main, "MS sans Serif", 10, 400, 0,FONT_UL
CONTROL win_main,@RADIOBUTTON,"StrikeOut",185,160,70,16,@TABSTOP,FONT_STRIKE
SETFONT win_main, "MS sans Serif", 10, 400, 0,FONT_STRIKE
SETCONTROLCOLOR win_main,FONT_STRIKE,0,RGB(255,255,255)

'label input and display
l=20:t=190
CONTROL win_main,@static,"Button Label",l+125,t+8,230,14,0x00008001,BUT_LABEL
SETCONTROLCOLOR win_main,BUT_LABEL,0,RGB(255,255,255)
SETFONT win_main, "ms sans serif", 9, 700,  0x00FF0000,BUT_LABEL
CONTROL win_main,@EDIT,"",l+125,t+22,230,20,0x50800000,BUT_LABEL+1
SETCONTROLCOLOR win_main,BUT_LABEL+1,0,RGB(255,255,255)
SETFONT win_main, "ms sans serif", 9, 400,  0x00FF0000,BUT_LABEL+1
'Display
CONTROL win_main,@static,"Button_10",l+125,t+43,230,60,0x00808201,BUT_LABEL+2
SETCONTROLCOLOR win_main,BUT_LABEL+2,0,RGB(255,255,255)
SETFONT win_main, "ms sans serif", 9, 700,  0x00FF0000,BUT_LABEL+2


AddString win_main,FONTNAME_CB,"String 1"
AddString win_main,FONTNAME_CB,"string 2"
AddString win_main,FONTNAME_CB,"string 3"
AddString win_main,FONTNAME_CB,"string 4"
AddString win_main,FONTNAME_CB,"string 5"
AddString win_main,FONTNAME_CB,"string 6"
AddString win_main,FONTNAME_CB,"string 7"
AddString win_main,FONTNAME_CB,"string 8"
AddString win_main,FONTNAME_CB,"string 9"

AddString win_main,FONTSTYLE_CB,"Regular"
AddString win_main,FONTSTYLE_CB,"Italic"
AddString win_main,FONTSTYLE_CB,"Bold"
AddString win_main,FONTSTYLE_CB,"Bold Italic"

AddString win_main,FONTSIZE_CB," 8"
AddString win_main,FONTSIZE_CB,"10"
AddString win_main,FONTSIZE_CB,"12"
AddString win_main,FONTSIZE_CB,"14"
AddString win_main,FONTSIZE_CB,"16"
AddString win_main,FONTSIZE_CB,"18"
AddString win_main,FONTSIZE_CB,"20"
AddString win_main,FONTSIZE_CB,"24"
AddString win_main,FONTSIZE_CB,"48"
AddString win_main,FONTSIZE_CB,"72"
return
endsub

global SUB whandler_win_shape_sel_1  'handler

SELECT @MESSAGE
CASE @IDCREATE
CASE @IDCLOSEWINDOW
CLOSEWINDOW win_shape_sel_1
ENDSELECT
RETURN
ENDSUB

global SUB whandler_win_shape_sel_2  'handler

SELECT @MESSAGE
CASE @IDCREATE
CASE @IDCLOSEWINDOW
CLOSEWINDOW win_shape_sel_2
ENDSELECT
RETURN
ENDSUB


I've tried everything I can think of.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

It is a limitation of Windows.  Certain controls don't respect parent/child relationships such as the lowly edit control which will happily draw its client area on top of everything. 

The only solution is to manually hide non behaving controls if they are covered by an embedded child window, or use a second window on top of the main window that holds the main windows controls, which you can hide separately.  I've used both methods, using arrays of control ID's to make hiding/showing a bit easier. 

If the tab control is going to be on top of the parent controls all the time then how were you planning to access the parent window controls?

Paul.
Ionic Wind Support Team

LarryMc

Quote from: Paul Turley on August 21, 2008, 02:09:44 AM
If the tab control is going to be on top of the parent controls all the time then how were you planning to access the parent window controls?
The tab control is only 24 bits high. So it wasn't in the way.

I'm going to use another window for the main controls like I have done in the past.  I don't know why I didn't do that in the first place this time.

Thanks for taking the time to look at it.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

Your welcome.  I was really tired when I posted that.  The real reason edit controls do that is they can't be overlapped with other controls, so they don't respect sibling relationships or Z order, not the same as parent/child.  Any Windows control that can be activated has the same problem, such as a combo box with the edit control.

Paul.

Ionic Wind Support Team