How Get data from grid with diffrent windows

79 views
Skip to first unread message

priadi andika

unread,
May 7, 2025, 10:41:21 AM5/7/25
to Harbour Minigui
Hi Group 

I am trying to get data from grid with different window, 

in the same window no problem


but if i get from main window from child window it doesn't work

 

------------------------------------------------------------*
Function VerItem(nvalue)
*--------------------------------------------------------------*
   Local creg1 := ""
   Local creg2 := ""
   
    creg1 := GetColValue( "Grid_1", "Win_1", 1 )
    creg2 := GetColValue( "Grid_1", "Win_1", 2 )

msginfo(creg1+ " dan "+ creg2)
   
   //MsgInfo( 'Col 1: ' + GetColValue( "Grid_1", "Win_1", 1 )+'  ';
     //     + 'Col 2: ' + GetColValue( "Grid_1", "Win_1", 2 ) )
Return creg1
*--------------------------------------------------------------*
Function GetColValue( xObj, xForm, nCol )
*--------------------------------------------------------------*
  Local nPos:= GetProperty(xForm, xObj, 'Value')
  Local aRet:= GetProperty(xForm, xObj, 'Item', nPos)
Return aRet[nCol]
*--------------------------------------------------------------*
Function SetColValue( xObj, xForm, nCol, xValue )
*--------------------------------------------------------------*
  Local nPos:= GetProperty(xForm, xObj, 'Value')
  Local aRet:= GetProperty(xForm, xObj, 'Item', nPos)
      aRet[nCol] := xValue
      SetProperty(xForm, xObj, 'Item', nPos, aRet)
Return NIL


From maiin window ( different window ) main

 

 240,180 btntextbox text_1

action veritem () 


Not result  


but in the same window ( child )


Its OK


Can anyone help me


Thanks for support , attention and help 

BR

SPD



Grigory Filatov

unread,
May 7, 2025, 11:13:42 AM5/7/25
to Harbour Minigui
Hi Supriadi,

It seems you tried FastFind example as your template.

Please add the highlighted line in the Captura() function.

*--------------------------------------------------------------*
Function Captura()
*--------------------------------------------------------------*
   Local cCapt       := Upper(AllTrim(win_1.Text_1.value))
   Local nTaman      := Len(cCapt)
   Local nRegProc    := 0
   Local nMaxRegGrid := 70
   Memvar cCampo
   Private cCampo    := "NOMBRE"

   DBSELECTAREA("Cuentas")
   DBSeek(cCapt)

   win_1.Grid_1.DisableUpdate
   DELETE ITEM ALL FROM Grid_1 OF Win_1

   Do While !EOF()
      If Substr(FIELD->&cCampo,1,nTaman) == cCapt
         nRegProc += 1
         If nRegProc > nMaxRegGrid
            EXIT
         Endif
         ADD ITEM { TRANSF(Cuentas->Imputacion,"9999999") , ;
                           Cuentas->Nombre } TO Grid_1 of Win_1
      ElseIf Substr(FIELD->&cCampo,1,nTaman) > cCapt
         EXIT
      Endif
      DBSkip()
   Enddo
   win_1.Grid_1.Value := 1
   win_1.Grid_1.EnableUpdate
Return NIL

I've also added an updated source for your review (see attachment).

Hope this is helpful.

Regards,
Grigory

среда, 7 мая 2025 г. в 16:41:21 UTC+2, supria...@gmail.com:
Win_1.Fmg
demo.prg

supria...@gmail.com

unread,
May 7, 2025, 3:01:25 PM5/7/25
to Harbour Minigui
Dear Grigory 


Thanks for the advice and example program ,


yes, i was inspired by fastfind

i want to get data in win_1.grid_1 from main window

I have tried your sample and I tested the veritem function and it did not produce any results.
P
rocedure Button2Click()

if IsWindowDefined( Win_1 )
   VerItem()
endif
Return

Fuction veritem from win_1 its result but from main window Not resut 

Do you have solution  .....,  pleas ... 

Thanks for attention  and help

Grigory Filatov

unread,
May 8, 2025, 3:06:24 AM5/8/25
to Harbour Minigui
Hi,

Step by step explanation:

1) compile the updated source
2) after launching test app press 'Start Child' button in Main form
3) enter 'ret' value in TEXTBOX field of 'Grid FastFind' form
4) press ''Get Grid Items'  button in Main form

The result information is shown in the picture below:
capture.png

HTH,
Grigory

среда, 7 мая 2025 г. в 21:01:25 UTC+2, supria...@gmail.com:

priadi andika

unread,
May 8, 2025, 4:12:55 AM5/8/25
to Grigory Filatov, Harbour Minigui
Dear Grigory 

Thank you very much for your attention and help
What i mean is how can i retrieve data from the grid child window
When the child window is released , the data in grid moves to the main window 
example coding 

@ 80 , 40 Button Button2 ;
Caption 'Get Grid Items' ;
On Click Button2Click()

@ 120,40 textbox  nNomor ;
     value "" ;  
@ 180,40 textbox  cNama  ;
  value "" ;

End Window

Activate Window main

Return Nil

Procedure Button2Click()


if IsWindowDefined( Win_1 )
   VerItem()
   //main.cnama.value := setcolvalue (grid_1, win_1,2,xValue )
   //main.cnama.value := GetColValue( "Grid_1", "Win_1", 1 )
 
endif

Thanks for attention and support 
BR
SPD





--
Visit our website on https://www.hmgextended.com/ or https://www.hmgextended.org/
---
You received this message because you are subscribed to the Google Groups "Harbour Minigui" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minigui-foru...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/minigui-forum/d7d90af4-ef0a-4218-8948-cd50125511ben%40googlegroups.com.

priadi andika

unread,
May 8, 2025, 6:59:40 AM5/8/25
to Grigory Filatov, Harbour Minigui
Dear Grugory

Problem resolved
This is great, thank you so much! 

Thanks for attention , support and help

BR
SPD

Reply all
Reply to author
Forward
0 new messages