You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to xbasians.org
*Monty Hall problem with optimize *FOXPRO code *Monty_Hall_problem test *autor alex; alexeyzapolskiy at gmail.com *24.06.2024
CLEAR ALL LOCAL lni, lnw, lnv, lnTrue, lnTryings, lnQty *lni - переменная цикла *lnw - номер двери, за которой приз *lnv - мой выбор *lnTrue - количество угадываний *lnTryings - количество попыток *lnQty - количество дверей
*!**** Calling is in pairs. *!***First one is an alias of open cursor/table *!***second specifies how many records to copy - 0 means all
* SampleDataAsText.prg Lparameters tcInfo LOCAL loCloseTemp, ix loCloseTemp = CREATEOBJECT('CloseTemp')
LOCAL ARRAY laInfo[1] Create Cursor crsSampler (procedureName m, procedureCode m) For ix = 1 To ALINES(laInfo,m.tcInfo,1+4,',',CHR(13),CHR(10)) STEP 2 GetProcedureCode(laInfo[m.ix],VAL(laInfo[m.ix+1])) Endfor DataCreationCodeToClip() MESSAGEBOX('Data creation is copied to clipboard',0,'Sample Data',3000)
Procedure GetProcedureCode(tcAlias,tnRecords) Local lcTemp, ix, lcData, lcRetVal lcTemp = Sys(2015)+'.tmp' If !Used(m.tcAlias) Select * From (m.tcAlias) Into Cursor crsSampling nofilter lcCursorName = Juststem(m.tcAlias) Else Select (m.tcAlias) lcCursorName = Alias() Endif Locate If Empty(m.tnRecords) Copy To (m.lcTemp) Type Delimited Else Copy To (m.lcTemp) Type Delimited Next m.tnRecords Endif lcData = Filetostr(m.lcTemp) Erase (m.lcTemp)
Set Textmerge Delimiters To '%%','%%' Set Textmerge To (m.lcTemp) Noshow Set Textmerge On \ \ Procedure CreateCursor_%%m.lcCursorName%% \ LOCAL lcData, lcTemp \ lcTemp = SYS(2015)+'.tmp' \ TEXT TO m.lcData noshow \ %%m.lcData%% \ ENDTEXT \ \ STRTOFILE(m.lcData,m.lcTemp) \ \ create CURSOR %%m.lcCursorName%% ; \ ( ; For ix=1 To Afields(aStruc) \ %%IIF(m.ix > 1,',','')%% \\%%aStruc[m.ix,1]%% %%aStruc[m.ix,2]%%(%%aStruc[m.ix,3]%%,%%aStruc[m.ix,4]%%) \\ %%IIF(aStruc[m.ix,5],'',' NOT ')%% NULL \\ %%IIF(aStruc[m.ix,6],'NOCPTRANS','')%% ; Endfor \ ) \ \ APPEND FROM (m.lcTemp) TYPE delimited \ ERASE (m.lcTemp) \ endproc Set Textmerge To Set Textmerge Off Insert Into crsSampler Values (Textmerge('CreateCursor_%%m.lcCursorName%%()%%CHR(13)+CHR(10)%%'), Filetostr(m.lcTemp) ) Set Textmerge Delimiters Erase (m.lcTemp) ENDPROC
** Class to close any cursors created after it was instantiated ** Author: Dragan Nedeljkovich Define Class CloseTemp As Custom Dimension a1[1] nFiles=0 Procedure Init This.nFiles=Aused(atemp) If This.nFiles > 0 Acopy(atemp, This.a1) Else This.a1="" Endif endproc
Procedure Destroy For i=1 To Aused(aNow) If Ascan(This.a1, aNow[i,1],-1,-1,1,2+4)=0 Use In aNow[i,1] Endif Endfor endproc Enddefine
воскресенье, 31 августа 2025 г. в 23:25:17 UTC+3, alex;:
alex;
unread,
Sep 21, 2025, 9:06:38 AMSep 21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to xbasians.org
*Foxpro code * I prefer controls in the bottom-right and top-left corners of the grid, * responsible for move and resize.
USE IN SELECT("customers") USE (HOME()+"\samples\data\customer.dbf") ALIAS customers
PUBLIC oMyForm as Form oMyForm = CREATEOBJECT("frmTest") oMyForm.Show() oMyForm.Refresh READ EVENTS
CLEAR ALL
DEFINE CLASS frmTest AS FORM *DoCreate = .T. ADD OBJECT oContainerWithGrid as ContainerWithGrid WITH ; Left = 10, Top = 10, Width = 300, Height = 200
DO CASE CASE N_CP = 1250 INDEX ON Glyph TAG s_alpha COLLATE "HUNGARY" CASE N_CP = 1251 INDEX ON Glyph TAG s_alpha COLLATE "RUSSIAN" OTHERWISE INDEX ON Glyph TAG s_alpha ENDCASE
BROWSE TITLE "Символы кодовой страницы " + TRANSFORM(N_CP) + " (160-255)" &lcTmp FONT C_FONTNAME, 10 STYLE "B" NOWAIT NAME qwe qwe.FontCharSet = N_CS
*_SCREEN.FontCharSet = 204
READ EVENTS
WBR, alex;
суббота, 27 сентября 2025 г. в 02:30:27 UTC+3, alex;: