refreshing window not working

BlitzPlus Forums/BlitzPlus Beginners Area/refreshing window not working

PaulJG(Posted 2005) [#1]
Little help please guys..

I've got 2 windows on my app, both open at the same time
A main window and a tools window.

I want the tools window setup with a textarea that can be cut and pasted to, heres the code I'm using to setup the second window:
Global wordbankwin=CreateWindow("Word Bank",win(2)\x,win(2)\y,250,565,0,19) 
Global wordbank=CreateTextArea(0,0,250,565,wordbankwin,0)

I want the textarea to resize with the window..
If EventID()=$802 Then
		
		If EventSource()=wordbankwin Then
			
			SetGadgetShape wordbank,0,0,GadgetWidth(wordbankwin),GadgetHeight(wordbankwin)
				
		EndIf


The code works, but I lose sight of the text that was already on the window before its resized. It's still there, but its not showing - I think its a refresh problem.

If I highlight the existing white area - where the text was - it will be displayed again.

I've tried using UPDATEWINDOW and FLIP - makes no difference, and I cant use the FLIPCANVAS command because it isnt a canvas.


WolRon(Posted 2005) [#2]
Sounds like you have another gadget overlapping your textarea. Find out which one.


CoderX(Posted 2005) [#3]
Use SetGadgetLayout to lock the edges of the TextArea gadget to the tool window.

That way when the tool window is resized, the TextArea is automatically resized without having to handle the $802 event.

Here's some code:
Global wordbankwin=CreateWindow("Word Bank",200,200,250,565,0,19) 
Global wordbank=CreateTextArea(0,0,250,565,wordbankwin,0)

;Lock the edges of the text area gadget to the edges of the window
SetGadgetLayout wordbank, 1, 1, 1, 1

Repeat

	If WaitEvent() = $803 Then Exit
		
Forever
- Nick


PaulJG(Posted 2005) [#4]
great. :)