Auto resizeable textarea inside tabber

BlitzMax Forums/MaxGUI Module/Auto resizeable textarea inside tabber

Htbaa(Posted 2010) [#1]
Aaargh, I'm about to pull out all of my hair! No matter what alignment settings I use for SetGadgetLayout() I'm unable to make a textarea inside a tabber auto resize to the size of the tabber. I'm using BlitzMax 1.37 and MaxGUI 1.36 (recompiled with bmx 1.37).

It must be something really stupid but I can't figure it out. When not inside a tabber it works fine.

Here's the code. (*** about to become mental ***)

'Source Code created on 23 Jan 2010 00:16:17 with Logic Gui Version 5.1 Build 422
'John Doe
'Start of external Header File
SuperStrict

Import MaxGui.Drivers

'?Not win32			'Uncomment (3-lines) when using multiple canvases and BMax 1.32b and up
'GLShareContexts
'?

'End Of external Header File





Local Window1:TGadget = CreateWindow("Window1",604,138,456,436,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE |WINDOW_STATUS |WINDOW_CENTER)
	SetGadgetLayout( Window1,EDGE_ALIGNED,EDGE_RELATIVE,EDGE_ALIGNED,EDGE_RELATIVE )
	Local Tabber1:TGadget = CreateTabber(0,0,448,382,Window1,Null)
		SetGadgetLayout( Tabber1,EDGE_ALIGNED,EDGE_RELATIVE,EDGE_ALIGNED,EDGE_RELATIVE )
		Local Tabber1_Tab1:TGadget = CreatePanel( 0,0,ClientWidth(Tabber1),ClientHeight(Tabber1),Tabber1 )
		AddGadgetItem( Tabber1,"Tabber1" )
		Tabber1.items[0].extra = Tabber1_Tab1
			Local TextArea3:TGadget = CreateTextArea(0,0,444,360,Tabber1_Tab1,Null)
				SetGadgetLayout( TextArea3,EDGE_ALIGNED,EDGE_RELATIVE,EDGE_ALIGNED,EDGE_RELATIVE )
				SetTextAreaText( TextArea3 , "TextArea3" )

Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			Select EventSource()
				Case Window1	Window1_WC( Window1 )
			End Select

		Case EVENT_GADGETACTION
			Select EventSource()
				Case Tabber1	Tabber1_GA( Tabber1 , EventData() )
				Case TextArea3	TextArea3_GA( TextArea3 )
			End Select

	End Select
Forever

Function Window1_WC( Window:TGadget )
	DebugLog "Window Window1 wants to be closed"

	End
End Function

Function Tabber1_GA( Tabber:TGadget , Number:Int )
	DebugLog "Tabber Tabber1 selected Tab " + Number
	For Local i:Int = 0 To Tabber.items.length -1
		HideGadget( TGadget( Tabber.items[i].extra ) )
	Next
	ShowGadget( TGadget( Tabber.items[Number].extra ) )
	
End Function

Function TextArea3_GA( TextArea:TGadget )
	DebugLog "TextArea TextArea3 was modified"
	
End Function



DaveK(Posted 2010) [#2]
Tabber1_Tab1 on line 22 has no layout set.


Htbaa(Posted 2010) [#3]
Ah yes that seemed to be the trick. LogicGUI only seems to call SetGadgetLayout() when I set the tabs in the Items section.


jsp(Posted 2010) [#4]
Hi,
May I explain why this happens:
There are two modes of operations with tabbers, managed and unmanged.
As you already realized Logic Gui only manage your tabber when you define any tab.
If there is not even one tab defined then Logic Gui assumes that you want only the tabber container and handle all additional stuff dynamically via your code.
Thus it is possible to have both ways of working, the normal managed way where all tabs are switched, resized as needed and the unmanaged way, were you only detect the events of any tab you added by code. This is sometimes useful when you don’t want to switch any content, but add additional stuff dynamically.


Htbaa(Posted 2010) [#5]
Ah well, makes sense to me :-).


jsp(Posted 2010) [#6]
I added now a red warning label on the general settings as a reminder. Hope that helps (and there is some hair left:).


Htbaa(Posted 2010) [#7]
Well my head is already shaved :-). I really ought to do more with BlitzMax and MaxGUI. Simple things I should know... just gone! :P