forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


command for GOTO Line number in EDIT box +LIST box

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 634
Location: Central East Indiana 47331

PostPosted: Tue Sep 08, 2020 12:50 am    Post subject: command for GOTO Line number in EDIT box +LIST box Reply with quote

hello

Looking for below: <searched all day -- fail> Stupid
A command to GOTO certain Line number in
a EDIT box <and/OR> LIST box.
<hope I don't need line num's loaded in box(s)>

I'm thinking I used to have a API function for this, or maybe not.
Checked MAC's example {awesome} but not in there.
A solution would be highly appreciated. Smile

*Trying to create some bookmarks in my
homemade .slo editor for my old game.

hope everyone is doing well, by the way.
Thanks & cheers Cool
Back to top
View user's profile Send private message Visit poster's website AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1739
Location: Space and Time

PostPosted: Fri Sep 11, 2020 5:48 pm    Post subject: Reply with quote

Try this API code:

Windows = (Windows NT, Windows 95, Windows 98, Win32's)
wParam = (WPARAM) index;// item index
lParam = (LPARAM) fScroll; // flag for scrolling item
Message ID = $019E

Description: An application sends an LB_SETCARETINDEX message to set the focus rectangle to the item at the specified index in a multiple-selection list box. If the item is not visible, it is scrolled into view. This only shows the item it does not make it selected or clicked.

Parameters

WPARAM INDEX VALUES

Value of wParam. Specifies the zero-based index of the list box item that is to receive the focus rectangle.

LPARAM FSCROLL VALUES

Value of lParam. Specifies whether to scroll to the item or not.

Value Meaning
0 Item is scrolled until fully visible
1 Item is scrolled until partially visible
Return Value: If an error occurs, the return value is -1.

Sample Source Code


Code:
title TEST
   DIALOG CREATE,TEST,-1,0,213,215
   DIALOG ADD,BUTTON,BUTTON1,170,70,,,,DEFAULT
   DIALOG ADD,LIST,LIST1,10,12
   DIALOG SHOW
:evloop
   wait event
   goto @event()
:BUTTON1BUTTON
   list add,list1,Hello World
   list add,list1,VDS is Cool
   list add,list1,This is the API
   list add,list1,Reference made
   list add,list1,by S.A.D.E. s.a.r.l.
   list add,list1,I hope everyone
   list add,list1,uses this in their
   list add,list1,VDS Programs
   list add,list1,Later All
   list add,list1,Good Bye
   list add,list1,Hello World
   list add,list1,VDS is Cool
   list add,list1,This is the API
   list add,list1,Reference made
   list add,list1,by S.A.D.E. s.a.r.l.
   list add,list1,I hope everyone
   list add,list1,uses this in their
   list add,list1,VDS Programs
   list add,list1,Later All
   list add,list1,Good Bye
   %A = @sendmsg(@win(~LIST1),$019E,14,1)
   warn %A
   rem Sets the anchor index to index 14 and scrolls to make it partially visible
   rem This only sets the index to position 14 without making it selected.
   goto evloop
:CLOSE
   exit

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 634
Location: Central East Indiana 47331

PostPosted: Tue Sep 15, 2020 12:09 am    Post subject: Reply with quote

Thanks a million time LiquidCode.

VDS7 would be nice with a compatibility
option in the compile menu area Laughing

I've made my Win10 pro 64bit desktop look like win98.
*so now I'm spoiled not to use win98 or XP.

If I could have not compiled to exe without error
I was gonna try setting the exe to win98 mode.

But I knew all that was just a dream Cool

I thought of another non-API alternative the other day that
may do the job -- much rather have API though Smile

I have all that API stuff laying around, just
couldn't ever figure it out Embarassed
I have too many things to fix and not enough brains Rolling Eyes

I appreciate the SADE code though Wink
..and your fast help and time.

cheers -- thanks again
Back to top
View user's profile Send private message Visit poster's website AIM Address
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 634
Location: Central East Indiana 47331

PostPosted: Wed Sep 16, 2020 2:28 am    Post subject: Reply with quote

I got the LIST box way working thanks to LiquidCode, but it turns
out I need the EDIT box API before it will work. Insane

Below is a small EXAMPLE of the LIST box API:

Code:
#   previous code = S.A.D.E. for win98 <located by LiquidCode>
#   win10: HAVE TO GET THE LIST BOX 'ID number' FIRST
#   This works on LIST box, but not EDIT box.
#   
TITLE ListBox TEST
   DIALOG CREATE,ListBox TEST,-1,0,280,360
   DIALOG ADD,LIST,LIST1,10,10,260,310
   DIALOG ADD,BUTTON,RUN,328,120,40,24,,DEFAULT

   DIALOG SHOW

:evloop
   wait event
   goto @event()

:runBUTTON
   list add,list1,Hello World
   list add,list1,VDS is Cool
   list add,list1,This is the API
   list add,list1,Reference made
   list add,list1,by S.A.D.E. s.a.r.l.
   list add,list1,I hope everyone
   list add,list1,uses this in their
   list add,list1,VDS Programs
   list add,list1,Later All
   list add,list1,Good Bye
   list add,list1,Hello World
   list add,list1,VDS is Cool
   list add,list1,This is the API
   list add,list1,Reference made
   list add,list1,by S.A.D.E. s.a.r.l.
   list add,list1,I hope everyone
   list add,list1,uses this in their
   list add,list1,VDS Programs
   list add,list1,Later All
   list add,list1,Good Bye


%q = @winexists(~LIST1)
WAIT 0.2

# below PRED for zero counting:
%u = @sendmsg(%q,$019E,@PRED(14),1)
WAIT 0.2

# added visualality for testing purposes:
dialog focus,LIST1
WINDOW SEND,%q,@KEY(up)

 goto evloop

:close
EXIT


Thanks again LiquidCode Cool
Back to top
View user's profile Send private message Visit poster's website AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 700
Location: Evansville, IN

PostPosted: Sat Oct 03, 2020 3:48 am    Post subject: Reply with quote

EM_LINEINDEX As Int: = $BB

?
(use with @sendmsg)
Back to top
View user's profile Send private message AIM Address
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 634
Location: Central East Indiana 47331

PostPosted: Sat Oct 03, 2020 6:58 am    Post subject: Reply with quote

Thanks a millionTrillion cnodnarb Very Happy


I'll give it a whirl asap Dancing Banana


cheers <appreciate it highly>

Smile
Back to top
View user's profile Send private message Visit poster's website AIM Address
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 634
Location: Central East Indiana 47331

PostPosted: Sat Oct 24, 2020 4:04 am    Post subject: Reply with quote

I guess I did something wrong, so the EDIT-box API fails.
So I created this simple test tool to try to get it working.

Code:

DIALOG CREATE,New Dialog,-1,0,290,190
DIALOG ADD,STYLE,STYLE1,calibri,12,b,,0|110|0
DIALOG ADD,STYLE,STYLE2,calibri,11,b,,140|10|10
DIALOG ADD,STYLE,STYLE3,calibri,10,b,27|27|27,yellow
DIALOG ADD,STYLE,STYLE4,Arial Black,12,b,,240|20|20

  DIALOG ADD,extTEXT,ListTXT,8,10,,,"LIST box",,STYLE1
  DIALOG ADD,extTEXT,EditTXT,8,120,,,"EDIT box",,STYLE1
  DIALOG ADD,extTEXT,resultTXT,10,184,,,"RESULT"<COLOR=white>" = ",,STYLE3
  dialog hide,resultTXT
  DIALOG ADD,extTEXT,result,6,238,,,,,STYLE4
  DIALOG ADD,LIST,LIST1,30,10,82,125
  DIALOG ADD,EDIT,EDIT1,30,100,180,125,,,,multi,scroll
  DIALOG ADD,BUTTON,List,160,10,,,"LIST test",,,HAND
  DIALOG ADD,BUTTON,Edit,160,120,,,"EDIT test",,,HAND
  DIALOG ADD,extTEXT,status,173,274,,,"00",,STYLE2
#>>>>>>>>>>
DIALOG SHOW
#>>>>>>>>>>

%%numLIST = @NEW(LIST)

:evloop
 wait event,0.1
goto @event()

:TIMER
goto evloop

:ListBUTTON
 dialog CLEAR,status
 %%LL = @winexists(~LIST1)
 WAIT 0.2
 LIST CLEAR,LIST1
 #  begin populate LIST field:
 %%count = 1
 REPEAT
  LIST add,LIST1,%%count
  %%count = @succ(%%count)
  WAIT 0.02
  dialog set,status,@PRED(%%count)
 UNTIL @greater(%%count,30)
 WAIT 0.1
 # below PRED for zero counting:
 %%msgLIST = @sendmsg(%%LL,$019E,@PRED(5),1)
 WAIT 0.1
 # must keep focus:
 dialog focus,LIST1
 WINDOW SEND,%%LL,@KEY(up)
goto evloop

:EditBUTTON
 dialog CLEAR,status
 dialog clear,EDIT1
 dialog hide,result
 dialog hide,resultTXT
 %%ED = @winexists(~EDIT1)
 WAIT 0.2
 # populate EDIT field:
 %%count = 1
 REPEAT
  LIST add,%%numLIST,%%count
  %%count = @succ(%%count)
  WAIT 0.02
  dialog set,status,@PRED(%%count)
 UNTIL @greater(%%count,30)
 dialog set,EDIT1,@TRIM(@TEXT(%%numLIST))
 WAIT 0.1
 # get topmost visible line in edit field
 rem %a = @sendmsg(%%ED,$0CE,0,0)
 WAIT 0.2
 #-----------------------------
 #   EM_LINEINDEX As Int: = $BB
 #   ?
 #   (use with @sendmsg)
 #-----------------------------
 dialog SHOW,result
 dialog SHOW,resultTXT
 # below PRED for zero counting:
 %%lineINDEX = @sendmsg(%%ED,$BB,7,0)
 rem %%lineIndex2 = @sendmsg(%%ED,$019E,@PRED(5),1)
 dialog set,result,%%lineINDEX
 WAIT 0.2
 # must keep focus:
 dialog focus,EDIT1
 rem WINDOW SEND,%%ED,@KEY(down)
goto evloop

:close
 LIST CLOSE,%%numLIST
 LIST CLOSE,LIST1
exit


It doesn't move to the EDIT-box RESULT line number.
Also, wondering why the result needs divided by 3 ?
If I were half as smart as you, I could fix it myself Laughing Don't know
Cool
Back to top
View user's profile Send private message Visit poster's website AIM Address
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 634
Location: Central East Indiana 47331

PostPosted: Tue Oct 27, 2020 11:18 pm    Post subject: Reply with quote

Concerning EDIT box below:
At first I thought maybe it was dividing the total lines by 3 for the result.
So I tried 10 at 100 lines and it equaled 31
So I tried 7 at 100 lines and it equaled 21
So I tried 10 at 50 lines and it equaled 31
So I tried 4 at 50 lines and it equaled 12

Looks like its just dividing the first number by approximately 3.
That tells me hex converting prolly won't do it.
I have not thought to nor know how to try.

hmm
Anyone have a hint or clue or resolution?
Thanks in advance..
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group