FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HOW ENABLE FOLDER FROM COMBOBOX
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Tue Jan 30, 2007 11:54 PM
Dear friends,

I made a folder
 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

  

 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
Posts: 310
Joined: Sun Jan 08, 2006 10:09 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Thu Feb 01, 2007 02:58 PM

Silvio

Use oFld:SetOption( number )

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Thu Feb 01, 2007 05: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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Thu Feb 01, 2007 05: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Thu Feb 01, 2007 11:18 PM
I tryed but it not run look it :
 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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Thu Feb 01, 2007 11:37 PM
There is a parenthsis in the wrong place. Try changing it to:


 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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Fri Feb 02, 2007 08:57 AM

How I can make to write a codeblock ?

Best Regards, Saludos



Falconi Silvio
Posts: 310
Joined: Sun Jan 08, 2006 10:09 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Fri Feb 02, 2007 01:21 PM
Silvio

Try this

...
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.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Fri Feb 02, 2007 05: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

 

 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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Fri Feb 02, 2007 05: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Fri Feb 02, 2007 10:40 PM
 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
Posts: 310
Joined: Sun Jan 08, 2006 10:09 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: 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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Sat Feb 03, 2007 11:21 AM
ON CHANGE( oFld:aDialogs[3]:aEnable := ;


EMG
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Sat Feb 03, 2007 10:22 PM
thanks emg but it not run ok

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
 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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
HOW ENABLE FOLDER FROM COMBOBOX
Posted: Sat Feb 03, 2007 10:26 PM
ON CHANGE( oFld:aEnable :=  ;


EMG