largo_winch
13-10-2011, 16:21
hello. does anybody has experience with creation of docking windows (multiple dialogs) with ui module? bye, largo
Hi
if you means multiple forms look "opening 2 forms" here :
http://www.thinbasic.com/community/showthread.php?11026-opening-2-forms
with 3 examples from Petr
largo_winch
13-10-2011, 19:35
no, thanks, zak, that's another thingy more like a dialog you can move over existing window (dialog) and place it to another point or dock it outside main dialog. see my pictures and example (zip file).
bye, largo
ErosOlmi
13-10-2011, 21:27
I someone would like to experiment, here attached PowerBasic source code of largo example
largo_winch
17-10-2011, 16:04
hello. I will check to find a solution for a possible docking window with thinbasic, but I need help.
1) Anybody can check this code and fix my problem with these both lines ?
'--------------------> NOT OK ------------->
.names = "Window_" +.id '
.caption = "Window_" +.id
'--------------------> NOT OK ------------->
whole code example part:
' Empty GUI script created on 10-17-2011 15:51:22 by (ThinAIR)
Uses "UI", "console", "LL"
Begin Const
%styLine = 3000
%styImage
End Const
Type tGui
lWindow As Long
WindowCount As Long
hWnd As DWord
cWidth As Double
cHeight As Double
End Type
Type tWindow
id As Long
lControl As Long
ControlCount As Long
active As Long
visible As Long
style As Long
xPos As Long
yPos As Long
Width As Long
Height As Long
scale As Double
names As String * 255
caption As String * 255
End Type
Dim tmpWindow As tWindow Ptr
Dim Gui As TGui
Function TBMain() As Long
Local win( 2 ) As Long
win(2) = GUI_AddWindow( 20, 20, 220, 120, %TRUE, %TRUE )
End Function
Function GUI_AddWindow( iXPos As Long, iYPos As Long, iWidth As Long, iHeight As Long, iActive As Long, iVisible As Long ) As Long
Static winIDCount As Long
Local s As String
tmpWindow = HEAP_Alloc( SizeOf( tWindow ))
winIDCount += 1
With tmpWindow
.id = winIDCount
.lControl = LL_Add( tmpWindow.lControl, "0", "0" )
.ControlCount = 0
.active = iActive
.visible = iVisible
.style = %styLine
.xPos = iXPos
.yPos = iYPos
.Width = iWidth
.Height = iHeight
.scale = 1.0
'--------------------> NOT OK ------------->
.names = "Window_" +.id '
.caption = "Window_" +.id
'--------------------> NOT OK ------------->
End With
With Gui
.lWindow = LL_Add( Gui.lWindow, Str$( tmpWindow.id ), VarPtr( tmpWindow ))
.WindowCount += 1
End With
Return tmpWindow.id
End Function
MsgBox 0, "script example ok here?"
2) here I send a longer code example where the problem zones are "deactivated" ;)
' Empty GUI script created on 10-17-2011 15:51:22 by largo_winch (ThinAIR)
Uses "UI", "console", "LL"
Begin Const
%styLine = 3000
%styImage
%ButtonClose
%ButtonZero
%ctrFrame
End Const
Type tControl
id As Long
Controltype As Long
active As Long
visible As Long
lEvent As Long
eventCount As Long
fontID As Long
data As Long
style As Long
xPos As Long
yPos As Long
Width As Long
Height As Long
scale As Double
names As String * 255
caption As String * 255
End Type
Type tGui
lWindow As Long
WindowCount As Long
hWnd As DWord
cWidth As Double
cHeight As Double
End Type
Type tWindow
id As Long
lControl As Long
ControlCount As Long
active As Long
visible As Long
style As Long
xPos As Long
yPos As Long
Width As Long
Height As Long
scale As Double
names As String * 255
caption As String * 255
End Type
Dim tmpWindow As tWindow Ptr
Dim Gui As TGui
Dim hDlg As DWord
Dim iWindow As Long
Dim tmpControl As tControl Ptr
Type UI_DOCKINFOSTRUCT
l As String
sl As String
x As Long
y As Long
cx As Long
cy As Long
End Type
Global g_tDockInfo As UI_DOCKINFOSTRUCT
Global g_hTreeView As Long
Global g_hDockC As Long
Global g_hDockP As Long
Global g_Location As Long
Declare Function ReleaseCapture Lib "USER32.DLL" Alias "ReleaseCapture" () As Long
Declare Sub DragAcceptFiles Lib "SHELL32.DLL" Alias "DragAcceptFiles" (ByVal hwnd As DWord, ByVal fAccept As Long)
Declare Sub DragFinish Lib "SHELL32.DLL" Alias "DragFinish" (ByVal hDrop As DWord)
'-------------------------> MAIN APP ---------------------------------->
Function TBMain() As Long
Local win( 2 ) As Long
Local cont As Long
Dialog New 0, "myTest_docking_Zero",-1,-1, 330, 203, _
%WS_POPUP Or _
%WS_VISIBLE Or _
%WS_CLIPCHILDREN Or _
%WS_CAPTION Or _
%WS_SYSMENU Or _
%WS_MINIMIZEBOX, _
0 To hDlg
win(1) = GUI_AddWindow( 20, 20, 220, 120, %TRUE, %TRUE )
cont = GUI_AddFrame( win( 1 ), 5, 30, 210, 80 )
Control Add Button, hDlg, %ButtonClose, "Click to kill", 90, 50, 75, 50
Control Add Button, hDlg, %ButtonZero, "nothing", 90, 140, 75, 50
Dialog Show Modal hDlg Call cbDialog
End Function
Function GUI_AddWindow( iXPos As Long, iYPos As Long, iWidth As Long, iHeight As Long, iActive As Long, iVisible As Long ) As Long
Static winIDCount As Long
Local s As String
tmpWindow = HEAP_Alloc( SizeOf( tWindow ))
winIDCount += 1
With tmpWindow
.id = winIDCount
.lControl = LL_Add( tmpWindow.lControl, "0", "0" )
.ControlCount = 0
.active = iActive
.visible = iVisible
.style = %styLine
.xPos = iXPos
.yPos = iYPos
.Width = iWidth
.Height = iHeight
.scale = 1.0
'--------------------> NOT OK ------------->
'.names = "Window_" +.id '
'.caption = "Window_" +.id
'--------------------> NOT OK ------------->
End With
With Gui
.lWindow = LL_Add( Gui.lWindow, Str$( tmpWindow.id ), VarPtr( tmpWindow ))
.WindowCount += 1
End With
Return tmpWindow.id
End Function
MsgBox 0, "script example ok here?"
CallBack Function cbDialog() As Long
Select Case CBMSG
Case %WM_COMMAND
If CBWPARAM = %ButtonClose Then Dialog End CBHNDL
If CBWPARAM = %ButtonZero Then
MsgBox 0, "something for other things"
End If
Case %WM_DESTROY
MsgBox 0, "Window is to be destroyed."
End Select
End Function
Function GUI_AddFrame( WindowID As Long, iXPos As Double, iYPos As Double, iWidth As Double, iHeight As Double ) As Long
Static ctrlIDCount As Long
iWindow = LL_FindByName( Gui.lWindow, Str$( WindowID ))
If iWindow <> 0 Then
SetAt( tmpWindow, LL_Data( iWindow ))
tmpControl = HEAP_Alloc( SizeOf( tControl ))
ctrlIDCount += 1
With tmpControl
.id = ctrlIDCount
.Controltype = %ctrFrame
.active = %TRUE
.visible = %TRUE
.lEvent = LL_Add( tmpControl.lEvent, "<>", "<>" )
.eventCount = 0
.fontID = 0
.data = 0
.style = %styLine
.xPos = iXPos + tmpWindow.xPos
.yPos = iYPos + tmpWindow.yPos
.Width = iWidth
.Height = iHeight
.scale = 1.0
'.names = "Frame_" +.id
'.caption = "Frame_" +.id
End With
With tmpWindow
.lControl = LL_Add( tmpWindow.lControl, Str$( tmpControl.id ), VarPtr( tmpControl ))
.ControlCount += 1
End With
Return tmpControl.id
Else
Return %FALSE
End If
End Function
'*---------------------------------------------------------*
you find the last code example as attachement.
bye, largo
largo_winch
18-10-2011, 07:45
repeat: Can I get any help or hints for problem about these two coding lines in ui example ? :) I am sure there is a chance to solve it, isn't it? or may be it's a bug in current thinbasic issue for with... end with udt style?
'--------------------> NOT OK ------------->
.names = "Window_" +.id '
.caption = "Window_" +.id
'--------------------> NOT OK ------------->
this code example snippet works
'---Up to 25 nested WITH levels
With x
.a = 10
With y
.a = 1
.b = 2
.s = "This is Y"
End With
.b = 20
.s = "This is X"
End With
bye, largo
ErosOlmi
18-10-2011, 08:04
Can you please put a space between + sign and . sign
Let me know
largo_winch
18-10-2011, 08:41
funny thing! the example works with elder thinbasic issue 1.8.6.0 like the attached script example I have tested without problem. but not with current thinbasic version.
my error message I add too.
I am thinking the problem is a) concerning to "LL" module or b) "with... end with" udt style.
be sure, I've tested several ways for running the script example with "spaces" and much more ;)
thanks for reply eros, bye, largo
ErosOlmi
18-10-2011, 08:52
I'm on travel for a meeting all the day (I'm posting from iPhone)
I will check this evening
Petr Schreiber
18-10-2011, 12:09
I think I found the reason of the problem, please see here:
http://www.thinbasic.com/community/project.php?issueid=321
Petr
ErosOlmi
18-10-2011, 15:01
So, this is an ancient problem I think.
Please be a little patient and I will try to fix as soon as possible.
In the meantime try to construct a temp string and than assign it in one go without string operations taking place inside with/and with.
Sorry