EDIT2: Looking at it, maybe this should have been in the code snippits forum as its not really a program, sorry if I annoyed anyone posting it here...
As the title says, I have produced a set of functions using BlueGUI that allow you to create a Delphi Object Inspector sytle value editor.
At the moment it will only create comboboxes and editboxes but this can easily be modified, as can the size of the window to suit a specific purpose.
It may not be that usefully if you are creating a game but those creating editors may like it.
This is an explaination of the current functions:
remstart
COMMANDS EXPLAINED
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
createProperty(winName as string, handleParent)
Description:
Creates a new property window
Return Value:
The number of the property window created, the first window being 0
This is not the BlueGUI handle
Parameters:
winName
The caption of the titlebar
handleParent
The parent of the window, the main window being 0
This is the same handleParent as BlueGUI
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
addPropertyTab(tabName as string,winHandle)
Description:
Adds a tab item to the property window previously created
Return Value:
The handle of the tab, this will allow you to later modify the tab if required
This is the same handle as BlueGUI
Parameters:
tabName
The text of the tab item
winHandle
The handle of the property window previously created
This is the handle returned in createProperty
This is not the BlueGUI handle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
addPropertyItem(itemCaption as string,itemType,itemTab,winHandle)
Description:
This will create 2 edit boxes side by side inside the property window previously created.
Both boxes are read only. The left displaying the item caption and the right displaying the
value associated with them.
A third editbox or combobox will also be created but by default be hidden. If the user mouseclicks
either of the first two boxes, the third will replace the right box and allow the user to edit the value
Return Value:
The handle of the third gadget, this will allow you to later modify the gadget if required
If the third gadget is a combobox, you use this handle and the BlueGUI command addItem to add items to the
combobox.
This is the same handle as BlueGUI
Parameters:
itemCaption
This is the text of the left editbox, it is used as the description of the value required.
itemType
There are currently only two itemTypes [_EditBox, _ComboBox]. Depending on the type of data required for
the item property, the itemType should be set accordingly
itemTab
The handle of the tab the property item belongs to previously created in addPropertyTab
This is the same handle as BlueGUI
winHandle
The handle of the property window previously created
This is the handle returned in createProperty
This is not the BlueGUI handle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
allowPropertyAlphaChar(handle,allowAlpha)
Description:
This will allow or disallow the edit box created in addPropertyItem to allow alpha-numeric characters
Return Value:
n/a
Parameters:
handle
The handle of the property item previously created
This is the handle returned in addPropertyItem, the same handle as returned by BlueGUI
allowAlpha
This sets if alpha-numeric characters are allowed.
0 or _FALSE for disallowing, 1 or _TRUE for allowing
If disallowed, this will not stop the user typing alpha-numeric characters but create an error message
box and removes all illegal characters
i.e, 1a00 will change the item text to 100 if allowAlpha is set to 0
As the default is 0, if you only require numbers this command need not be called.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
addLabelToPropertyItem(handle,caption$)
Description:
This will create a label emulating an information box.
If the mouse if over the property item description previously created using addItemProperty, after a
1 second delay, the label will appear. This is usefull to allow an extended description or 1 line information
box
Return Value:
n/a
Parameters:
handle
The handle of the property item previously created
This is the handle returned in addPropertyItem, the same handle as returned by BlueGUI
caption$
This is the caption to be displayed when the label is visible
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
processPropertyEvents()
Description:
This will process all the property events. This should be put somewhere in your processEvents() function
This command will not work if you have not called getEvent in the main loop
Return Value:
n/a
Parameters:
n/a
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setTabSelected(window,tabSelected)
Description:
This is an internal command used in processPropertyEvents()
This will select a new tab in the Property window and manage the visual display of the edit boxes
Return Value:
n/a
Parameters:
window
The handle of the property window previously created
This is the handle returned in createProperty
This is not the BlueGUI handle
tabSelected
This is the number of the tabSelected
This is the same number as used in BlueGUI
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
updateText(handle,strCaption$)
Description:
This is an internal command used in processPropertyEvents()
This will take a string and if the handle will not allow alpha-numeric characters, display an error message
as well as modifing the string to exclude all alpha-characters previous present then update the text of the handle
Return Value:
n/a
Parameters:
handle
The handle of the property item previously created
This is the handle returned in addPropertyItem, the same handle as returned by BlueGUI
strCaption$
This is the string that will make up the handle's text
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
remend
This is the UDT and variables required at the top of the program:
#constant _itemEdit 0
#constant _itemComboBox 1
#constant _TRUE 1
#constant _FALSE 0
Type TProperty
window
tabSelected
propSelected
count
mainCombo
mainTab
mainScroll
allowScroll
scrollPosition
Endtype
Type TPropertyItem
top, left
NormL
NormR
Handle
itemType
itemTab
itemLabel
allowAlpha
allowLabel
getTimer
Parent
Endtype
set window on
dim Property() as TProperty
dim PropertyItem() as TPropertyItem
global propCount
global propItemCount
global propSelected
propCount = -1
propItemCount = -1
propSelected = -1
And the main functions:
function createProperty(winName as string, handleParent)
Array insert at bottom Property()
propCount = propCount + 1
propSelected = propCount
mainPropWin=createWindow(100,210,187,516,winName,WINDOW_FIXED,WINDOW_TOOLWINDOW,0,handleParent)
mainCombo=createComboBox(0,0,161,21,mainPropWin)
mainTab=createTabs(0,24,163,27,mainPropWin)
mainScroll=createScrollbar(gadgetWidth(mainPropWin)-25,0,18,gadgetHeight(mainPropWin)-25,1,mainPropWin)
setGadgetEnabled mainScroll,0
Property(propCount).Window = mainPropWin
Property(propCount).mainCombo = mainCombo
Property(propCount).mainTab = mainTab
Property(propCount).mainScroll = mainScroll
Endfunction propSelected
function addPropertyTab(tabName as string,winHandle)
If winHandle > -1 then addTab Property(winHandle).mainTab,tabName
tC = tabCount(Property(winHandle).mainTab)-1
Endfunction tC
function addPropertyItem(itemCaption as string,itemType,itemTab,winHandle)
Array insert at bottom PropertyItem()
Property(winHandle).Count = Property(winHandle).Count + 1
propItemCount = propItemCount + 1
propItemSelected = propItemCount
PropertyItem(propItemSelected).itemType = itemType
PropertyItem(propItemSelected).itemTab = itemTab
PropertyItem(propItemSelected).getTimer = -1
PropertyItem(propItemSelected).Parent = winHandle
itemCaption = " "+itemCaption
itemInTabcount = 0
for a = 0 to Property(winHandle).Count - 1
if PropertyItem(a).itemTab = itemTab then itemInTabCount = itemInTabCount + 1
next a
yPos = (itemInTabCount * 21)+29
NormL=createEdit(0,yPos,81,21,0,Property(winHandle).Window)
setGadgetText NormL,itemCaption
setReadOnly NormL,1
setGadgetColor NormL,rgb(236,233,216),0
NormR=createEdit(81,yPos,81,21,0,Property(winHandle).Window)
setReadOnly NormR,1
setGadgetColor NormR,rgb(236,233,216),rgb(0,0,128)
if itemType = _itemEdit
Handle=createEdit(81,yPos,81,21,0,Property(winHandle).Window)
setGadgetVisible Handle,0
endif
if itemType = _itemComboBox
Handle=createComboBox(81,yPos,81,21,Property(winHandle).Window)
setGadgetVisible Handle,0
endif
PropertyItem(propItemSelected).NormL = NormL
PropertyItem(propItemSelected).NormR = NormR
PropertyItem(propItemSelected).Handle = Handle
PropertyItem(propItemSelected).Top = yPos
sR = -20
for a = 0 to Property(propCount).Count - 1
if PropertyItem(a).itemTab = Property(propCount).tabSelected and PropertyItem(a).Parent = winHandle
sR = sR + 1
endif
next a
sR = sR
sTS = 2
setScrollBarRange Property(propCount).mainScroll,0,sR
setScrollBarThumbSize Property(propCount).mainScroll,sTS
If sTS > sR then setGadgetEnabled Property(propCount).mainScroll,0
If sTS < sR then setGadgetEnabled Property(propCount).mainScroll,1
`Default the first tab selected
setTabSelected(winHandle,0)
Endfunction Handle
function allowPropertyAlphaChar(handle,allowAlpha)
for a = 0 to propItemCount
if PropertyItem(a).Handle = handle
PropertyItem(a).allowAlpha = allowAlpha
endif
next a
Endfunction
function setTabSelected(window,tabSelected)
sR = -20
for a = 0 to propItemCount
if PropertyItem(a).Parent = window and PropertyItem(a).itemTab = tabSelected
pS = PropertyItem(a).Parent
setGadgetVisible PropertyItem(a).NormL,1
setGadgetVisible PropertyItem(a).NormR,1
Property(pS).tabSelected = tabSelected
` setGadgetVisible PropertyItem(a).Handle,1
endif
if PropertyItem(a).Parent = window and PropertyItem(a).itemTab <> tabSelected
setGadgetVisible PropertyItem(a).NormL,0
setGadgetVisible PropertyItem(a).NormR,0
setGadgetVisible PropertyItem(a).Handle,0
endif
if PropertyItem(a).itemTab = tabSelected and PropertyItem(a).Parent = window
sR = sR + 1
endif
next a
sR = sR
sTS = 2
setScrollBarRange Property(pS).mainScroll,0,sR
setScrollBarThumbSize Property(pS).mainScroll,sTS
If sTS > sR then setGadgetEnabled Property(pS).mainScroll,0
If sTS < sR then setGadgetEnabled Property(pS).mainScroll,1
for b = 0 to propItemCount
if PropertyItem(b).itemTab = Property(pS).tabSelected and pS = PropertyItem(b).Parent
positionGadget PropertyItem(b).Handle,gadgetX(PropertyItem(b).Handle),PropertyItem(b).Top
positionGadget PropertyItem(b).NormL,gadgetX(PropertyItem(b).NormL),PropertyItem(b).Top
positionGadget PropertyItem(b).NormR,gadgetX(PropertyItem(b).NormR),PropertyItem(b).Top
setGadgetVisible PropertyItem(b).NormL,1
setGadgetVisible PropertyItem(b).NormR,1
endif
next b
Property(pS).scrollPosition = getScrollBarPosition(Property(pS).mainScroll)
Endfunction
function addLabelToPropertyItem(hP,caption$)
pS = -1
For a = 0 to propItemCount
If PropertyItem(a).Handle = hP then pS = a
Next a
If pS > -1
x = gadgetX(PropertyItem(pS).NormL) + 5
y = gadgetY(PropertyItem(pS).NormL) - 10
tS = text size()
tF$ = text font$()
set text font "Arial"
set text size 15
caption$ = " " + caption$ + " "
wi = text width(caption$)
set text font tF$
set text size tS
font=createFont("Arial",9,0,0,0)
label = createLabel(x,y,wi,17,caption$,Property(0).Window):`Property(PropertyItem(pS).Parent).Window)
PropertyItem(pS).allowLabel = _TRUE
PropertyItem(pS).getTimer = 0
PropertyItem(pS).itemLabel = label
setGadgetColor label,rgb(250,250,160),0
applyFont label,font
setGadgetVisible label,0
resetMainWindow
Endif
Endfunction
function updateText(handle,strCaption$)
for a = 0 to propItemCount
if PropertyItem(a).Handle = handle then uH = a
next a
if PropertyItem(uH).allowAlpha = 0 and PropertyItem(uH).itemType = _itemEdit
l = len(strCaption$)
for a = 1 to l
for n = 0 to 9
if mid$(strCaption$,a) = str$(n) then newCaption$ = newCaption$ + str$(n)
next n
next a
if newCaption$ <> strCaption$ then message "Error - Text","Illegal character used"
strCaption$=newCaption$
endif
setGadgetText PropertyItem(uH).Handle,strCaption$
setGadgetText PropertyItem(uH).NormR,strCaption$
endfunction
function processPropertyEvents()
for a = 0 to propCount
for b = 0 to propItemCount
if PropertyItem(b).itemTab = Property(a).tabSelected and a = PropertyItem(b).Parent
if getScrollBarPosition(Property(a).mainScroll) <> Property(a).scrollPosition
nPY = getScrollBarPosition(Property(a).mainScroll)
positionGadget PropertyItem(b).Handle,gadgetX(PropertyItem(b).Handle),PropertyItem(b).Top-(21*nPY)
positionGadget PropertyItem(b).NormL,gadgetX(PropertyItem(b).NormL),PropertyItem(b).Top-(21*nPY)
positionGadget PropertyItem(b).NormR,gadgetX(PropertyItem(b).NormR),PropertyItem(b).Top-(21*nPY)
if PropertyItem(b).Top-(21*nPY) < 50
setGadgetVisible PropertyItem(b).NormL,0
setGadgetVisible PropertyItem(b).NormR,0
setGadgetVisible PropertyItem(b).Handle,0
else
if getGadgetVisible(PropertyItem(b).NormL) = 0
setGadgetVisible PropertyItem(b).NormL,1
setGadgetVisible PropertyItem(b).NormR,1
endif
endif
endif
if gadgetUnderMouse() = PropertyItem(b).NormL and PropertyItem(b).allowLabel = _TRUE
if PropertyItem(b).getTimer = 0
setGadgetTimer PropertyItem(b).itemLabel,1000
x = gadgetX(PropertyItem(b).NormL) + 5
y = gadgetY(PropertyItem(b).NormL) - 10
positionGadget PropertyItem(b).itemLabel,x,y
PropertyItem(b).getTimer = 1
endif
if PropertyItem(b).getTimer = 1
if eventType() = GADGET_TIMER
bringToFront PropertyItem(b).itemLabel
setGadgetVisible PropertyItem(b).itemLabel,1
endif
endif
else
if PropertyItem(b).allowLabel = _TRUE
setGadgetVisible PropertyItem(b).itemLabel,0
PropertyItem(b).getTimer = 0
endif
endif
endif
next b
if getScrollBarPosition(Property(a).mainScroll) <> Property(a).scrollPosition
Property(a).scrollPosition = getScrollBarPosition(Property(a).mainScroll)
endif
next a
if eventType()=MOUSE_CLICK
for a = 0 to propCount
if eventSource() = Property(a).mainTab then setTabSelected(a,selectedTab(Property(a).mainTab))
next a
for a = 0 to propItemCount
if eventSource() = PropertyItem(a).NormL or eventSource() = PropertyItem(a).NormR or eventSource() = PropertyItem(a).Handle
for b = 0 to propItemCount
if b <> a
if getGadgetVisible(PropertyItem(b).Handle) = 1
strCaption$ = getGadgetText(PropertyItem(b).Handle)
updateText(PropertyItem(b).Handle,strCaption$)
endif
sTab = PropertyItem(a).itemTab:`Property(PropertyItem(b).Parent).mainTab
iTab = PropertyItem(b).itemTab
if sTab = iTab and (PropertyItem(b).Parent = PropertyItem(a).Parent) then setGadgetVisible PropertyItem(b).NormR,1
if PropertyItem(b).Parent <> PropertyItem(a).Parent
sTab = selectedTab(Property(PropertyItem(b).Parent).mainTab)
iTab = PropertyItem(b).itemTab
if sTab = iTab then setGadgetVisible PropertyItem(b).NormR,1
endif
setGadgetVisible PropertyItem(b).Handle,0
endif
next b
if getGadgetVisible(PropertyItem(a).Handle) = 0
setGadgetVisible PropertyItem(a).NormR,0
setGadgetVisible PropertyItem(a).Handle,1
if propertyItem(a).itemType = _itemEdit
activateGadget PropertyItem(a).Handle
endif
endif
endif
next a
endif
if (eventType()=KEYDOWN) and (eventData()=13)
for a = 0 to propItemCount
if eventSource() = PropertyItem(a).Handle
strCaption$ = getGadgetText(PropertyItem(a).Handle)
updateText(PropertyItem(a).Handle,strCaption$)
endif
next a
endif
endfunction
Finally, below is a working example, you just need to change USERNAME and ID to the BlueGUI ID
#constant _itemEdit 0
#constant _itemComboBox 1
#constant _TRUE 1
#constant _FALSE 0
Type TProperty
window
tabSelected
propSelected
count
mainCombo
mainTab
mainScroll
allowScroll
scrollPosition
Endtype
Type TPropertyItem
top, left
NormL
NormR
Handle
itemType
itemTab
itemLabel
allowAlpha
allowLabel
getTimer
Parent
Endtype
startBlue "USER","ID"
#include "gui.dba"
set window on
dim Property() as TProperty
dim PropertyItem() as TPropertyItem
global propCount
global propItemCount
global propSelected
global tabProp
global tabEvents
global tabScripts
propCount = -1
propItemCount = -1
propSelected = -1
global winProperties
global tabProp
global tabEvents
global objName
global testType
global xPos
global yPos
global zPos
global otherTabEdit
winProperties = createProperty("Object Properties",0)
tabProp = addPropertyTab("Properties",winProperties)
tabEvents = addPropertyTab("Events",winProperties)
objName = addPropertyItem("Object Name",_itemEdit,tabProp,winProperties)
allowPropertyAlphaChar(objName,_TRUE)
addLabelToPropertyItem(objName,"Objects Name")
testType = addPropertyItem("testType",_itemComboBox,tabProp,winProperties)
addItem testType,"_True"
addItem testType,"_False"
addLabelToPropertyItem(testType,"Testing Type")
xPos = addPropertyItem("xPos",_itemEdit,tabProp,winProperties)
addLabelToPropertyItem(xPos, "X Position")
yPos = addPropertyItem("yPos",_itemEdit,tabProp,winProperties)
addLabelToPropertyItem(yPos, "Y Position")
zPos = addPropertyItem("zPos",_itemEdit,tabProp,winProperties)
addLabelToPropertyItem(zPos, "Z Position")
otherTabEdit = addPropertyItem("Editing",_itemEdit,tabEvents,winProperties)
do
getEvent
processEvents()
loop
function processEvents()
processPropertyEvents()
endfunction
function createProperty(winName as string, handleParent)
Array insert at bottom Property()
propCount = propCount + 1
propSelected = propCount
mainPropWin=createWindow(100,210,187,516,winName,WINDOW_FIXED,WINDOW_TOOLWINDOW,0,handleParent)
mainCombo=createComboBox(0,0,161,21,mainPropWin)
mainTab=createTabs(0,24,163,27,mainPropWin)
mainScroll=createScrollbar(gadgetWidth(mainPropWin)-25,0,18,gadgetHeight(mainPropWin)-25,1,mainPropWin)
setGadgetEnabled mainScroll,0
Property(propCount).Window = mainPropWin
Property(propCount).mainCombo = mainCombo
Property(propCount).mainTab = mainTab
Property(propCount).mainScroll = mainScroll
Endfunction propSelected
function addPropertyTab(tabName as string,winHandle)
If winHandle > -1 then addTab Property(winHandle).mainTab,tabName
tC = tabCount(Property(winHandle).mainTab)-1
Endfunction tC
function addPropertyItem(itemCaption as string,itemType,itemTab,winHandle)
Array insert at bottom PropertyItem()
Property(winHandle).Count = Property(winHandle).Count + 1
propItemCount = propItemCount + 1
propItemSelected = propItemCount
PropertyItem(propItemSelected).itemType = itemType
PropertyItem(propItemSelected).itemTab = itemTab
PropertyItem(propItemSelected).getTimer = -1
PropertyItem(propItemSelected).Parent = winHandle
itemCaption = " "+itemCaption
itemInTabcount = 0
for a = 0 to Property(winHandle).Count - 1
if PropertyItem(a).itemTab = itemTab then itemInTabCount = itemInTabCount + 1
next a
yPos = (itemInTabCount * 21)+29
NormL=createEdit(0,yPos,81,21,0,Property(winHandle).Window)
setGadgetText NormL,itemCaption
setReadOnly NormL,1
setGadgetColor NormL,rgb(236,233,216),0
NormR=createEdit(81,yPos,81,21,0,Property(winHandle).Window)
setReadOnly NormR,1
setGadgetColor NormR,rgb(236,233,216),rgb(0,0,128)
if itemType = _itemEdit
Handle=createEdit(81,yPos,81,21,0,Property(winHandle).Window)
setGadgetVisible Handle,0
endif
if itemType = _itemComboBox
Handle=createComboBox(81,yPos,81,21,Property(winHandle).Window)
setGadgetVisible Handle,0
endif
PropertyItem(propItemSelected).NormL = NormL
PropertyItem(propItemSelected).NormR = NormR
PropertyItem(propItemSelected).Handle = Handle
PropertyItem(propItemSelected).Top = yPos
sR = -20
for a = 0 to Property(propCount).Count - 1
if PropertyItem(a).itemTab = Property(propCount).tabSelected and PropertyItem(a).Parent = winHandle
sR = sR + 1
endif
next a
sR = sR
sTS = 2
setScrollBarRange Property(propCount).mainScroll,0,sR
setScrollBarThumbSize Property(propCount).mainScroll,sTS
If sTS > sR then setGadgetEnabled Property(propCount).mainScroll,0
If sTS < sR then setGadgetEnabled Property(propCount).mainScroll,1
`Default the first tab selected
setTabSelected(winHandle,0)
Endfunction Handle
function allowPropertyAlphaChar(handle,allowAlpha)
for a = 0 to propItemCount
if PropertyItem(a).Handle = handle
PropertyItem(a).allowAlpha = allowAlpha
endif
next a
Endfunction
function setTabSelected(window,tabSelected)
sR = -20
for a = 0 to propItemCount
if PropertyItem(a).Parent = window and PropertyItem(a).itemTab = tabSelected
pS = PropertyItem(a).Parent
setGadgetVisible PropertyItem(a).NormL,1
setGadgetVisible PropertyItem(a).NormR,1
Property(pS).tabSelected = tabSelected
` setGadgetVisible PropertyItem(a).Handle,1
endif
if PropertyItem(a).Parent = window and PropertyItem(a).itemTab <> tabSelected
setGadgetVisible PropertyItem(a).NormL,0
setGadgetVisible PropertyItem(a).NormR,0
setGadgetVisible PropertyItem(a).Handle,0
endif
if PropertyItem(a).itemTab = tabSelected and PropertyItem(a).Parent = window
sR = sR + 1
endif
next a
sR = sR
sTS = 2
setScrollBarRange Property(pS).mainScroll,0,sR
setScrollBarThumbSize Property(pS).mainScroll,sTS
If sTS > sR then setGadgetEnabled Property(pS).mainScroll,0
If sTS < sR then setGadgetEnabled Property(pS).mainScroll,1
for b = 0 to propItemCount
if PropertyItem(b).itemTab = Property(pS).tabSelected and pS = PropertyItem(b).Parent
positionGadget PropertyItem(b).Handle,gadgetX(PropertyItem(b).Handle),PropertyItem(b).Top
positionGadget PropertyItem(b).NormL,gadgetX(PropertyItem(b).NormL),PropertyItem(b).Top
positionGadget PropertyItem(b).NormR,gadgetX(PropertyItem(b).NormR),PropertyItem(b).Top
setGadgetVisible PropertyItem(b).NormL,1
setGadgetVisible PropertyItem(b).NormR,1
endif
next b
Property(pS).scrollPosition = getScrollBarPosition(Property(pS).mainScroll)
Endfunction
function addLabelToPropertyItem(hP,caption$)
pS = -1
For a = 0 to propItemCount
If PropertyItem(a).Handle = hP then pS = a
Next a
If pS > -1
x = gadgetX(PropertyItem(pS).NormL) + 5
y = gadgetY(PropertyItem(pS).NormL) - 10
tS = text size()
tF$ = text font$()
set text font "Arial"
set text size 15
caption$ = " " + caption$ + " "
wi = text width(caption$)
set text font tF$
set text size tS
font=createFont("Arial",9,0,0,0)
label = createLabel(x,y,wi,17,caption$,Property(0).Window):`Property(PropertyItem(pS).Parent).Window)
PropertyItem(pS).allowLabel = _TRUE
PropertyItem(pS).getTimer = 0
PropertyItem(pS).itemLabel = label
setGadgetColor label,rgb(250,250,160),0
applyFont label,font
setGadgetVisible label,0
resetMainWindow
Endif
Endfunction
function updateText(handle,strCaption$)
for a = 0 to propItemCount
if PropertyItem(a).Handle = handle then uH = a
next a
if PropertyItem(uH).allowAlpha = 0 and PropertyItem(uH).itemType = _itemEdit
l = len(strCaption$)
for a = 1 to l
for n = 0 to 9
if mid$(strCaption$,a) = str$(n) then newCaption$ = newCaption$ + str$(n)
next n
next a
if newCaption$ <> strCaption$ then message "Error - Text","Illegal character used"
strCaption$=newCaption$
endif
setGadgetText PropertyItem(uH).Handle,strCaption$
setGadgetText PropertyItem(uH).NormR,strCaption$
endfunction
function processPropertyEvents()
for a = 0 to propCount
for b = 0 to propItemCount
if PropertyItem(b).itemTab = Property(a).tabSelected and a = PropertyItem(b).Parent
if getScrollBarPosition(Property(a).mainScroll) <> Property(a).scrollPosition
nPY = getScrollBarPosition(Property(a).mainScroll)
positionGadget PropertyItem(b).Handle,gadgetX(PropertyItem(b).Handle),PropertyItem(b).Top-(21*nPY)
positionGadget PropertyItem(b).NormL,gadgetX(PropertyItem(b).NormL),PropertyItem(b).Top-(21*nPY)
positionGadget PropertyItem(b).NormR,gadgetX(PropertyItem(b).NormR),PropertyItem(b).Top-(21*nPY)
if PropertyItem(b).Top-(21*nPY) < 50
setGadgetVisible PropertyItem(b).NormL,0
setGadgetVisible PropertyItem(b).NormR,0
setGadgetVisible PropertyItem(b).Handle,0
else
if getGadgetVisible(PropertyItem(b).NormL) = 0
setGadgetVisible PropertyItem(b).NormL,1
setGadgetVisible PropertyItem(b).NormR,1
endif
endif
endif
if gadgetUnderMouse() = PropertyItem(b).NormL and PropertyItem(b).allowLabel = _TRUE
if PropertyItem(b).getTimer = 0
setGadgetTimer PropertyItem(b).itemLabel,1000
x = gadgetX(PropertyItem(b).NormL) + 5
y = gadgetY(PropertyItem(b).NormL) - 10
positionGadget PropertyItem(b).itemLabel,x,y
PropertyItem(b).getTimer = 1
endif
if PropertyItem(b).getTimer = 1
if eventType() = GADGET_TIMER
bringToFront PropertyItem(b).itemLabel
setGadgetVisible PropertyItem(b).itemLabel,1
endif
endif
else
if PropertyItem(b).allowLabel = _TRUE
setGadgetVisible PropertyItem(b).itemLabel,0
PropertyItem(b).getTimer = 0
endif
endif
endif
next b
if getScrollBarPosition(Property(a).mainScroll) <> Property(a).scrollPosition
Property(a).scrollPosition = getScrollBarPosition(Property(a).mainScroll)
endif
next a
if eventType()=MOUSE_CLICK
for a = 0 to propCount
if eventSource() = Property(a).mainTab then setTabSelected(a,selectedTab(Property(a).mainTab))
next a
for a = 0 to propItemCount
if eventSource() = PropertyItem(a).NormL or eventSource() = PropertyItem(a).NormR or eventSource() = PropertyItem(a).Handle
for b = 0 to propItemCount
if b <> a
if getGadgetVisible(PropertyItem(b).Handle) = 1
strCaption$ = getGadgetText(PropertyItem(b).Handle)
updateText(PropertyItem(b).Handle,strCaption$)
endif
sTab = PropertyItem(a).itemTab:`Property(PropertyItem(b).Parent).mainTab
iTab = PropertyItem(b).itemTab
if sTab = iTab and (PropertyItem(b).Parent = PropertyItem(a).Parent) then setGadgetVisible PropertyItem(b).NormR,1
if PropertyItem(b).Parent <> PropertyItem(a).Parent
sTab = selectedTab(Property(PropertyItem(b).Parent).mainTab)
iTab = PropertyItem(b).itemTab
if sTab = iTab then setGadgetVisible PropertyItem(b).NormR,1
endif
setGadgetVisible PropertyItem(b).Handle,0
endif
next b
if getGadgetVisible(PropertyItem(a).Handle) = 0
setGadgetVisible PropertyItem(a).NormR,0
setGadgetVisible PropertyItem(a).Handle,1
if propertyItem(a).itemType = _itemEdit
activateGadget PropertyItem(a).Handle
endif
endif
endif
next a
endif
if (eventType()=KEYDOWN) and (eventData()=13)
for a = 0 to propItemCount
if eventSource() = PropertyItem(a).Handle
strCaption$ = getGadgetText(PropertyItem(a).Handle)
updateText(PropertyItem(a).Handle,strCaption$)
endif
next a
endif
endfunction
[edit]
You will need to attach the processPropertyEvents() in the processEvents() section of your code.
It will not control the combobox where you can add items/gadgets/objects, this will have to be done yourself. The functions purely control the window and events of the window
[edit]
Attached is an image of the working example - which looks best when you attach the XP .exe.manisfest file
Hello!