combo problem

combo problem

Postby Silvio.Falconi » Fri Sep 22, 2017 11:29 am

Dear friends,
I have problem with this combobox
I wish jump the user to insert aGet[7] if aGet[6]:nat=1 or jump to aGet[8] if aGet[6]:nat=2
How I can make it ?


@ 80, 75 COMBOBOX aGet[6] VAR cpermesso ITEMS aTipo OF oDlg SIZE 50, 12 PIXEL FONT oFont ;
ON CHANGE (corae:=SPACE(5), corau:=SPACE(5),iif(aGet[6]:nat=1,( aGet[7]:REFRESH(),aGet[7]:setFocus()),;
( aGet[8]:REFRESH(),aGet[8]:setFocus())) ) UPDATE

@ 96, 10 SAY "Ora di entrata :" OF oDlg SIZE 43, 8 PIXEL FONT oFont
@ 94, 75 GET aGet[7] VAR corae OF oDlg SIZE 25, 12 PIXEL FONT oFont when aGet[6]:nat=1 UPDATE


@ 110, 10 SAY "Ora di uscita :" OF oDlg SIZE 40, 8 PIXEL FONT oFont
@ 108, 75 GET aGet[8] VAR corau OF oDlg SIZE 25, 12 PIXEL FONT oFont when aGet[6]:nat=2 UPDATE



I tried also with

@ 80, 75 COMBOBOX aGet[6] VAR cpermesso ITEMS aTipo OF oDlg SIZE 50, 12 PIXEL FONT oFont ;
ON CHANGE (iif(aGet[6]:nat=1, aGet[6]:oJump := aGet[7], aGet[6]:oJump := aGet[8] ) )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: combo problem

Postby MGA » Fri Sep 22, 2017 12:40 pm

Hi Silvio,

// insert aGet[7] if aGet[6]:nat=1 or jump to aGet[8] if aGet[6]:nat=2

@ 80, 75 COMBOBOX aGet[6] VAR cpermesso ITEMS aTipo OF oDlg SIZE 50, 12 PIXEL FONT oFont ;
ON CHANGE (Test(aGet)) UPDATE

@ 96, 10 SAY "Ora di entrata :" OF oDlg SIZE 43, 8 PIXEL FONT oFont
@ 94, 75 GET aGet[7] VAR corae OF oDlg SIZE 25, 12 PIXEL FONT oFont UPDATE


@ 110, 10 SAY "Ora di uscita :" OF oDlg SIZE 40, 8 PIXEL FONT oFont
@ 108, 75 GET aGet[8] VAR corau OF oDlg SIZE 25, 12 PIXEL FONT oFont UPDATE
...
activate dialog oDlg on init(aGet[7]:disable())

function Test(aGet)

if aGet[6]:nat == 1
aGet[7]:enable()
else
aGet[7]:disable()
endif

if aGet[6]:nat == 2
xSetFocus(aGet[8])
endif
return

/****************************************************************/
function xSetfocus( oObj )
/*
*/
Local _oWnd := oObj:oWnd, _oTempo := ''
Define Timer _oTempo Interval 10 of _oWnd ;
Action ( oObj:SetFocus(), _oTempo:End() )
Activate Timer _oTempo
return .t.
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1249
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: combo problem

Postby Silvio.Falconi » Sat Sep 23, 2017 9:23 am

I make a small test

Code: Select all  Expand view
#include "FiveWin.ch"
#include "constant.ch"


Function Main()
Local oDlg
Local aGet[10]
local oFont


Local cPermesso  ,;
      cOraE      ,;
      cOraU      



     Local aTipo:= {"Entrata","Uscita"}

   Local nBottom   := 25
   Local nRight    := 75
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H


cPermesso := space(10)
cOraE     := space(5)
cOraU     := space(5)



 DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 8

    DEFINE DIALOG oDlg ;
    TITLE "";
    SIZE nWidth, nHeight  PIXEL               ;
    FONT oFont      STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )

@ 82, 10 SAY "Tipo di permesso :" OF oDlg SIZE 56, 8 PIXEL FONT oFont

 @ 80, 75 COMBOBOX  aGet[6] VAR cpermesso ITEMS aTipo OF oDlg SIZE 50, 12 PIXEL FONT oFont  ;
     ON CHANGE  Rinfresca_Get(aGet) UPDATE

@ 96, 10 SAY "Ora di entrata :" OF oDlg SIZE 43, 8 PIXEL FONT oFont
   @ 94, 75 GET aGet[7] VAR corae     OF oDlg SIZE 25, 12 PIXEL FONT oFont  when aGet[6]:nat=1  UPDATE

@ 110, 10 SAY "Ora di uscita :" OF oDlg SIZE 40, 8 PIXEL FONT oFont
   @ 108, 75 GET aGet[8] VAR corau     OF oDlg SIZE 25, 12 PIXEL FONT oFont  when aGet[6]:nat=2   UPDATE

ACTIVATE DIALOG oDlg CENTERED     ;
              ON INIT( aGet[7]:disable())

return nil

 //-----------------------------------------------------------------------------------------------//
Function Rinfresca_Get(aGet)
         if aGet[6]:nat == 1
                aGet[7]:enable()
               xSetFocus(aGet[7])
         else
           aGet[7]:disable()
          endif

          if aGet[6]:nat == 2
             aGet[8]:enable()
             xSetFocus(aGet[8])
           endif

    RETURN NIL
//---------------------------------------------------------//
function xSetfocus( oObj )

Local _oWnd := oObj:oWnd, _oTempo := ''
Define Timer _oTempo Interval 10 of _oWnd ;
Action ( oObj:SetFocus(), _oTempo:End() )
Activate Timer _oTempo
return .t.

 


the suggestion of SGs run ok only I make one modify
Possible there is not another solution ? ( instead of use a timer object ?)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: combo problem

Postby Enrico Maria Giordano » Sat Sep 23, 2017 9:34 am

I don't understand what is the problem you're having with this test. Please explain.

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

Re: combo problem

Postby Silvio.Falconi » Sat Sep 23, 2017 9:47 am

When the option of combobox is changed the procedure must clear the get and make a setfocus

for a sample :

if the selection is = 1

the procedure must clear aGet[8] and make set fo cus on aGet[7] and disable Get[8]
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: combo problem

Postby Enrico Maria Giordano » Sat Sep 23, 2017 9:51 am

1. The combobox is empty, so it cannot be changed.

2. Where do you want to put the focus after the combobox is changed?

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

Re: combo problem

Postby Silvio.Falconi » Sat Sep 23, 2017 9:54 am

ON CHANGE (corae:=space(5),aGet[7]:refresh(),;
corau:=space(5),aGet[8]:refresh(),;
Rinfresca_Get(aGet)) UPDATE

now run ok

if the combo is "Entrata" then aGet[7] is focus and aGet[8] is disabled and all get must be clear
if the combo is "Uscita" then aGet[8] is focus and aGet[7] is disabled and all get must be clear

the problem for a sample is the user can reseclect the "Entrata" option and not found the text is inserted before
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 32 guests