رفتن به مطلب
  • 0

مشکل نمایش زیرگروه،سایر گروهها،در گروه های دیگر


amirjun32

سوال

توی برنامه پیامکیم این مشکل وجود داره که،اون محتوایی که مربوط به گروه اول هست،توی گروه دوم هم نمایش داده میشه،و برعکس(محتوای گروه دومم توی گروه اول)

چکارکنم که هر محتوا فقط توی گروه مربوط به خودش نشون داده بشه.

لینک ارسال
به اشتراک گذاری در سایت های دیگر

6 پاسخ به این سوال تاکنون داده شده است

ارسال‌های توصیه شده

هیشکی دیوانه نیست اینجوری به مانیتور خیره بشه و خط به خط کدو بخونه تا جواب شمارو بده *خواب*

لینک ارسال
به اشتراک گذاری در سایت های دیگر

سلام یا سورس یا کدشو بزار

لینک ارسال
به اشتراک گذاری در سایت های دیگر

سلام یا سورس یا کدشو بزار

لینکش رو واستون فرستادم تو خصوصی.

اون دوتا پیامکی ک هست،یکیش مال گروه عاشقانس،و یکی مال گروه طنز.ولی جفتش رو هردوجا نشون میده.

خیلی ممنون

لینک ارسال
به اشتراک گذاری در سایت های دیگر

دوست گرامی شما پیام خصوصی وقتی میکنید تنها من میتونم اونو ببینم و دوستانه دیگه نمیتونن!!! سورس رو اینجا پیوست کنید تا همه کار کنن امکان داره من فرصت نگاه کردن به سورس شما رو نداشته باشم و طول بکشه تا مشکل شما برطرف شه

لینک ارسال
به اشتراک گذاری در سایت های دیگر

دوست گرامی شما پیام خصوصی وقتی میکنید تنها من میتونم اونو ببینم و دوستانه دیگه نمیتونن!!! سورس رو اینجا پیوست کنید تا همه کار کنن امکان داره من فرصت نگاه کردن به سورس شما رو نداشته باشم و طول بکشه تا مشکل شما برطرف شه

لطفا اگه کسی میتونه کمکم کنه.خیلی لازمه.ممنون

اینم سورس برنامم:


actgroup1:
[left]
Sub Process_Globals


End Sub 


Sub Globals
Dim db As myDB
Dim list1 As List
Dim scrol1 As CustomListView


Private pnlMain As Panel
Private imgGroup As ImageView
Private lblGroup As Label


   Private btnSearch As Button
   Private txtSearch As EditText
   Private pnlSearch As Panel
   Private lblMain As Label

   Dim slide As SlidingMenu
   Private Panel2 As Panel
End Sub


Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("LMain1")
   myLibrary.createMenu(slide)


   db.Initialize
   list1.Initialize
   list1 = db.listGroup1
   scrol1.Initialize(Me,"scrol1Event")
   pnlMain.AddView(scrol1.AsView,0,52dip, 100%x,100%y-Panel2.Height)

   For i=0 To list1.Size - 1
       Dim p1 As Panel
       p1.Initialize("")
       scrol1.Add(p1,140dip,"")
       p1.LoadLayout("LPGroup1")

       Dim t1 As fGroup
       t1.Initialize
       t1 = list1.Get(i)

       lblGroup.Text = t1.Sgroup1
       imgGroup.SetBackgroundImage(LoadBitmap(File.DirAssets,t1.Simage1))

       lblGroup.Tag = t1.Sgroup1
       imgGroup.Tag = t1.Sgroup1

   Next


End Sub 


Sub Activity_Resume


End Sub


Sub Activity_Pause (UserClosed As Boolean)


End Sub




Sub subGroupShow_Click
   Dim v1 As View
   v1 = Sender
   'Msgbox(v1.Tag,"")
   'actSunGroup.vGroupName = v1.Tag
   StartActivity(actGroup2)
End Sub
'///////////////////[/left]

actgroup2:


[left]Sub Process_Globals


End Sub 


Sub Globals
Dim db As myDB
Dim list1 As List
Dim scrol1 As CustomListView


Private pnlMain As Panel
Private imgGroup As ImageView
Private lblGroup As Label


   Private btnSearch As Button
   Private txtSearch As EditText
   Private pnlSearch As Panel
   Private lblMain As Label

   Dim slide As SlidingMenu
   Private Panel2 As Panel
End Sub


Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("LMain2")
   myLibrary.createMenu(slide)


   db.Initialize
   list1.Initialize
   list1 = db.listGroup2
   scrol1.Initialize(Me,"scrol1Event")
   pnlMain.AddView(scrol1.AsView,0,52dip, 100%x,100%y-Panel2.Height)

   For i=0 To list1.Size - 1
       Dim p1 As Panel
       p1.Initialize("")
       scrol1.Add(p1,140dip,"")
       p1.LoadLayout("LPGroup2")

       Dim t1 As gGroup
       t1.Initialize
       t1 = list1.Get(i)

       lblGroup.Text = t1.Sgroup2
   '    imgGroup.SetBackgroundImage(LoadBitmap(File.DirAssets,t1.Simage2))

       lblGroup.Tag = t1.Sgroup2
       'imgGroup.Tag = t1.Sgroup2

   Next


End Sub 


Sub Activity_Resume


End Sub


Sub Activity_Pause (UserClosed As Boolean)


End Sub




Sub subGroupShow_Click
   Dim v1 As View
   v1 = Sender
   'Msgbox(v1.Tag,"")
   'actSunGroup.vGroupName = v1.Tag
   StartActivity(actGroup)
End Sub[/left]



[right]actgroup:
[/right]


[left]
Sub Process_Globals


End Sub 


Sub Globals
Dim db As myDB
Dim list1 As List
Dim scrol1 As CustomListView


Private pnlMain As Panel
Private imgGroup As ImageView
Private lblGroup As Label


   Private btnSearch As Button
   Private txtSearch As EditText
   Private pnlSearch As Panel
   Private lblMain As Label

   Dim slide As SlidingMenu
   Private Panel2 As Panel
End Sub


Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("LMain")
   myLibrary.createMenu(slide)


   db.Initialize
   list1.Initialize
   list1 = db.listGroup
   scrol1.Initialize(Me,"scrol1Event")
   pnlMain.AddView(scrol1.AsView,0,52dip, 100%x,100%y-Panel2.Height)

   For i=0 To list1.Size - 1
       Dim p1 As Panel
       p1.Initialize("")
       scrol1.Add(p1,140dip,"")
       p1.LoadLayout("LPGroup")

       Dim t1 As tGroup
       t1.Initialize
       t1 = list1.Get(i)

       lblGroup.Text = t1.Sgroup
       imgGroup.SetBackgroundImage(LoadBitmap(File.DirAssets,t1.Simage))

       lblGroup.Tag = t1.Sgroup
       imgGroup.Tag = t1.Sgroup

   Next


End Sub 


Sub Activity_Resume


End Sub


Sub Activity_Pause (UserClosed As Boolean)


End Sub




Sub subGroupShow_Click
   Dim v1 As View
   v1 = Sender
   'Msgbox(v1.Tag,"")
   actSunGroup.vGroupName = v1.Tag
   StartActivity(actSunGroup)
End Sub[/left]



[right]actsungroup:
[/right]



[left]Sub Process_Globals
   Dim vGroupName As String
   Dim search As List
End Sub


Sub Globals
   Dim db As myDB
   Dim list1 As List
   Dim scrol1 As CustomListView

   Private pnlParent As Panel
   Private lblGroup As Label
   Private lblBody As Label

   Dim offset As Int

   '-------------------------------
   Private imgBookmark As ImageView
   Private imgShare As ImageView
   Private imgMessage As ImageView
   Private imgEmail As ImageView
   '------------------------------- 

   Dim sFontSize,sFontColor,sFontFamily As String

   Dim set As AHPreferenceManager
   Private Panel2 As Panel
End Sub


Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("LsubGroup")

   '--------------------------------


   sFontSize = set.GetString("fontSize")
   sFontColor = set.GetString("fontColor")
   sFontFamily = set.GetString("fontFamily")
   '--------------------------------

   db.Initialize
   list1.Initialize
   scrol1.Initialize(Me,"scrol1Event")
   pnlParent.AddView(scrol1.AsView,0,53dip,100%x,100%y-Panel2.Height)


   If search.IsInitialized = False Then
       list1 = db.listsubGroup(vGroupName)
       lblGroup.Text = vGroupName
   Else
       list1 = search
       lblGroup.Text = "نتیجه جستجو"
   End If


   For i=0 To 2

       Dim t1 As tSMS
       t1.Initialize

       Try
       t1= list1.Get(i)
       Catch
       Return
       End Try

       Dim p1 As Panel
       p1.Initialize("")
       scrol1.Add(p1,195dip,"")
       p1.LoadLayout("LBody")

       Dim t1 As tSMS
       t1.Initialize

       t1= list1.Get(i)
       lblBody.Text = t1.Scontent

       '-----------------------------
       Try
           lblBody.TextSize = sFontSize
       Catch
       End Try

       If sFontColor = "Red" Then
           lblBody.TextColor = Colors.Red
       Else If sFontColor = "Green" Then
           lblBody.TextColor= Colors.Green
       Else If sFontColor = "Blue" Then
           lblBody.TextColor = Colors.Blue
       Else If sFontColor = "Yellow" Then
           lblBody.TextColor = Colors.Yellow
       End If

       Try
           lblBody.Typeface = Typeface.LoadFromAssets(sFontFamily)
       Catch
       End Try
       '-----------------------------


       imgBookmark.Tag = t1.Sid
       imgShare.Tag = t1.Scontent
       imgMessage.Tag = t1.Scontent
       imgEmail.Tag = t1.Scontent

       If myLibrary.checkBookmark(t1.Sid) = True Then
       imgBookmark.SetBackgroundImage(LoadBitmap(File.DirAssets,"star_B.png"))
       End If
   Next
   offset = 3
End Sub


Sub scrol1Event_Position(position As Int)


   If offset = list1.Size Then
   Return
   End If

   If position+scrol1.Height >=scrol1.PanelHeight Then
       For i=offset To offset+2

       Dim t1 As tSMS
       t1.Initialize

       Try
       t1= list1.Get(i)
       Catch
       Return
       End Try

       Dim p1 As Panel
       p1.Initialize("")
       scrol1.Add(p1,195dip,"")
       p1.LoadLayout("LBody")        
       lblBody.Text = t1.Scontent

       '-----------------------------
       Try
           lblBody.TextSize = sFontSize
       Catch
       End Try

       If sFontColor = "Red" Then
           lblBody.TextColor = Colors.Red
       Else If sFontColor = "Green" Then
           lblBody.TextColor= Colors.Green
       Else If sFontColor = "Blue" Then
           lblBody.TextColor = Colors.Blue
       Else If sFontColor = "Yellow" Then
           lblBody.TextColor = Colors.Yellow
       End If

       Try
           lblBody.Typeface = Typeface.LoadFromAssets(sFontFamily)
       Catch
       End Try
       '-----------------------------

       lblGroup.Text = vGroupName

       imgBookmark.Tag = t1.Sid
       imgShare.Tag = t1.Scontent
       imgMessage.Tag = t1.Scontent
       imgEmail.Tag = t1.Scontent

       If myLibrary.checkBookmark(t1.Sid) = True Then
       imgBookmark.SetBackgroundImage(LoadBitmap(File.DirAssets,"star_B.png"))
       End If
   Next
   offset = offset +3
   End If
End Sub


Sub Activity_Resume


End Sub


Sub Activity_Pause (UserClosed As Boolean)


End Sub[/left]



[right]mydb:
[/right]


[left]'Class module
Sub Class_Globals
   Dim sql1 As SQL
   Type tGroup(Sgroup As String,Simage As String)
   Type fGroup(Sgroup1 As String,Simage1 As String)
   Type gGroup(Sgroup2 As String,Simage2 As String)
   Type tSMS(Sid As Int,Scontent As String,Sread As Int, Sstar As Int)
End Sub


'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
If File.Exists(File.DirInternal,"SMS.db")= False Then
   File.Copy(File.DirAssets,"SMS.db",File.DirInternal,"SMS.db")
End If
sql1.Initialize(File.DirInternal,"SMS.db",False)
End Sub


Sub listGroup As List
   Dim cur As Cursor
   Dim list1 As List

   list1.Initialize
   cur = sql1.ExecQuery("SELECT Sgroup,(SELECT Simage FROM tblImage  WHERE Sgroup = tblSMS.Sgroup) as Simage from tblSMS GROUP BY Sgroup")

   For i=0 To cur.RowCount-1
   cur.Position = i
   Dim t1 As tGroup
   t1.Initialize
   t1.Sgroup = cur.GetString("Sgroup")
   t1.Simage = cur.GetString("Simage")
   list1.Add(t1)
   Next

   Return list1
End Sub
'////////////
Sub listGroup1 As List
   Dim cur As Cursor
   Dim list1 As List

   list1.Initialize
   cur = sql1.ExecQuery("SELECT Sgroup1,(SELECT Simage1 FROM tblImage  WHERE Sgroup1 = tblSMS.Sgroup1) as Simage1 from tblSMS GROUP BY  Sgroup1")

   For i=0 To cur.RowCount-1
   cur.Position = i
   Dim t1 As fGroup
   t1.Initialize
   t1.Sgroup1 = cur.GetString("Sgroup1")
   t1.Simage1 = cur.GetString("Simage1")
   list1.Add(t1)
   Next

   Return list1
End Sub
'//////////////////
Sub listGroup2 As List
   Dim cur As Cursor
   Dim list1 As List

   list1.Initialize
   cur = sql1.ExecQuery("SELECT Sgroup2 from tblSMS GROUP BY Sgroup2")

   For i=0 To cur.RowCount-1
   cur.Position = i
   Dim t1 As gGroup
   t1.Initialize
   t1.Sgroup2 = cur.GetString("Sgroup2")
   list1.Add(t1)
   Next

   Return list1
End Sub


Sub listsubGroup(groupName As String) As List
   Dim cur As Cursor
   Dim list1 As List

   list1.Initialize
   cur = sql1.ExecQuery("SELECT * from tblSMS where Sgroup = '"&groupName&"'")

   For i=0 To cur.RowCount-1
   cur.Position = i
   Dim t1 As tSMS
   t1.Initialize
   t1.Sid = cur.GetInt("Sid")
   t1.Scontent = cur.GetString("Scontent")
   t1.Sread = cur.GetInt("Sread")
   t1.Sstar = cur.GetInt("Sstar")
   list1.Add(t1)
   Next

   Return list1
End Sub

Sub changeRead(Sid As String , Sread As Int) As Boolean
   If Sid="" Then
       Return False
   End If
sql1.ExecNonQuery2("update tblSMS set Sread = ? where Sid = ?",Array As String(Sread,Sid))
Return True
End Sub 


Sub changeStar(Sid As String , SRate As Int) As Boolean
   If Sid="" Then
       Return False
   End If
sql1.ExecNonQuery2("update tblSMS set Sstar = ? where Sid = ?",Array As String(SRate,Sid))
Return True
End Sub


Sub getSMS(Sid As String) As tSMS
   Dim cur As Cursor
   cur = sql1.ExecQuery2("select * from tblSMS where Sid = ?",Array As String (Sid))
   cur.Position = 0
   Dim t1 As tSMS
   t1.Initialize
   t1.Scontent = cur.GetString("Scontent")
   t1.Sid = cur.GetInt("Sid")
   t1.Sread  = cur.GetInt("Sread")
   t1.Sstar = cur.GetInt("Sstar")

   Return t1
End Sub 


Sub searchItem(str As String) As List
   Dim cur As Cursor
   Dim list1 As List

   list1.Initialize
   cur = sql1.ExecQuery("select * from tblSMS where Scontent LIKE '%"&str&"%'")

   For i =0 To cur.RowCount - 1
       cur.Position = i
       Dim t1 As tSMS
       t1.Initialize

       t1.Scontent = cur.GetString("Scontent")
       t1.Sid = cur.GetInt("Sid")
       t1.Sread = cur.GetInt("Sread")
       t1.Sstar = cur.GetInt("Sstar")

       list1.Add(t1)
   Next 
   Return list1
End Sub


Sub getSMSCount As String 
   Dim s1 As String
   s1 = sql1.ExecQuerySingleResult("select COUNT(*) from tblSMS")
   Return s1
End Sub
[/left]


لینک ارسال
به اشتراک گذاری در سایت های دیگر

بایگانی شده

این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.

  • کاربران آنلاین در این صفحه   0 کاربر

    • هیچ کاربر عضوی،در حال مشاهده این صفحه نیست.
×
×
  • اضافه کردن...