genblock

genblock

Postby Silvio.Falconi » 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 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: 6771
Joined: Thu Oct 18, 2012 7:17 pm

Re: genblock

Postby Detlef » 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
User avatar
Detlef
 
Posts: 205
Joined: Mon Feb 07, 2022 9:54 pm

Re: genblock

Postby paquitohm » Mon Jun 12, 2023 11:38 am

Because ACTION clause generates an "internal" codeblock, so run ok:

Code: Select all  Expand view
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
paquitohm
 
Posts: 108
Joined: Fri Jan 14, 2022 8:37 am

Re: genblock

Postby Silvio.Falconi » Mon Jun 12, 2023 5: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

Image

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 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: 6771
Joined: Thu Oct 18, 2012 7:17 pm

Re: genblock

Postby Jimmy » Mon Jun 12, 2023 7: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: Select all  Expand view
     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: Select all  Expand view
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
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: genblock

Postby Silvio.Falconi » Tue Jun 13, 2023 7:13 am

I resolved with cargo
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: 6771
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 99 guests