1

Konu: Baska seyle ugrasirken eski koda denk geldim...

iyi kodlardan birisi gibi geldi. Umarim birinin isine yarar. Sag klik denemeyi unutmayin:

Visual Fox Pro
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
Public oForm

oForm = NewObject('HTMLViewerForm')
oForm.Show
 
Local loDocument
loDocument = oForm.htMLVIEWER.obJECT.document
Select cust_id,company,contact,country,region from customer into cursor crsCustomer
 
loTableX = _GetTable(loDocument)
loDocument.body.AppendChild(loTableX)
_cliptext = loDocument.body.outerHTML
 
Procedure _GetTable
Lparameters toDocument
Local Array aHeaders[1], aColumns[1]
 
Local oTable,oThead,oTFoot,oTBody,oCaption, jx
oTable = toDocument.createElement("TABLE")
oThead = toDocument.createElement("THEAD")
oTBody1 = toDocument.createElement("TBODY")
oTBody2 = toDocument.createElement("TBODY")
oTBody3 = toDocument.createElement("TBODY")
oTFoot = toDocument.createElement("TFOOT")
oCaption = toDocument.createElement("CAPTION")
 
* Insert the created elements into oTable.
With oTable
    .Border = 1
    .Id = 'customers'
    *.Style.borderCollapse="collapse"
    .Style.BorderColor = "#000000"
    .Style.BorderWidth = "thin"
    .Style.BorderStyle = "solid"
    .appendChild(oThead)
    .appendChild(oTBody1)
    .appendChild(oTBody2)
    .appendChild(oTBody3)
    .appendChild(oTFoot)
    .appendChild(oCaption)
    .cellSpacing = 0
    .cellPadding = 0
Endwith
oTBody1.bgColor = "#E0E0E0"
oTBody2.bgColor = "#00FFFF"
oTBody3.bgColor = "#FF00FF"
 
Select crsCustomer
* Insert a row into the header and set its background color.
oThead.bgColor = "lightskyblue"
lcHeaders = "cust_id,company,contact,country"
 
oRow = toDocument.createElement("TR")
    oCell = toDocument.createElement("TH")
    oCell.rowspan = 2
    oCell.innerText = "Customer ID"
    oRow.appendChild(oCell)
 
    oCell = toDocument.createElement("TH")
    oCell.rowspan = 2
    oCell.innerText = "Company"
    oRow.appendChild(oCell)
 
    oCell = toDocument.createElement("TH")
    oCell.colspan = 2
    oCell.innerText = "Showed Up"
    oRow.appendChild(oCell)
 
oThead.appendChild(oRow)
oRow = toDocument.createElement("TR")
    oCell = toDocument.createElement("TH")
    oCell.innerText = "Contact"
    oRow.appendChild(oCell)
    oCell = toDocument.createElement("TH")
    oCell.innerText = "Country"
    oRow.appendChild(oCell)
oThead.appendChild(oRow)
 
 
Scan
    oRow = toDocument.createElement("TR")
    If country='USA'
    oTBody2.appendChild(oRow)
    Else
    If country='Germany'
    oTBody1.appendChild(oRow)
    Else
    oTBody3.appendChild(oRow)
    endif
    endif
 
*CustID
        oCell = toDocument.createElement("TD")
        oCell.Rowspan=2
        oCell.style.fontWeight = "bold"
        oCell.innerText = Trim(cust_id)
        oRow.appendChild(oCell)
*Company
        oCell = toDocument.createElement("TD")
*       oCell.Rowspan=2
        oCell.innerText = Trim(company)
        oRow.appendChild(oCell)
*Contact
        oCell = toDocument.createElement("TD")
*       oCell.Rowspan=2
        oCell.innerText = Trim(contact)
        oRow.appendChild(oCell)
* Country and region
        oCell = toDocument.createElement("TD")
*       oCell.Rowspan=2
        oCell.innerText = Trim(country)
        oRow.appendChild(oCell)
 
    oSubRow = toDocument.createElement("TR")
    If country='USA'
    oTBody2.appendChild(oSubRow)
    Else
    If country='Germany'
    oTBody1.appendChild(oSubRow)
    Else
    oTBody3.appendChild(oSubRow)
    endif
    endif
 
* Country and region
        oCell = toDocument.createElement("TD")
        oCell.colspan=3
        oCell.style.fontStyle = "italic"
        oCell.innerText = Trim(country - (' - ' + region))
       
If region='WA'
    oCell.bgColor = "#FF2020"
endif
        oSubRow.appendChild(oCell)
       
Endscan
 
* Create and insert rows and cells into the footer row.
oRow = toDocument.createElement("TR")
oTFoot.appendChild(oRow)
oCell = toDocument.createElement("TD")
oRow.appendChild(oCell)
oCell.innerText = Textmerge("Total <<Reccount()>>")
oCell.colSpan = 4
oCell.bgColor = "lightskyblue"
 
* Set the innerText of the caption and position it at the bottom of the table.
oCaption.innerText = "Caption Here"
oCaption.Style.FontSize = "14 pt"
oCaption.Style.Color = "Blue"
oCaption.Align = "top"
Return oTable
 
Define Class HTMLViewerForm As Form
  DataSession = 2
  Top = 0
  Left = 0
  Height = 500
  Width = 800
  DoCreate = .T.
  Caption = "HTML sample"
  cHTML = ""
  cHTMFile = Forcepath(Sys(2015)+'.htm',Sys(2023))
  EmptyHTM = Forcepath('empty.htm',Sys(2023))
  DoNotErase = .F.
 
  Add Object htmlviewer As OleControl With ;
    Top = 0, Left = 0, Height = 500, Width = 800, Visible = .T., ;
    OleClass = 'Shell.Explorer'
 
  Procedure Init
  Text to m.lcBody noshow
<html>
<HEAD>
<STYLE>
.menuItem {font-family:sans-serif;font-size:10pt;width:100;padding-left:20;
   background-Color:menu;color:black}
.highlightItem {font-family:sans-serif;font-size:10pt;width:100;padding-left:20;
   background-Color:highlight;color:white}
.clickableSpan {padding:4;width:500;background-Color:blue;color:white;border:5px gray solid}
</STYLE>
 
<SCRIPT>
//<!--
 
function displayMenu() {
   whichDiv=event.srcElement;
   menu1.style.leftPos+=10;
   menu1.style.posLeft=event.clientX;
   menu1.style.posTop=event.clientY;
   menu1.style.display="";
   menu1.setCapture();
}
function switchMenu() {  
   el=event.srcElement;
   if (el.className=="menuItem") {
      el.className="highlightItem";
   } else if (el.className=="highlightItem") {
      el.className="menuItem";
   }
}
function clickMenu() {
   menu1.releaseCapture();
   menu1.style.display="none";
   el=event.srcElement;
   if (el.id=="mnuRed") {
      whichDiv.style.backgroundColor="red";
   } else if (el.id=="mnuGreen") {
      whichDiv.style.backgroundColor="green";  
   } else if (el.id=="mnuBlue") {
      whichDiv.style.backgroundColor="blue";  
   } else if (el.id=="mnuYellow") {
      whichDiv.style.backgroundColor="yellow";  
   }
}
 
//-->
</SCRIPT>
</HEAD>
 
<body oncontextmenu="if (!event.ctrlKey){displayMenu();return false;}">
<div id=menu1 onclick="clickMenu()" onmouseover="switchMenu()" onmouseout="switchMenu()" style="position:absolute;display:none;width:100;background-Color:menu; border: outset 3px gray">
<div class="menuItem" id=mnuRed>Red</div>
<div class="menuItem" id=mnuGreen>Green</div>
<div class="menuItem" id=mnuBlue>Blue</div>
<div class="menuItem" id=mnuYellow>Yellow</div>
</div><body></html>
  endtext
 
 
 
*   StrToFile('<HTML><BODY oncontextmenu="return  false"></BODY></HTML>',this.cHTMFile)
    StrToFile(m.lcBody,this.cHTMFile)
   
    This.htmlviewer.navigate2('file://'+this.cHTMFile)
*!*     This.htmlviewer.navigate2('about:blank')
*!*     With This.htmlviewer.Document
*!*       oBody = .createElement('body')
*!*       oBody.oncontextmenu = "return false"
*!*       .appendChild(oBody)
*!*     Endwith
  EndProc
   Procedure Destroy
   Erase (this.cHTMFile)
   endproc
 
  Procedure htmlviewer.Refresh
    Nodefault
  Endproc
 
  Procedure Resize
    This.htmlviewer.Height = This.Height
    This.htmlviewer.Width  = This.Width
  Endproc
Enddefine
Yen yaz 1907'ye yolla FB gelsin evinde yensin.
(sonra salaklar ciksin alin terine şike desin)

2

Re: Baska seyle ugrasirken eski koda denk geldim...

guzel bir kod hocam tesekkur , ufak bir duzeltme asagidaki

Visual Fox Pro
1

Select cust_id,company,contact,country,region from customer into cursor crsCustomer

olan satiri

Visual Fox Pro
1

Select cust_id,company,contact,country,region from (_samples +'data\customer') into cursor crsCustomer

seklinde degistirerek denerlerse arkadaslar hata almadan calistirabilirler

http://www.soykansoft.com/images/twitter.jpghttp://www.soykansoft.com/images/wp.jpghttp://www.soykansoft.com/images/blogger.jpg

3

Re: Baska seyle ugrasirken eski koda denk geldim...

Gerçekten güzel bir kod Üstad. Ellerine sağlık smile

Uğur
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır.  Türk Atasözü