Page 1 of 2

Display an inactive checkbox group?

Posted: Thu Mar 21, 2013 4:23 am
by CalScot
Is there a way to display -- but not activate (i.e., make it gray and not checkable) -- a checkbox group until a radio button is selected to make it active? Then deactivate it (but still display it) if the associated radio button is deselected? I just can’t seem to find a way to do it.
Thanks!

Re: Display an inactive checkbox group?

Posted: Thu Mar 21, 2013 5:08 am
by Rathinagiri
Yes you can do that.

Please use

form_name.control_name.enabled := .f.

Re: Display an inactive checkbox group?

Posted: Thu Mar 21, 2013 6:31 am
by CalScot
I will give that a try.
(I'd never have found that without your help!)
Thank you!!

Re: Display an inactive checkbox group?

Posted: Thu Mar 21, 2013 9:08 pm
by CalScot
Hi.
I must be doing something wrong: I've tried using <form_name>.<control_name).enabled := .F. as suggested, but just can't get it to work.
I've tested putting it in .fmg files and in calling .prgs, but I always get one of two things: Either I get a build error (from trying things that even I knew were bad, in attempts to figure it out), or it gets accepted but makes no difference to the checkbox status.
Does it work in combination with some other command or parameter, or must it be in a particular location in a file (First command? Last command? Immediately before or after some other command?) or maybe there's some other tip/technique or something else that I'm missing?
Thanks.

Re: Display an inactive checkbox group?

Posted: Thu Mar 21, 2013 9:16 pm
by Leopoldo Blancas
Hola.. para poderte ayudar tendrás que subir tu aplicación o parte de ella, algo mínimo completo para que podamos compilar y checar tu aplicación. De otra manera es difícil.

Saludos
Polo
*--------------------------------------------------------------------------------------------------------------
Hello .. to help you as you will have to upload your application or part of it, something full minimum so we can compile and check your application. Otherwise it is difficult.

regards
Polo

Re: Display an inactive checkbox group?

Posted: Thu Mar 21, 2013 11:02 pm
by CalScot
Thank you, Leopoldo. Your help is really appreciated.
Text file of combined .prg and .fmg files for "LTest" is attached, as requested.
I'm thinking, now, that there's another parameter - somewhere - that needs to be set (maybe similar to the problem of 3.1.1 (which is what I'm using) not showing data in a browse box?).
Thanks again.

But... I tried uploading the file with a .prg extension - "Not allowed". So I tried .txt - "Not allowed". No extension - "Not allowed". (Seems like everything I try today is not allowed!!)
Only thing I can think of is to cut and paste the code into the body of this message, so here goes:

* Main.prg - LTest
* ----------------
#include <hmg.ch>

Function Main

Declare Window Main
Load Window Main
Main.Center
Main.Activate

main.check_1.enabled := .F.
Main.Check_2.enabled := .F.

Return


* Main.fmg - LTest
* ----------------
* HMG-IDE Form Designer Generated Code
* (c) Roberto Lopez - http://sites.google.com/site/hmgweb

DEFINE WINDOW TEMPLATE AT 171 , 418 WIDTH 550 HEIGHT 350 ;
VIRTUAL WIDTH Nil VIRTUAL HEIGHT Nil ;
TITLE "CalScot's checkbox disable test" ICON NIL ;
MAIN CURSOR NIL ON INIT Nil ON RELEASE Nil ;
ON INTERACTIVECLOSE Nil ON MOUSECLICK Nil ;
ON MOUSEDRAG Nil ON MOUSEMOVE Nil ON SIZE Nil ;
ON MAXIMIZE Nil ON MINIMIZE Nil ON PAINT Nil ;
BACKCOLOR Nil NOTIFYICON NIL NOTIFYTOOLTIP NIL ;
ON NOTIFYCLICK Nil ON GOTFOCUS Nil ON LOSTFOCUS Nil ;
ON SCROLLUP Nil ON SCROLLDOWN Nil ON SCROLLLEFT Nil ;
ON SCROLLRIGHT Nil ON HSCROLLBOX Nil ON VSCROLLBOX Nil

DEFINE CHECKBOX Check_1
ROW 60
COL 60
WIDTH 70
HEIGHT 28
CAPTION "Check_1"
VALUE .F.
FONTNAME "Arial"
FONTSIZE 9
TOOLTIP ""
ONCHANGE Nil
ONGOTFOCUS Nil
ONLOSTFOCUS Nil
FONTBOLD .F.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
BACKCOLOR NIL
FONTCOLOR NIL
HELPID Nil
TABSTOP .T.
VISIBLE .T.
TRANSPARENT .F.
END CHECKBOX

DEFINE CHECKBOX Check_2
ROW 80
COL 60
WIDTH 70
HEIGHT 28
CAPTION "Check_2"
VALUE .F.
FONTNAME "Arial"
FONTSIZE 9
TOOLTIP ""
ONCHANGE Nil
ONGOTFOCUS Nil
ONLOSTFOCUS Nil
FONTBOLD .F.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
BACKCOLOR NIL
FONTCOLOR NIL
HELPID Nil
TABSTOP .T.
VISIBLE .T.
TRANSPARENT .F.
END CHECKBOX

END WINDOW

Re: Display an inactive checkbox group?

Posted: Thu Mar 21, 2013 11:30 pm
by danielmaximiliano
CalScot wrote: But... I tried uploading the file with a .prg extension - "Not allowed". So I tried .txt - "Not allowed". No extension - "Not allowed". (Seems like everything I try today is not allowed!!)
Only thing I can think of is to cut and paste the code into the body of this message, so here goes:
Hi CalScot:

You can compress files with WinRAR necessary and then add the new topic.
when you upload the new options will have to paste the content in the desired location within the edition.
upload.png
upload.png (27.87 KiB) Viewed 8521 times
after taking into editing mode that topic or reply

I mean, source code, link to.
Edit.png
Edit.png (34.89 KiB) Viewed 8521 times

Re: Display an inactive checkbox group?

Posted: Thu Mar 21, 2013 11:46 pm
by CalScot
Thanks, Daniel.
I think I understand - but every time I think I'm getting on top of this, I realize how much more there is that I don't know! There are really just a few things that are driving me crazy; when I get them working, it'll all be coding and just replicating them over and over again - I hope!!
Thanks again.

Re: Display an inactive checkbox group?

Posted: Fri Mar 22, 2013 12:25 am
by Leopoldo Blancas
Hola...

Lo que pasa es que pones:
*--------------------------------------------------
Hello ...

What happens is you put:
main.check_1.enabled := .F.
Main.Check_2.enabled := .F.
En un lugar equivocado, debes de ponerlos dentro de un procedimiento de inicio en ON INIT MiProcedure() y ahí pones estas sentencias.
*------------------------------------------------------
In the wrong place, you should put them in a startup procedure ON INIT MiProcedure() and then put these sentences.

Code: Select all

DEFINE WINDOW TEMPLATE AT 171 , 418 WIDTH 550 HEIGHT 350 ;
 VIRTUAL WIDTH Nil VIRTUAL HEIGHT Nil ;
 TITLE "CalScot's checkbox disable test" ICON NIL ;
 MAIN CURSOR NIL ON INIT MiProcedure() ON RELEASE Nil ;
 ON INTERACTIVECLOSE Nil ON MOUSECLICK Nil ;
 ON MOUSEDRAG Nil ON MOUSEMOVE Nil ON SIZE Nil ;
 ON MAXIMIZE Nil ON MINIMIZE Nil ON PAINT Nil ;
 BACKCOLOR Nil NOTIFYICON NIL NOTIFYTOOLTIP NIL ;
 ON NOTIFYCLICK Nil ON GOTFOCUS Nil ON LOSTFOCUS Nil ;
 ON SCROLLUP Nil ON SCROLLDOWN Nil ON SCROLLLEFT Nil ;
 ON SCROLLRIGHT Nil ON HSCROLLBOX Nil ON VSCROLLBOX Nil
Espero me haya explicado.
Saludos
*------------------------------
I hope I have explained.
regards

Polo

Re: Display an inactive checkbox group?

Posted: Fri Mar 22, 2013 2:28 am
by CalScot
Hi, Polo.

Got it! Thank you! I was even able to get it to change states by selecting/deselecting options from a radio button group, which is exactly what I was trying to get to. Yeah!!!

Am I right in thinking that every Form object type has its own .prg file of associated procedures / functions? (That I can't just stick all of my UDF's at the bottom of the main.prg, as I used to do in the non-Windows environment?) The coding for the radio group created a new .prg file, instead of allowing me to add to the one created for the check box "procedures", so... If anyone can point me to the rules for that, it will help my understanding of all of this - and maybe even allow me to try to name the files appropriately!

Thanks again for all your help!!!