FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour genblock
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

genblock

Posted: Mon Jun 12, 2023 10:01 AM
I have 9 button
when I press a button return allway 9

nRow:=30
For n= 1 to 9
@ nRow,2 BTNBMP aBtnCalc[n] PROMPT ltrim(str(n+1)) FLAT SIZE 20,30 PIXEL of oDlg ;
ACTION AddItems(oInvoice,aItems,GenBlock_(n),@nRowItems,fromdate,Todate)

nRow+=32
NEXt

fUNCTION GenBlock_(n)
RETURN n

and I Wish insert on GenBlock_(n) a right number (n)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM

Re: genblock

Posted: Mon Jun 12, 2023 11:14 AM
dear Silvio,

search the forum for detached locals.
Or have a look here http://forums.fivetechsupport.com/viewtopic.php?f=3&t=41373&hilit=detached+local

Regards, Detlef
Posts: 318
Joined: Fri Jan 14, 2022 08:37 AM

Re: genblock

Posted: Mon Jun 12, 2023 11:38 AM
Because ACTION clause generates an "internal" codeblock, so run ok:
Code (fw): Select all Collapse
nRow:=30
For n= 1 to 9
   #Define PARAMS1_ oDlg, aBtnCalc, nRow, n, oInvoice, aItems, @nRowItems, fromdate, Todate
   #Define PARAMS2_ oDlg, aBtnCalc, nRow, n, oInvoice, aItems,  nRowItems, fromdate, Todate
   GenButton(PARAMS1_)
   nRow+=32
NEXt

fUNCTION GenButton(PARAMS2_)
@ nRow,2 BTNBMP aBtnCalc[n] PROMPT ltrim(str(n+1)) FLAT SIZE 20,30 PIXEL of oDlg ;
ACTION AddItems(oInvoice,aItems,n,@nRowItems,fromdate,Todate)
RETURN NIL
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: genblock

Posted: Mon Jun 12, 2023 05:10 PM
Sorry I explain
I making a multiple invoice for beach management
in managing the beach, in addition to individual customers, there are associations or hotels that can book an x number of umbrellas, instead of placing an order for each umbrella at the hotel, I thought of making a multiple order and assigning XXXX n umbrellas to the hotel.

look this picture



to assign the umbrellas the operator presses one of the numerical buttons that are on the left and then selects a button that is inside the first scrollable panel


on First Scroll Panel If I select one button it return allways 04

on source on a for next cicle I create the buttons into scrollpanel and the assign an action for each button

aBtnEle[n]:bAction :={ || (Elemento:= nProduct ,msginfo(nProduct))}

nProduct id the code of an array

nProduct:= aElements[n][1]

but perhaps n is allways 4

How I can resolve ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM

Re: genblock

Posted: Mon Jun 12, 2023 07:56 PM
hi Silvo,

as Detlef say : detached Locals

when build in a "Loop" and use "Counter" you must call a Function to build a String for Codeblock
so your "Counter" Number will be a STR() in a String
Code (fw): Select all Collapse
      FOR ii := 1 TO 26              // A-Z

         @ 40, ( ii - 1 ) * ( ( nBB * 2 ) + 2 ) BTNBMP oBtn SIZE nBB * 2, nBB PIXEL OF oMain ;
                 PROMPT cDrive LEFT ;
                 RESNAME cBitmap ;
                 FONT oFontDefault COLOR BFcolor, BGcolor

         bBlock := DetachBlock(ii)
         oBtn:bAction  := bBlock
Code (fw): Select all Collapse
FUNCTION DetachBlock( ii )
LOCAL cBlock := "{|| msgInfo(" + STR( ii ) + ")}"
LOCAL bBlock
   bBlock := &cBlock
RETURN bBlock
---

about "04" : on right side of Button you have some Listbox ... how many Element have 1st Listbox ?
greeting,

Jimmy
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: genblock

Posted: Tue Jun 13, 2023 07:13 AM

I resolved with cargo

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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

Continue the discussion