🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.windows.ms.programmer
3 messages
3 total messages Started by Nick de Kock Thu, 13 Aug 1992 07:43
Disabling Autoradiobuttons at run time - TPW
#467
Author: Nick de Kock
Date: Thu, 13 Aug 1992 07:43
25 lines
1337 bytes
I have an application in which I require the selection of 1 out of 
a series of options. Depending on certain conditions some of these
options are unavailable at certain times. I need to disable certain
of the buttons. I tried to do it like this but it didn't work for
some reason:
.
procedure DisableButton(HDlg: HWnd; ButtonID: word);

var Stylebits: Word;
    HControl: Word;
begin
  HControl := GetDlgItem(HDlg, ButtonID);
  Stylebits := GetClassWord(HControl, gcw_Style);
  SetClassWord(HControl, gcw_Style, Stylebits or ws_Disabled)
end;

I call this during the dialog's SetUpWindow method but the buttons stay
enabled. Any idea what I'm doing wrong?
      
    
-- 
Nick de Kock, High Voltage Group        | Internet dekock@odie.ee.wits.ac.za    
Electrical Engineering, Wits University |                 or
Johannesburg, South Africa              |      dekock@shannon.ee.wits.ac.za
....Another Churchill quote pending...........
Re: Disabling Autoradiobuttons at run time - TPW
#468
Author: Chris King
Date: Thu, 13 Aug 1992 15:37
20 lines
1414 bytes
In article <dekock.713691787@shannon>, dekock@shannon.ee.wits.ac.za (Nick de Kock) writes...
>I have an application in which I require the selection of 1 out of 
>a series of options. Depending on certain conditions some of these
>options are unavailable at certain times. I need to disable certain
>of the buttons. 

What you can do is set a boolean that refers to the status of the button,
and in your methods that are called when you press that button, place a
line like 

   if buttondisabled then exit;

I know this works, since I use it.  There are also ways of destroying the
button (since it is after all just another window) or hiding it, you may
even be able to dynamically change it's ID and that would disable it's
associated methods, then change it back when you need it again. 

I use the rather brutal approach of a boolean.

Chris King
Re: Disabling Autoradiobuttons at run time - TPW
#469
Author: Richard Martin
Date: Thu, 13 Aug 1992 16:15
9 lines
958 bytes
I think you're doing work in TPW, in which case it's quite
easy (I think) to just call the ancestor Show member.
I had a program where if you pressed a button at a certain
time, the entire system would hang.  (Don't ask me, ask MS)
I found it possible to hide the button entirely, making
this portion little-sister-proof.
I test everything on my little sister.  If she can't break
it, nothing can.
Richard.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads