>After setting visible, try calling
>Application.ProcessMessages;
>A quick review of your source didn't reveal if your program stops and
>waites for user input (default ProcessMessage time).
>ProcessMessages passes program control to built-in message processing,
>so that it can process messages in the queue. After setting visible =
>false or true, your program sends itself mesages to redraw the label.
>If your program never takes a moment to handel messages in queue, it
>not ever get a chance to draw or hide yor labels.
>Windows may also think that your program is "Not Responding" because
>it will ignore messages from the OS as well.
>je...@my-dejanews.com wrote:
>> I have a section of code in a Delphi app that at certain points needs to
>> make a couple of label's appear or disappear. Unfortunately despite the
>> fact that Delphi seems quite happy to step through the command, it
doesn't
>> seem to be executing it, or rather it's execution isn't doing anything.
>> I am at a total loss as to why this isn't happening. I am using Delphi 1
>> (yeah I know but it has to be a 16bit app), although when I load the
source
>> in Delphi 3 the same happens.
>> I have included the unit source below. The problem in question resides in
>> TExpForm.FormKeyPress procedure.
>> Any help would be gratefully received, as this has me lost :/
>> Edward
>> ---
>> unit Hemis;
>> interface
>> uses
>> SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
>> Forms, Dialogs, StdCtrls, WinHRT;
>> type
>> TExpForm = class(TForm)
>> FixPoint: TLabel;
>> PressSPLabel: TLabel;
>> LeftWordLabel: TLabel;
>> RightWordLabel: TLabel;
>> procedure FormCreate(Sender: TObject);
>> procedure FormKeyPress(Sender: TObject; var Key: Char);
>> private
>> public
>> end;
>> type
>> WordRecord = Record
>> word: string[6];
>> index: word;
>> left_of_center: BOOLEAN;
>> end;
>> var
>> ExpForm: TExpForm;
>> word_array: array [1..88] of WordRecord;
>> swap_record: WordRecord;
>> word_file: text;
>> count, countb: shortint;
>> delay: word;
>> implementation
>> {$R *.DFM}
>> procedure TExpForm.FormCreate(Sender: TObject);
>> begin
>> FixPoint.Top:=(ClientHeight div 2)-(FixPoint.Height div 2);
>> FixPoint.Left:=(ClientWidth div 2)-(FixPoint.Width div 2);
>> PressSPLabel.Top:=ClientHeight-(ClientHeight div 5);
>> PressSPLabel.Left:=(ClientWidth div 2)-(PressSPLabel.Width div 2);
>> LeftWordLabel.Top:=FixPoint.Top+5;
>> RightWordLabel.Top:=FixPoint.Top+5;
>> LeftWordLabel.Left:=Fixpoint.Left-LeftWordLabel.Width-20;
>> RightWordLabel.Left:=Fixpoint.Left+FixPoint.Width+20;
>> end;
>> procedure TExpForm.FormKeyPress(Sender: TObject; var Key: Char);
>> begin
>> if (Ord(Key)=32) then
>> begin
>> PressSPLabel.Visible:=FALSE;
>> for count:=1 to 8 do
>> begin
>> if (word_array[count].left_of_center) then
>> begin
>> LeftWordLabel.Caption:=word_array[count].word;
>> LeftWordLabel.Visible:=TRUE;
>> hrt_delay_do(delay);
>> LeftWordLabel.Visible:=FALSE;
>> end
>> else
>> begin
>> RightWordLabel.Caption:=word_array[count].word;
>> RightWordLabel.Visible:=TRUE;
>> hrt_delay_do(delay);
>> RightWordLabel.Visible:=FALSE;
>> end;
>> end;
>> end;
>> end;
>> initialization
>> { Read in words from word file, assign word for left or right
presentation
>> puts words 8-88 in random order, initialise delay }
>> begin
>> Randomize;
>> AssignFile(word_file,'words.dat');
>> FileMode:=0;
>> Reset(word_file);
>> for count:=1 to 88 do
>> begin
>> Readln(word_file,word_array[count].word);
>> word_array[count].index:=random(65535);
>> if (count mod 2 = 0) then
>> word_array[count].left_of_center:=TRUE
>> else
>> word_array[count].left_of_center:=FALSE;
>> end;
>> CloseFile(word_file);
>> for count:=1 to 79 do
>> for countb:=1 to 80-count do
>> if (word_array[countb+9].index > word_array[countb+8].index) then
>> begin
>> swap_record.word:=word_array[countb+9].word;
>> swap_record.index:=word_array[countb+9].index;
>> word_array[countb+9].word:=word_array[countb+8].word;
>> word_array[countb+9].index:=word_array[countb+8].index;
>> word_array[countb+8].word:=swap_record.word;
>> word_array[countb+8].index:=swap_record.index;
>> end;
>> delay:=hrt_delay_alloc(140,HRT_MILLISECOND);
>> end;
>> end.
>> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
>> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>--
>joebrown
>@leading.net