HOW ENABLE FOLDER FROM COMBOBOX

HOW ENABLE FOLDER FROM COMBOBOX

Postby Silvio » Tue Jan 30, 2007 11:54 pm

Dear friends,

I made a folder
Code: Select all  Expand view  RUN
REDEFINE FOLDER oFld ID 500 OF oDlg                         ;
                        PROMPT "&Anagrafica","&Dettagli";
                        DIALOGS "AGENDA_EDIT_A", "AGENDA_EDIT_B"

oFld:aEnable = { .t., .f. }


on folder [1] there is a combo with bitmaps

Code: Select all  Expand view  RUN
 

REDEFINE COMBOBOX oDat[24] VAR aDat[24] ITEMS aProfessione ID 300 OF oFld:aDialogs[1]; 
   BITMAPS { ".\bitmaps\Libro.bmp",;
                    ".\bitmaps\docente.bmp",;
                    ".\bitmaps\Fond.bmp",;
                    ".\bitmaps\alunno.bmp" } 
     


How I can make to show the dialog number 2 if the item of combobox is the number 4 ?


thanks in advance
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Rochinha » Thu Feb 01, 2007 2:58 pm

Silvio

Use oFld:SetOption( number )
Rochinha
 
Posts: 310
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo

Postby Silvio » Thu Feb 01, 2007 5:37 pm

the method setoption() is used when I want set a dialog for first

I have a dialog able and one disable

I want when the combobox item is 4 the folder 4 must be active

I hope you understand me
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby James Bott » Thu Feb 01, 2007 5:48 pm

Silvio,

Use the combobox's ON CHANGE clause to call a codeblock which enables and disables the folder depending on the combobox choice.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Silvio » Thu Feb 01, 2007 11:18 pm

I tryed but it not run look it :
Code: Select all  Expand view  RUN
REDEFINE COMBOBOX oDat[24] VAR aDat[24] ITEMS aProfessione ID  300 OF oFld:aDialogs[2]; 
BITMAPS { "Docente","ALUNNO","Cartella","Genitore","Esterno" };
ON CHANGE ( if oDat[24]:nAt = 4 ,oFld:aDialogs[4]:enable(),oFld:aDialogs[4]:disable())


Harbour.Exe pcustomer.prg /m /n0 /es2 /iC:\work\FWH\INCLUDE /ic:\work\xHarbour\Include /iinclude;c:\work\fwh\include;c:\work\xHarbour\include /oObj\pcustomer.c
xHarbour Compiler build 0.99.60 (SimpLex)
Copyright 1999-2006, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'pcustomer.prg'...
pcustomer.prg(1050) Error E0030 Syntax error: "parse error at 'ODAT'"
1 error
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby James Bott » Thu Feb 01, 2007 11:37 pm

There is a parenthsis in the wrong place. Try changing it to:


Code: Select all  Expand view  RUN
REDEFINE COMBOBOX oDat[24] VAR aDat[24] ITEMS aProfessione ID  300 OF oFld:aDialogs[2]; 
BITMAPS { "Docente","ALUNNO","Cartella","Genitore","Esterno" };
ON CHANGE if( oDat[24]:nAt = 4 , oFld:aDialogs[4]:enable(), oFld:aDialogs[4]:disable() )


You may also have to refresh the folder after disabling or enabling it.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Silvio » Fri Feb 02, 2007 8:57 am

How I can make to write a codeblock ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Rochinha » Fri Feb 02, 2007 1:21 pm

Silvio

Try this

Code: Select all  Expand view  RUN
...
oFld:aEnable = { iif( number=1, .t., .f. ),;
                         iif( number=2, .t., .f. ),;
                         iif( number=3, .t., .f. ),;
                         iif( number=4, .t., .f. ),;
                         iif( number=5, .t., .f. ) }
oFld:Refresh()


Number contains a value of folder to enable or disable.
Rochinha
 
Posts: 310
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo

Postby Silvio » Fri Feb 02, 2007 5:32 pm

IT MAKE ERROR
[1]:Harbour.Exe pcustomer.prg /m /n0 /es2 /iC:\work\FWH\INCLUDE /ic:\work\xHarbour\Include /iinclude;c:\work\fwh\include;c:\work\xHarbour\include /oObj\pcustomer.c
xHarbour Compiler build 0.99.60 (SimpLex)
Copyright 1999-2006, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'pcustomer.prg'...
pcustomer.prg(1066) Warning W0027 Meaningless use of expression: ':'

No code generated.


I MADE THIS

Code: Select all  Expand view  RUN


REDEFINE COMBOBOX oDat[24] VAR aDat[24] ITEMS aProfessione ID  300 OF oFld:aDialogs[2];
                                    BITMAPS { "Docente","ALUNNO","Cartella","Genitore","Esterno" } ;
                                      ON CHANGE( oFld:aDialogs[3]:aEnable = { iif( oDat[24]=1, .t., .f. ),;
                                                                              iif( oDat[24]=2, .t., .f. ),;
                                                                              iif( oDat[24]=3, .t., .f. ),;
                                                                              iif( oDat[24]=4, .t., .f. ),;
                                                                              iif( oDat[24]=5, .t., .f. ) },oFld:aDialogs[3]:Refresh())


Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby James Bott » Fri Feb 02, 2007 5:44 pm

Silvio,

You don't need to use a codeblock. Did you try my suggested code? Did it not work? If it didn't work, did you try adding oFld:refresh()?

You can test if the code is being called by replacing the enable()/disable() calls with msgBeep().

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Silvio » Fri Feb 02, 2007 10:40 pm

Code: Select all  Expand view  RUN
REDEFINE COMBOBOX oDat[24] VAR aDat[24] ITEMS aProfessione ID  300 OF oFld:aDialogs[2];
                                    BITMAPS { "Docente","ALUNNO","Cartella","Genitore","Esterno" } ;
                                      ON CHANGE( oFld:aDialogs[3]:aEnable = ;
                                                                            { iif( oDat[24]:nat=1, .t., .f. ),;
                                                                              iif( oDat[24]:nat=2, .t., .f. ),;
                                                                              iif( oDat[24]:nat=3, .t., .f. ),;
                                                                              iif( oDat[24]:nat=4, .F., .T. ),;
                                                                              iif( oDat[24]:nat=5, .t., .f. ) })





this make error

How I can make to not show tfolder number 3 if the item of combobox is oDat[24]:nat=4 ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Rochinha » Sat Feb 03, 2007 10:37 am

Silvio

The error is here

REDEFINE COMBOBOX oDat[24] VAR aDat[24] ITEMS aProfessione ID 300 OF oFld:aDialogs[2];
BITMAPS { "Docente","ALUNNO","Cartella","Genitore","Esterno" } ;
ON CHANGE( oFld:aDialogs[3]:aEnable = ;
{ iif( oDat[24]:nat=1, .t., .f. ),;
iif( oDat[24]:nat=2, .t., .f. ),;
iif( oDat[24]:nat=3, .t., .f. ),;
iif( oDat[24]:nat=4, .F., .T. ),;
iif( oDat[24]:nat=5, .t., .f. ) })

Replace oFld:aDialogs[3]:aEnable with oFld:aEnable

And put:

[code]
...
ON CHANGE( oFld:aEnable ...., oFld:Refresh() )

Try now
Rochinha
 
Posts: 310
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo

Postby Enrico Maria Giordano » Sat Feb 03, 2007 11:21 am

Code: Select all  Expand view  RUN
ON CHANGE( oFld:aDialogs[3]:aEnable := ;


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Silvio » Sat Feb 03, 2007 10:22 pm

thanks emg but it not run ok

Code: Select all  Expand view  RUN
Application
===========
   Path and name: C:\work\errori\fsdi2006\prg\fsdi2006.Exe (32 bits)
   Size: 2,062,848 bytes
   Time from start: 0 hours 0 mins 6 secs
   Error occurred at: 03-02-2007, 23:18:05
   Error description: Error BASE/1005  Message not found: TDIALOG:_AENABLE

Stack Calls
===========
   Called from:  => TDIALOG:ERROR(175)
   Called from: tobject.prg => (b)HBOBJECT:HBOBJECT(105)
   Called from:  => TDIALOG:MSGNOTFOUND(0)
   Called from: dialog.prg => TDIALOG:_AENABLE(167)
   Called from: pcustomer.prg => (b)INS_SOCI(1067)
   Called from: COMBOBOX.PRG => TCOMBOBOX:CHANGE(0)
   Called from: CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
   Called from: COMBOBOX.PRG => TCOMBOBOX:HANDLEEVENT(0)
   Called from: window.prg => _FWH(3165)
   Called from:  => SENDMESSAGE(0)
   Called from: dialog.prg => TDIALOG:COMMAND(425)
   Called from: window.prg => TWINDOW:HANDLEEVENT(0)
   Called from: dialog.prg => TDIALOG:HANDLEEVENT(927)
   Called from: window.prg => _FWH(3165)
   Called from:  => DIALOGBOX(0)
   Called from: dialog.prg => TDIALOG:ACTIVATE(274)
   Called from: pcustomer.prg => INS_SOCI(1177)
   Called from: pcustomer.prg => (b)SOCI(484)
   Called from: VMenu.prg => TVMENU:EVALACTION(1722)
   Called from: VMenu.prg => TVMENU:LBUTTONUP(1423)
   Called from: window.prg => TWINDOW:HANDLEEVENT(0)
   Called from: CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
   Called from: VMenu.prg => TVMENU:HANDLEEVENT(900)
   Called from: window.prg => _FWH(3165)
   Called from:  => WINRUN(0)
   Called from: window.prg => TWINDOW:ACTIVATE(883)
   Called from: main.prg => TAPPLICATION:ACTIVATE(164)
   Called from: main.prg => MAIN(42)




the source code is here
Code: Select all  Expand view  RUN
DEFINE DIALOG oDlg RESOURCE "AGENDA_EDIT" TITLE IF (lnew,"Inserimento Socio","Modifica Socio")


...


REDEFINE FOLDER oFld ID 500 OF oDlg                         ;
                        PROMPT "&Anagrafica","&Dettagli","&Alunno","&Notizie mediche","&Fotografia","Altro";
                        DIALOGS "AGENDA_EDIT_A", "AGENDA_EDIT_B","AGENDA_EDIT_ALU", "AGENDA_EDIT_C","AGENDA_EDIT_D","AGENDA_EDIT_E"

                     oFld:aEnable = { .t., .t., .f., .t., .t., .T.}


...



//folder Due
                                   REDEFINE COMBOBOX oDat[24] VAR aDat[24] ITEMS aProfessione ID  300 OF oFld:aDialogs[2];
                                    BITMAPS { "Docente","ALUNNO","Cartella","Genitore","Esterno" } ;
                                      ON CHANGE( oFld:aDialogs[3]:aEnable :=  ;
                                                                            { iif( oDat[24]:nat=1, .t., .f. ),;
                                                                              iif( oDat[24]:nat=2, .t., .f. ),;
                                                                              iif( oDat[24]:nat=3, .t., .f. ),;
                                                                              iif( oDat[24]:nat=4, .F., .T. ),;
                                                                              iif( oDat[24]:nat=5, .t., .f. ) })


...
  REDEFINE BTNBMP oBtn1 ID 1 OF oDlg ;
      FILE ".\bitmaps\sel1.BMP";
      ACTION NIL ;
      PROMPT "  Conferma"  LEFT






    REDEFINE BTNBMP oBtn2 ID 2 OF oDlg ;
      FILE ".\bitmaps\sel2.BMP";
      ACTION  oDlg:END() ;
      PROMPT "   Annulla"  LEFT




         ACTIVATE DIALOG oDlg CENTERED




Someone have an Idea ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Enrico Maria Giordano » Sat Feb 03, 2007 10:26 pm

Code: Select all  Expand view  RUN
ON CHANGE( oFld:aEnable :=  ;


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests