provide help for get from combo box

provide help for get from combo box

Postby Ehab Samir Aziz » Fri Apr 14, 2006 10:13 pm

can get read directly from combo box as below ?

Code: Select all  Expand view  RUN
   @ 45,2 SAY "&Country" OF oDlg PIXEL
   @ 45,50 SAY ":" OF oDlg PIXEL
   @ 45,60 GET V_cu_coun OF oDlg PIXEL
   @ 45,200 COMBOBOX V_cu_coun ITEMS aBase(1,"cust",256,"cu_coun") size 80,80 ;
   OF oDlg PIXEL;
   ON CHANGE (v_cu_coun:=cust->cu_coun);


but this syntax does not bring the value to get ?
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Re: provide help for get from combo box

Postby Enrico Maria Giordano » Sat Apr 15, 2006 9:28 am

You can't use the same variable for the GET and the COMBOBOX.

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

Postby Ehab Samir Aziz » Sat Apr 15, 2006 2:44 pm

Yes that is already done all of them are :V_cu_coun
But that does not bring the value from the combp box to the get variable What should I do to bring the value chosen from the combo box into get box ?


Code: Select all  Expand view  RUN
@ 45,60 GET V_cu_coun OF oDlg PIXEL
@ 45,200 COMBOBOX V_cu_coun ITEMS aBase(1,"cust",256,"cu_coun") size 80,80 ;
   OF oDlg PIXEL;
   ON CHANGE (v_cu_coun:=cust->cu_coun);
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Antonio Linares » Sat Apr 15, 2006 5:05 pm

@ 45,60 GET oGet VAR V_cu_coun OF oDlg PIXEL

...
ON CHANGE (v_cu_coun:=cust->cu_coun, oGet:Refresh() )

You should not use the same variable name for diferent controls as Enrico has explained you.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Ehab Samir Aziz » Mon Apr 17, 2006 7:27 pm

I did what you told me . The Get is not being refereshed until the cursor goes into the get box
Code: Select all  Expand view  RUN
@ 45,2 SAY "&Country" OF oDlg PIXEL
   @ 45,50 SAY ":" OF oDlg PIXEL
   @ 45,60 GET oGet VAR V_cu_coun OF oDlg PIXEL
   @ 45,200 COMBOBOX V_cu_coun ITEMS aBase(1,"cust",256,"cu_coun") size 80,80 ;
   OF oDlg PIXEL;
   ON CHANGE (V_cu_coun:=cust->cu_coun,oGet:Refresh(),oDlg:Refresh())
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Enrico Maria Giordano » Mon Apr 17, 2006 8:48 pm

Ehab Samir Aziz wrote:@ 45,60 GET oGet VAR V_cu_coun
@ 45,200 COMBOBOX V_cu_coun


You are still using V_cu_coun for both GET and COMBOBOX.

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

Postby Ehab Samir Aziz » Sat Apr 22, 2006 8:04 am

I used different names for the different controls and Still the get is not being refereshed

Code: Select all  Expand view  RUN
   @ 45,2 SAY "&Country" OF oDlg PIXEL
   @ 45,50 SAY ":" OF oDlg PIXEL
   @ 45,60 GET oGet VAR V_cu_coun OF oDlg PIXEL
   @ 45,200 COMBOBOX V_cu_counc ITEMS aBase(1,"cust",256,"cu_coun") size 80,80 ;
   OF oDlg PIXEL;
   ON CHANGE (V_cu_counc:=cust->cu_coun,V_cu_coun:=V_cu_counc,oGet:Refresh(),oDlg:Refresh())
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Enrico Maria Giordano » Sat Apr 22, 2006 10:15 am

Ehab Samir Aziz wrote:
Code: Select all  Expand view  RUN
ON CHANGE (V_cu_counc:=cust->cu_coun,V_cu_coun:=V_cu_counc,oGet:Refresh(),oDlg:Refresh())


Try

Code: Select all  Expand view  RUN
ON CHANGE (V_cu_coun:=cust->cu_coun,oGet:Refresh())


If this doesn't work then please provide a reduced and self-contained sample of the problem.

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

Postby Ehab Samir Aziz » Sat Apr 22, 2006 11:00 am

Not instantly refreshing for the get I should go to by cursor to the get box so the frefresh will be made . Please focus on the country variable and I will do the rest .

Code: Select all  Expand view  RUN
static function editcust( oLbx, lAppend )
*-------------------------------------------
local oDlg
local h:=0
local V_CU_ACCT
local V_CU_NAME
local V_cu_stre
local V_cu_gove
local V_cu_city:=space(30)
local V_cu_coun:=space(30)
local V_cu_counc:=space(30)

local V_CU_phon
local V_CU_fax
local V_CU_MAN
local V_CU_mobi
local V_CU_appr
local oGet
local lSave := .f.
local nOldRec := RecNo()
DEFAULT lAppend := .f.


   if lAppend
      GOTO BOTTOM
      SKIP
   endif

*? nOldRec
V_CU_ACCT:=cust->CU_ACCT
V_CU_NAME:=cust->CU_NAME
V_CU_coun:=cust->CU_coun
V_CU_city:=cust->CU_city
V_CU_gove:=cust->CU_gove
V_CU_stre:=cust->CU_stre
V_CU_phon:=cust->CU_phon
V_CU_fax:=cust->CU_fax
V_CU_MAN:=cust->CU_MAN
V_CU_mobi:=cust->CU_mobi
V_CU_appr:=cust->CU_appr

DEFINE DIALOG oDlg FROM 8, 2 TO 500, 700 PIXEL ;
TITLE If( lAppend, "New Customer", "Customer Update" )


   @ 1,2 SAY "&Account No." OF oDlg PIXEL
   @ 1,50 SAY ":" OF oDlg PIXEL
   @ 1,60 GET V_CU_ACCT OF oDlg PIXEL

   @ 15,1 SAY "&Name" OF oDlg PIXEL
   @ 15,50 SAY ":" OF oDlg PIXEL
   @ 15,60 GET V_CU_NAME OF oDlg PIXEL

   @ 30,2 SAY "&Street" OF oDlg PIXEL
   @ 30,50 SAY ":" OF oDlg PIXEL
   @ 30,60 GET V_cu_stre OF oDlg PIXEL

   @ 45,2 SAY "&Country" OF oDlg PIXEL
   @ 45,50 SAY ":" OF oDlg PIXEL
   @ 45,60 GET oGet VAR V_cu_coun OF oDlg PIXEL
   @ 45,200 COMBOBOX V_cu_counc ITEMS aBase(1,"cust",256,"cu_coun") size 80,80 ;
   OF oDlg PIXEL;
   ON CHANGE (V_cu_coun:=cust->cu_coun,oGet:Refresh(),oDlg:Refresh())

   @ 60,2 SAY "&City" OF oDlg PIXEL
   @ 60,50 SAY ":" OF oDlg PIXEL
   @ 60,60 GET oGet VAR V_cu_city OF oDlg PIXEL
   @ 60,200 COMBOBOX V_cu_city ITEMS aBase(1,"cust",256,"cu_city") size 80,80 ;
   OF oDlg PIXEL;
   ON CHANGE (v_cu_city:=cust->cu_city,oGet:Refresh());


   select 1
   use cust
   set filter to (upper(v_cu_city)==upper(cust->cu_city))
   @ 75,2 SAY "&Governer" OF oDlg PIXEL
   @ 75,50 SAY ":" OF oDlg PIXEL
   @ 75,60 GET V_cu_gove OF oDlg PIXEL
   @ 75,200 COMBOBOX V_cu_gove ITEMS aBase(1,"cust",256,"cu_gove") size 80,80 ;
   OF oDlg PIXEL;
   ON CHANGE (v_cu_gove:=cust->cu_gove);

   select 1
   use cust
   set filter to

   @ 90,2 SAY "&Phone" OF oDlg PIXEL
   @ 90,50 SAY ":" OF oDlg PIXEL
   @ 90,60 GET V_CU_phon OF oDlg PIXEL

   @ 105,2 SAY "&Fax" OF oDlg PIXEL
   @ 105,50 SAY ":" OF oDlg PIXEL
   @ 105,60 GET V_CU_fax OF oDlg PIXEL

   @ 120,2 SAY "Man" OF oDlg PIXEL
   @ 120,50 SAY ":" OF oDlg PIXEL
   @ 120,60 GET V_CU_MAN OF oDlg PIXEL

   @ 135,2 SAY "Mobile" OF oDlg PIXEL
   @ 135,50 SAY ":" OF oDlg PIXEL
   @ 135,60 GET V_CU_mobi OF oDlg PIXEL

   @ 150,2 SAY "Account Name" OF oDlg PIXEL
   @ 150,50 SAY ":" OF oDlg PIXEL
   @ 150,60 GET V_CU_appr OF oDlg PIXEL

   @ 170,  9 BUTTON "&Save"  OF oDlg PIXEL SIZE 50, 12 ACTION ( lSave := .t. , oDlg:End() )
   @ 170, 100 BUTTON "&Cancel" OF oDlg PIXEL SIZE 50, 12 ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

      if Empty( V_CU_Acct ) .and. lSave
         MsgAlert( "Please write a name" )
      endif


   if lSave .and. !empty( V_CU_ACCT )

      if lAppend
select 1
use cust
APPEND BLANK
nOldRec:=recno()
*? nOldRec
endif

select 1
use cust
GOTO nOldRec
cust->CU_ACCT :=V_CU_ACCT
cust->CU_NAME :=V_CU_NAME
cust->cu_coun :=V_cu_coun
cust->cu_city :=V_cu_city
cust->cu_gove :=V_cu_gove
cust->cu_stre :=V_cu_stre
cust->CU_phon :=V_CU_phon
cust->CU_fax :=V_CU_fax
cust->CU_MAN :=V_CU_MAN
cust->CU_mobi :=V_CU_mobi
cust->CU_appr :=V_CU_appr
      select 1
      use cust
      go top
      oLbx:Refresh()          // We want the ListBox to be repainted
   else
      select 1
      use cust
endif

select 1
use cust

INDEX ON upper(cust->cu_acct) TO cust
go top
reindex

INDEX ON upper(cust->cu_name) TO cust1
go top
reindex
INDEX ON upper(cust->cu_coun) TO cust2
go top
reindex

INDEX ON upper(cust->cu_city) TO cust3
INDEX ON upper(cust->cu_gove) TO cust4
INDEX ON upper(cust->cu_stre) TO cust5
INDEX ON upper(cust->cu_phon) TO cust6
INDEX ON upper(cust->cu_fax ) TO cust7
INDEX ON upper(cust->cu_mobi) TO cust8
INDEX ON upper(cust->cu_man ) TO cust9
INDEX ON alltrim(upper(cust->cu_appr)) TO cust10
go top
reindex

use cust index cust


return nil
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Enrico Maria Giordano » Sat Apr 22, 2006 11:07 am

Without a reduced and self-contained sample of the problem I can't help you, sorry.

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

Postby Ehab Samir Aziz » Sat Apr 22, 2006 11:14 am

Do you want sample of data and prg syntax ? Oka I will send to you by mail
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Enrico Maria Giordano » Sat Apr 22, 2006 12:28 pm

I need of a reduced sample. You have to take the time to reduce your sample to the minimum that is still enough to demonstrate the problem.

If you don't have this time then sorry but I can't help you.

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

Postby Ehab Samir Aziz » Sun Apr 23, 2006 6:34 pm

I reduced a sample you can compile it direct. Pls my problem is the the value of of the combobox is not being transfered to the get box .
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
#include "colors.ch"
#include "Folder.ch"
#include "InKey.ch"
#include "xbrowse.ch"
#include "ads.ch"

static oWnd
//----------------------------------------------------------------------------//

function Main()
local oDlg
local V_cu_city:=space(30)
local V_cu_coun:=space(30)
local V_cu_counc:=space(30)
local oGet


select 1
USE cust




DEFINE DIALOG oDlg FROM 8, 2 TO 500, 700 PIXEL



   @ 45,2 SAY "&Country" OF oDlg PIXEL
   @ 45,50 SAY ":" OF oDlg PIXEL
   @ 45,60 GET oGet VAR V_cu_coun OF oDlg PIXEL
   @ 45,200 COMBOBOX V_cu_counc ITEMS aBase(1,"cust",256,"cu_coun") size 80,80 ;
   OF oDlg PIXEL;
   ON CHANGE (V_cu_coun:=cust->cu_coun,oGet:Refresh(),oDlg:Refresh())

   ACTIVATE DIALOG oDlg CENTERED


return nil


FUNCTION aBase(workarea,dbf_na,arr_size,fld_na)
//-------------------------------------
LOCAL arr:={},nAreaActiv:=Select()
LOCAL y:=0

aAdd(arr,space(arr_size)) //Put First element empty

select (workarea)
use (dbf_na)
SELE (dbf_na)
dbGoTop()


WHILE!Eof()
y:=ASCAN(arr,(dbf_na)->&fld_na)                     
if y==0
aAdd(arr,(dbf_na)->&fld_na)
dbSkip()
else
dbSkip()
endif
ENDDO

SELE (nAreaActiv)

RETURN(arr)

Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Enrico Maria Giordano » Sun Apr 23, 2006 9:24 pm

This is a working sample:

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oCbx, oGet

    LOCAL cVar1 := ""
    LOCAL cVar2 := SPACE( 30 )

    DEFINE DIALOG oDlg

    @ 1, 1 COMBOBOX oCbx VAR cVar1;
           ITEMS { "First", "Second", "Third" };
           ON CHANGE ( oGet:VarPut( PADR( cVar1, LEN( cVar2 ) ) ),;
                       oGet:Refresh() )

    @ 3, 1 GET oGet VAR cVar2

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 30 guests