Search the web
Sign In
New User? Sign Up
hotbasic
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 17202 - 17232 of 17232   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#17232 From: doctor electron <doctorelectron@...>
Date: Sat Nov 28, 2009 12:31 pm
Subject: Re: [HotBasic] one of those days: onclick not working for me
globalservices1
Offline Offline
Send Email Send Email
 
>  onclick=who_clicked

We've all seen programs that require both .OnMouseDown and a
subsequent .OnMouseUp in the same object to confirm a "click"
with code something like

defint objxclick
'code
   onmousedown=objx_down
   onmouseup=objx_up
'code
objx_down:
inc(objxclick)  'set flag
return

objx_up:
if objxclick then
   objxclick=zero  'clear flag
' your click action code here
end if
return

where one might note that a mouse up in the object does nothing
without a prior mouse down also in the object.

Cheers, j

#17231 From: doctor electron <doctorelectron@...>
Date: Sat Nov 28, 2009 12:22 pm
Subject: Re: [HotBasic] one of those days: onclick not working for me
globalservices1
Offline Offline
Send Email Send Email
 
>  onclick=who_clicked

Addendum:  Surprisingly, for a whole range of purposes,
.OnMouseUp may be preferable to .OnMouseDown.  Why?  What if
mouse down is in the FORM (in your example), but the user moves
the mouse outside the FORM before mouse up.  Many users are
familiar with this GUI interface action -- namely, nothing
happens.  Therefore, many coders opt to use .OnMouseUp to ensure
that a "completed click" occurs *within* the object of interest.
Cheers, J

#17230 From: doctor electron <doctorelectron@...>
Date: Sat Nov 28, 2009 12:12 pm
Subject: Re: [HotBasic] one of those days: onclick not working for me
globalservices1
Offline Offline
Send Email Send Email
 
>  onclick=who_clicked

Oh, that's easy; .OnClick is a WM_COMMAND message, and with a
little reflection, one might appreciate that a FORM does not
send such a message to itself (or if it did, would probably need
some psychiatric medication -- ;); you know, like those people
talking to themselves in parks in your village).

Please try .OnMouseDown and you will be open for business!
Cheers, Jim

#17229 From: doctor electron <doctorelectron@...>
Date: Sat Nov 28, 2009 12:08 pm
Subject: Re: [HotBasic] Re: Create f as Form followed by Dim b as Button causes Error missing =
globalservices1
Offline Offline
Send Email Send Email
 
>end create
>
>
>DIM b(16) As LABEL

Missing "END CREATE" for the FORM before your DIM statement
(which, obviously, cannot appear in a CREATE block).  ;) j

#17228 From: doctor electron <doctorelectron@...>
Date: Sat Nov 28, 2009 12:06 pm
Subject: Re: [HotBasic] Re: create form as variable type
globalservices1
Offline Offline
Send Email Send Email
 
>How do I truncate the leftMost byte of dword

i=i and &HFFFFFF  'clear most significant byte

;) j

#17227 From: doctor electron <doctorelectron@...>
Date: Sat Nov 28, 2009 12:04 pm
Subject: Re: [HotBasic] Re: create form as variable type
globalservices1
Offline Offline
Send Email Send Email
 
>lb1.additems ("ExStyle= "+HEX$(window(sender).ExStyle))

Without the unneeded (), we have

lb1.additems "ExStyle= "+HEX$(window(sender).ExStyle)

If above does not work, note you have a rather complex numeric
function as an argument in a string concatenation statement.
First response would always be -- simplify.  Use one of your
scratch variables (you have them right) as follows:

i = window(sender).ExStyle
lb1.additems "ExStyle= "+HEX$(i)

SUMMARY:  window().something is manna-from-heaven power syntax;
just get your value and be happy.  Regards, jim

#17225 From: "vmars316" <vmars316@...>
Date: Sat Nov 28, 2009 1:24 am
Subject: Re: create form as variable type
vmars316
Offline Offline
Send Email Send Email
 
Oops, I should ask is "How do I truncate the leftMost byte of dword",
for hex$ ?
Thanks...vmars

--- In hotbasic@yahoogroups.com, doctor electron <doctorelectron@...> wrote:
>
> >Yes, that's a good idea. I'll write a small program to capture all the styles
and classes to see how it works and apply them accordingly.
>
> Great!  If you want to share your results in tabular form (with
> .style and .exstyle in hex for easy cross-reference with data in
> HBguidef.inc), that would be most welcome and I could add it to
> the Manual.  Regards, j
>

#17224 From: "vmars316" <vmars316@...>
Date: Fri Nov 27, 2009 11:36 pm
Subject: Re: create form as variable type
vmars316
Offline Offline
Send Email Send Email
 
Jim,
How do i convert ExStyle to hex?
I thought this might do it:
lb1.additems ("ExStyle= "+HEX$(window(sender).ExStyle))

Thanks...vmars

--- In hotbasic@yahoogroups.com, doctor electron <doctorelectron@...> wrote:
>
> >Yes, that's a good idea. I'll write a small program to capture all the styles
and classes to see how it works and apply them accordingly.
>
> Great!  If you want to share your results in tabular form (with
> .style and .exstyle in hex for easy cross-reference with data in
> HBguidef.inc), that would be most welcome and I could add it to
> the Manual.  Regards, j
>

#17223 From: "vmars316" <vmars316@...>
Date: Fri Nov 27, 2009 11:24 pm
Subject: Re: Create f as Form followed by Dim b as Button causes Error missing =
vmars316
Offline Offline
Send Email Send Email
 
Here's the actual code:

create fm91 As FORM
   caption="fm91"
   top=50:left=50
   onresize=Resize_all
'  onclick= Resize_all
   OnPaint = paintfm91 '<=== ADD THIS FOR PAINTING fm91
   OnClick=addobj
   height=750
   width=1250
   ShowHint = True

create lbl80 as LABEL
   left=0: top=2
   width=120: height=20
   caption="CLICK to CREATE"
   Style = lbl80.Style OR SS_CENTER
   font=font1
   color=&H9F92B7
   textcolor=&HFFFFFF '&HFFFFEE white
   OnMouseDown=movebtn                       '  <=== remove after testing
end create


DIM b(16) As LABEL
.parent=fm91
FOR i = 0 TO 15
b(i).ExStyle=b(i).ExStyle OR &HB
b(i).height=22: b(i).width=120
b(i).Parent=fm91: b(i).Color=&HFFFFEE
b(i).left=0: b(i).top=24+i*25
b(i).caption=STR$(i): b(i).font=tahoma_18
b(i).onclick=who_clicked_create
NEXT i
'
f$.extractres "Design_ini": f$.position=zero

If f$.length then
FOR i = 0 TO 15
b(i).caption=f$.readline  '  "    TABCONTROL     , SysTabControl32"
NEXT i
ELSE
   Showmessage("Program ABORTED: TXTool.ini file must reside in same FOLDER as
TXTool.exe !")
   Exit_pgm
end if ' If Len(f$)


create lbl81 as LABEL
   left=0: top=24
   width=120: height=20
   caption="LISTVIEW ,SysListView32"
   Style = lbl81.Style OR SS_LEFT
   font=font1
   hint="this is a lbl81 hint"
   color=&HFFFFEE
   textcolor=&H493E5D
   OnClick=who_clicked_create
end create

...
.
.
.
   showmodal

end create ' fm91 As FORM

Thanks...vmars
>
--- In hotbasic@yahoogroups.com, doctor electron <doctorelectron@...> wrote:
>
> >create form1 As FORM ' this causes ERROR Missing = DIM b(6,3) As BUTTON

#17222 From: doctor electron <doctorelectron@...>
Date: Fri Nov 27, 2009 7:00 am
Subject: Re: [HotBasic] Create f as Form followed by Dim b as Button causes Error missing = Dim
globalservices1
Offline Offline
Send Email Send Email
 
>create form1 As FORM ' this causes ERROR Missing = DIM b(6,3) As BUTTON
>'DIM form1 As FORM    ' this works fine
>DIM b(6,3) As BUTTON

Looks like all you have missing is "END CREATE" before your DIM
statement.  j

#17221 From: doctor electron <doctorelectron@...>
Date: Fri Nov 27, 2009 6:56 am
Subject: Re: [HotBasic] Re: create form as variable type
globalservices1
Offline Offline
Send Email Send Email
 
>Yes, that's a good idea. I'll write a small program to capture all the styles
and classes to see how it works and apply them accordingly.

Great!  If you want to share your results in tabular form (with
.style and .exstyle in hex for easy cross-reference with data in
HBguidef.inc), that would be most welcome and I could add it to
the Manual.  Regards, j

#17220 From: "vmars316" <vmars316@...>
Date: Fri Nov 27, 2009 2:41 am
Subject: Create f as Form followed by Dim b as Button causes Error missing = Dim
vmars316
Offline Offline
Send Email Send Email
 
My pgm is all 'Create as' definitions.
I need to add a DIM b(6,3) as BUTTON .
But can't seem to add this DIM .
I really don't want to change pgm structure to all DIMs.
Do I have to?
Distilled source below:

defint i,j
create form1 As FORM ' this causes ERROR Missing = DIM b(6,3) As BUTTON
'DIM form1 As FORM    ' this works fine
DIM b(6,3) As BUTTON
FOR i = 0 TO 6: FOR j = 0 to 3
b(i,j).height=20: b(i,j).width=100
b(i,j).left=10+j*100: b(i,j).top=10+i*20
b(i,j).caption = STR$(i)+comma+str$(j)
NEXT j: NEXT i
form.showmodal
END

Thanks...vmars

#17219 From: "vmars316" <vmars316@...>
Date: Fri Nov 27, 2009 1:56 am
Subject: Re: create form as variable type
vmars316
Offline Offline
Send Email Send Email
 
Great.
When you complete it, pls post it here.
Here is something I have started:


' vmars316
$apptype gui
deflng vhWnd, sender=hWnd

dim font1 As font
font1.Name="Tahoma"
font1.Height=18
font1.Weight=400

create f1 as FORM
   left=0: top=0
   width=600: height=300
   caption="Show Defaults"
   onclick=show_click
   font=font1

create b1 as BUTTON
   left=10: top=10
   width=100: height=20
   caption="Button"
   onclick=show_click
   font=font1
end create

create cb1 as CHECKBOX
   left=10: top=b1.top+24
   width=100: height=20
   caption="CheckBox"
   onclick=show_click
   font=font1
end create

create gb1 as GROUPBOX
   left=10: top=cb1.top+24
   width=100: height=20
   caption="GroupBox"
   visible=false
   font=font1
end create

create gb2 as BUTTON
     left=10: top=cb1.top+24
     width=100: height=20
     caption="GroupBox"
     onclick=show_click
     font=font1
end create

create lb1 as LISTBOX
   left=300: top=0
   width=300: height=300
   onclick=show_click
   font=font1
'  color=&H0000FF
end create

create panel1 as PANEL
   left=10: top=gb1.top+24
   width=100: height=20
   caption="Panel"
   onclick=show_click
   font=font1
end create

create rb1 as RADIOBUTTON
   left=10: top=panel1.top+24
   width=100: height=20
   caption="RadioButton"
   onclick=show_click
   font=font1
end create

showmodal
end create

show_click:
sender=hWnd
IF sender=gb2.handle Then sender=gb1.handle ' groupbox = no onclick
vwHnd=sender
lb1.clear
lb1.additems ("Caption= "+window(sender).Caption)
lb1.additems ("Class= "+window(sender).class)
lb1.additems ("Color= "+HEX$(window(sender).Color))
lb1.additems ("Cursor= "+STR$(window(sender).Cursor))
lb1.additems ("ExStyle= "+HEX$(window(sender).ExStyle))
lb1.additems ("Font= "+STR$(window(sender).Font))
lb1.additems ("Height= "+STR$(window(sender).Height))
lb1.additems ("hWnd= "+STR$(sender)+"  "+("Handle=
"+STR$(window(sender).handle)))
lb1.additems ("ID= "+STR$(window(sender).ID))
lb1.additems ("Parent= "+STR$(window(sender).Parent))
lb1.additems ("Style= "+HEX$(window(sender).Style))
lb1.additems ("Text= "+window(sender).Text)
lb1.additems ("Width= "+STR$(window(sender).Width))

return

#17218 From: "tenox1" <as@...>
Date: Thu Nov 26, 2009 11:21 pm
Subject: Re: create form as variable type
tenox1
Offline Offline
Send Email Send Email
 
Yes, that's a good idea. I'll write a small program to capture all the styles
and classes to see how it works and apply them accordingly.

Thanks a lot for help!

--- In hotbasic@yahoogroups.com, doctor electron <doctorelectron@...> wrote:
>
> >Is is possible to declare
> >
> >create myform as var
> >
> >so that the var becomes either form or splash (or whatever else) depending on
configuration done after compile time (ie in a config file at runtime)?
>
> At present, the type designation (var above) has to be a literal
> (e.g., FORM).  Your message does raise the question as to
> whether it might be desirable to be able to use a string
> variable there. [I tried "FORM" in quotes and that works, but
> that's a literal also; whereas a string with the value "FORM"
> does not work (e.g., defstr var="FORM").
>
> That said, you still have the problem that "myform" above is
> fixed user symbol.  An array of FORM objects frees you from the
> definiteness of the user symbol:
>
> dim myform(9) as FORM
>
> Now to your specific concern, you can do what you want!  Just
> change the .Style and/or .Exstyle to whatever you want -- then
> it can be a "splash" or other variant of Windows' forms, and
> this can be done on individual objects or members of an array as
> above.
>
> Summary:  A FORM object array can contain any mix of the FORM
> objects.  You DIM it as something and then use .Class to change
> that, along with .Style and if necessary .ExStyle.  E.g., the
> Windows BUTTON class handles HB's BUTTON, PANEL, GROUPBOX,
> CHECKBOX, RADIOBUTTON (and more?) all depending on the .Style.
>
> Somebody might want to make a database of the HB FORM object
> types, and for each, the default Windows .Class name, and HB's
> default .Style and .ExStyle.  These three items are all
> printable values (readable in a little test program).
>
> HTH, cordially, Jim
>

#17217 From: doctor electron <doctorelectron@...>
Date: Thu Nov 26, 2009 6:09 am
Subject: Re: [HotBasic] Re: How to get '.hint' programatically?
globalservices1
Offline Offline
Send Email Send Email
 
>Is there another LABEL text field that is available for such use?

Sure.  You mentioned .Tag, which could contain

(1) a pointer to a string (@mystring) which could be used to
retrieve the string with BYREF$(), or indeed,

(2) an .Item() index to a LIST.  E.g., if .Tag = 2, it refers to
MyList.Item(2), or, for that matter.

(3) the index to a STRING array item.

Summary:  numeric items like .Tag can be used for read/write
access to string data.  [This applies also to the NODE object's
content.]

Cheers, Jim

#17216 From: "vmars316" <vmars316@...>
Date: Thu Nov 26, 2009 12:59 am
Subject: Re: How to get '.hint' programatically?
vmars316
Offline Offline
Send Email Send Email
 
Thanks, I didn't realize that BalloonTip, ToolTip were related to Hint.
Knowing that i searched yahoo for tooltip, and found balloontip.bas .
What I am doing, is using a (colorful)LABEL instead of a BUTTON.
And though the LABEL caption says TRACKBAR ,
I need to pass the real classname "msctls_trackbar32" to
my CreateWindow function.
So i thought, well i'll just pass that info in .Hint .
Ugh, what an ordeal.

I first thought of .tag , but turns out .tag  needs to be numeric.

So, my other options, so far, are build an array of classnames,
or pass info as part of .caption,
ie., "    TRACKBAR    , msctls_trackbar32" . (ss_left)

btw: Is there another LABEL text field that is available for such use?

Thanks...vmars

#17215 From: doctor electron <doctorelectron@...>
Date: Wed Nov 25, 2009 9:39 pm
Subject: Re: [HotBasic] How to get '.hint' programatically?
globalservices1
Offline Offline
Send Email Send Email
 
>An example of get/set hint

Maybe there is a reason why there have been no requests to read
(get) .Hint text -- namely, the program already knows it, since
the program sets it.  Maybe the simple solution is simply to
warehouse your hint text in a LIST or STRING array, and just
read it when you need it elsewhere in the program.  I can think
of multi-language applications where all text is English,
French, etc.  In that case, the LISTs of language-specific text
might well be resources which are extracted and used based on
user preference (applicable to title, menu, label and other text
content).  Cheers, Jim

#17214 From: doctor electron <doctorelectron@...>
Date: Wed Nov 25, 2009 6:22 pm
Subject: Re: [HotBasic] How to get '.hint' programatically?
globalservices1
Offline Offline
Send Email Send Email
 
>These:
>createThisClass=window(hWnd_clicked_create).hint
>createThisClass=lbl81.hint
>don't work.

Above is truly an outstanding example of a creative being at
work!  I tried that, too.  Outside my window is a beautiful
mountain high enough to have its peak covered on a cloudy day.
I tried a "vmars", namely, standing before the mountain, hands
raised to heavens, and loudly pronounced, "O ye mountain, move
ye 100 yards to the south!"  Well, that "don't work" either.

>An example of get/set hint, would be great.

The hotwin.bas demo shows how to set hints.  It's a two step
process: (1) the main form has .ShowHint=true and (2) individual
objects have a .Hint = "never click here" statement.

Hmm.  To get the present .Hint text, I guess a sendmessage()
would do the trick, using hbHint as the "tooltip" handle and the
handle of the object for which you want to get the hint text.

To research this further, you'd look at the tooltip messages
available, choose the one that returns the text (pointer) and
use that one.  Probably it returns a pointer, so we would use
BYREF$() to get the actual string in our warm live hands (after
checking the pointer is valid -- not zero or negative).

Editorial:  I love it when HB user's are pushing the limits of
what the Windows OS can do!

Cheers, Jim

#17213 From: doctor electron <doctorelectron@...>
Date: Wed Nov 25, 2009 6:01 pm
Subject: Re: [HotBasic] create form as variable type
globalservices1
Offline Offline
Send Email Send Email
 
>Is is possible to declare
>
>create myform as var
>
>so that the var becomes either form or splash (or whatever else) depending on
configuration done after compile time (ie in a config file at runtime)?

At present, the type designation (var above) has to be a literal
(e.g., FORM).  Your message does raise the question as to
whether it might be desirable to be able to use a string
variable there. [I tried "FORM" in quotes and that works, but
that's a literal also; whereas a string with the value "FORM"
does not work (e.g., defstr var="FORM").

That said, you still have the problem that "myform" above is
fixed user symbol.  An array of FORM objects frees you from the
definiteness of the user symbol:

dim myform(9) as FORM

Now to your specific concern, you can do what you want!  Just
change the .Style and/or .Exstyle to whatever you want -- then
it can be a "splash" or other variant of Windows' forms, and
this can be done on individual objects or members of an array as
above.

Summary:  A FORM object array can contain any mix of the FORM
objects.  You DIM it as something and then use .Class to change
that, along with .Style and if necessary .ExStyle.  E.g., the
Windows BUTTON class handles HB's BUTTON, PANEL, GROUPBOX,
CHECKBOX, RADIOBUTTON (and more?) all depending on the .Style.

Somebody might want to make a database of the HB FORM object
types, and for each, the default Windows .Class name, and HB's
default .Style and .ExStyle.  These three items are all
printable values (readable in a little test program).

HTH, cordially, Jim

#17212 From: "vmars316" <vmars316@...>
Date: Wed Nov 25, 2009 5:55 am
Subject: How to get '.hint' programatically?
vmars316
Offline Offline
Send Email Send Email
 
Very little out there via searches', even hbAssist
How to get 'hint' programatically?
These:
createThisClass=window(hWnd_clicked_create).hint
createThisClass=lbl81.hint
don't work.

An example of get/set hint, would be great.
Thanks...vmars

#17211 From: "tenox1" <as@...>
Date: Tue Nov 24, 2009 11:08 am
Subject: create form as variable type
tenox1
Offline Offline
Send Email Send Email
 
Hi,

Is is possible to declare

create myform as var

so that the var becomes either form or splash (or whatever else) depending on
configuration done after compile time (ie in a config file at runtime)?

Thanks,
Antoni

#17210 From: "vmars316" <vmars316@...>
Date: Mon Nov 23, 2009 3:12 am
Subject: Re: How to add "OnMouseMove" to Object created dynamically:
vmars316
Offline Offline
Send Email Send Email
 
My apologies Jim.
Its been an overwhelming, confusing week for me.
I tested things again and you're right on both accounts.
dynamic.exe = ~ 11k
hWnd works ok, programmer error.

Happy trails...vmars

#17209 From: doctor electron <doctorelectron@...>
Date: Sun Nov 22, 2009 10:37 pm
Subject: Re: [HotBasic] Re: How to add "OnMouseMove" to Object created dynamically:
globalservices1
Offline Offline
Send Email Send Email
 
>why 1mb.

dynamic.exe is only 11k.  Your 1 mb value must include the .dlls
that are loaded with it at run-time, since the program itself
takes up only about 11k.

>Btw: After running dynamic.bas , flukie things begin to happen while
>i am in HotIDE. If i press any arrowKeys, HotIDE interprets
>that as F5. and RUNs dynamic.bas . No prob for now, just wierd.
>Maybe its a Windows7/64 thing.

Nobody has reported such a thing; probably it's a W7/64 bug
(sounds like they have erroneously remapped the keyboard or
something like that).

>'CreateWindowExA()' or 'callfunc CreateWindowExA,' ,
>for each control it creates, it hands me back an hWnd that
>matches all other return codes, whether EDIT, BUTTON or STATIC.

I seriously question that report.  By definition, the handle
results need to be different since the handle is **an
identifier**.  Thus, it is not possible that any handle "matches
all other return codes" assuming they are "open" handles.

Regards, Jim

#17208 From: "vmars316" <vmars316@...>
Date: Sun Nov 22, 2009 7:58 pm
Subject: Re: How to add "OnMouseMove" to Object created dynamically:
vmars316
Offline Offline
Send Email Send Email
 
Ah,yes very slick, jim. Thanks!
I will file this away for now.
One of the things i love about hb, is its small executables.
Dynamic.bas is 1mb.
I did your sizeOf for several controls. They are all 124bytes.
Surely, this is only a stub pointing to the actual memory
space allocated for the control, else why 1mb.
Btw: After running dynamic.bas , flukie things begin to happen while
i am in HotIDE. If i press any arrowKeys, HotIDE interprets
that as F5. and RUNs dynamic.bas . No prob for now, just wierd.
Maybe its a Windows7/64 thing.

What i want to do next, is write a routine
that will dynamically CreateWindowEx for any new controls
i need dynamically.
Hopefully, i can pass it a "ClassName"(RichEdit2 or...),
and it will hand me back the hWnd for the new control.

I say 'hopefully', because as i am testing diff API-ish pgms,
say ApiObj.bas . When i inspect the return code from a
'CreateWindowExA()' or 'callfunc CreateWindowExA,' ,
for each control it creates, it hands me back an hWnd that
matches all other return codes, whether EDIT, BUTTON or STATIC.
So i need solve this next.

What i am aiming at is a hyBrid hbPgm that is 99% hb, and
1% CreateWindowExA SUB or Function. I believe this Routin can
be an important hb_feature in keeping with the hb small
executable feature. It all sounds simple enough. And it looks
it will be just a few lines of code. But it needs to be
well written. So here goes...
Thanks...vmars

#17207 From: doctor electron <doctorelectron@...>
Date: Sat Nov 21, 2009 9:08 pm
Subject: Re: [HotBasic] Re: How to add "OnMouseMove" to Object created dynamically:
globalservices1
Offline Offline
Send Email Send Email
 
>If the user clicks on the EDIT button, i want to dynamically create an EDIT
control. If he clicks on the Richedit2 button, i want to dynamically create an
Richedit2 control. etc..

=====dynamic.bas
$APPTYPE GUI: $TYPECHECK ON
create f As FORM
   create b1 as BUTTON
     left=0: top=0
     width=100: height=20
     caption="Edit"
     onclick=b1_click
   end create
end create

$define warehouse_size 99
$guiobj 40
'now we make our dynamic warehouse
dim dyn(warehouse_size) as label
defint i
for i=zero to warehouse_size
dyn(i).visible=false
next i

defint iobj, itop=40

f.showmodal
END

b1_click:
if iobj>warehouse_size then showmessage "too many": return
dyn(iobj).class="EDIT"
dyn(iobj).text="EDIT.ID="+str$(dyn(iobj).ID)
dyn(iobj).top=itop: iadd(itop,30)
dyn(iobj).visible=true
inc(iobj)
return
=====dynamic.bas

Note:  An object may be "destroyed" by simply making it
invisible.  It's quite impressive how you are now immersed in
some of the most advanced techniques in HB.

Re window().something syntax, it's handy whenever you want to do
something based on the handle (such as in an event routine).
E.g., if all your buttons (and menu items) has the same entry
point, this "common routine" could be something like

any_button:
select case window(hWnd).text
   Case "Edit"
'   blah, blah
   Case "Label"
'   etc

Regards, Jim

#17206 From: "vmars316" <vmars316@...>
Date: Sat Nov 21, 2009 7:33 pm
Subject: Re: How to add "OnMouseMove" to Object created dynamically:
vmars316
Offline Offline
Send Email Send Email
 
<<In theory, yes, but there is more to it than that. You
accomplish the same with

dim re2(9) as RICHEDIT2 'create 10 objects in array

which assures that all is "set up" properly for use at run-time.
>>

jim;

What i am tryibg to do is:
If the user clicks on the EDIT button, i want to dynamically create an EDIT
control. If he clicks on the Richedit2 button, i want to dynamically create an
Richedit2 control. etc..

Probably similar to what the programmer does in hotVisual, for which the source
is not available. I am looking for a way to accomplish the same thing.
Thanks...vmars

#17205 From: doctor electron <doctorelectron@...>
Date: Sat Nov 21, 2009 6:32 pm
Subject: Re: [HotBasic] Re: How to add "OnMouseMove" to Object created dynamically:
globalservices1
Offline Offline
Send Email Send Email
 
>I don't know what this "Insert Object" is , not in hbAssist.

In HotIDE, ctrl-W or HotBasic: Insert Code invokes display of
the window that can be used to insert code for an object into
your source at the line before the cursor location.

>Would something like this work: (i use the terms control &
>object , interchangeably here)

"control" (windows jargon) = "object"

>Do all guiObjects have the same structure(control block layout)
>and are all the structures the same length?

If this refers to HB's executable (not the OS database), Yes and
yes.  The length (which may be changed in the future) may be
obtained with sizeof(FORM).

>Lets say a RichEdit2 object.
>If yes, and knowing this control-block-length and hWin (RichEdit2),
>could I create a memory block of that length, and COPY the  RichEdit2
>control structure into it.
>Save the new-control-block, and hWin,
>and use the "window(hWin).top=250" method to update  the new-cb info.

In theory, yes, but there is more to it than that.  You
accomplish the same with

dim re2(9) as RICHEDIT2  'create 10 objects in array

which assures that all is "set up" properly for use at run-time.

>If control-block structures are not all the same length,
>then i would "Dim testControl1 as label/edit/Richedit" ,
>one for each control i plan to create in pgm.

sizeof(FORM) applies to all FORM types.  Thus, an array could
have different objects in it.  You need to know the .Class names
and .Style settings.  Here's a partial list of .Class names:

"BUTTON"
"COMBOBOX"
"EDIT",0
"LISTBOX"
"RichEdit20a"
"STATIC"
"STATUSCLASSNAME"

Regards, Jim

#17204 From: "vmars316" <vmars316@...>
Date: Sat Nov 21, 2009 3:47 pm
Subject: Re: How to add "OnMouseMove" to Object created dynamically:
vmars316
Offline Offline
Send Email Send Email
 
Hi Jim;

I understand the part about CreateWindowEx is low level.
And yes i would like to stay away from.

<<An alternative is used by HotIDE in its "Insert Object" window>>
I don't know what this "Insert Object" is , not in hbAssist.

Would something like this work: (i use the terms control &
object , interchangeably here)
But first let me ask more ??.
Do all guiObjects have the same structure(control block layout)
and are all the structures the same length?
Lets say a RichEdit2 object.
If yes, and knowing this control-block-length and hWin (RichEdit2),
could I create a memory block of that length, and COPY the  RichEdit2
control structure into it.
Save the new-control-block, and hWin,
and use the "window(hWin).top=250" method to update  the new-cb info.

If control-block structures are not all the same length,
then i would "Dim testControl1 as label/edit/Richedit" ,
one for each control i plan to create in pgm.

Can this be done?.

Thanks...vmars

#17203 From: doctor electron <doctorelectron@...>
Date: Sat Nov 21, 2009 2:46 pm
Subject: Re: [HotBasic] Re: How to add "OnMouseMove" to Object created dynamically:
globalservices1
Offline Offline
Send Email Send Email
 
>1) What makes it so large? All those Object definitions?

Could be the author pre-dimensioned an array of a GUI objects of
a certain size.

>The "WINDOW statement " seems quite remarkable,
>that the compiler can keep track of all that stuff. Magic.
>It appears to be just what i am looking for.
>Creating controls dynamically.
>3) Are there any drawbacks to using it?

If we operationally define "creating controls dynamically" as
obtaining a handle from CreateWindowEx, then you are stuck with
that particular item on a lower-level.  If any
window().something statements work, please let us know!

>Before i found the classTest.bas,
>i was researching the CreateWindowEx command.
>4) Would CreateWindowEx need to 1st use the RegisterClass command?

Not if you use the class created for HB GUI objects.

>5) Could i use a combination of the Windows command
>and the CreateWindowEx? Seems like a good combo.

Sure.  You'd have a dual-level program.  Or better, the native
HB syntax is very low-level (assembler), it is just that it is
made easy to code and keeps track of minimal book-keeping so
everything runs in a robust, reliable manner.  With
CreateWindowsEx, it is low-level also, but one, if you will,
turns back the clock about 2 decades in software production
technology and will have to manually code everything concerning
those "outsider" objects.  Outsider?  Well, how is HB supposed
to know at run-time that you have created a handle for
something?  In short, it doesn't.  You are on your own
concerning just about everything (fell nostalgia for the
1980's?).

In sum, yes, it can be done.  Indeed, there are demos by Don (in
Asia) many years ago showing you can write windows programs with
HB entirely at the API level just like folks did a generation
ago.

Cheers, Jim

#17202 From: doctor electron <doctorelectron@...>
Date: Sat Nov 21, 2009 2:24 pm
Subject: Re: [HotBasic] How to add "OnMouseMove" to Object created dynamically:
globalservices1
Offline Offline
Send Email Send Email
 
>how can I add "onMouseMove" to the dynamic objects definition?

If the object is created with CreateWindowEx (instead of a
native HB DIM or CREATE statement), this is a much lower level
approach.  As such, you might use hbLoop to trap messages to
test for the handle and message (e.g., mouse move), to process
those.

An alternative is used by HotIDE in its "Insert Object" window.
A object array is used, created with native HB GUI syntax, and
the class of the objects is set to LABEl or EDIT.  [An internal
database determines which are needed and how many of them,
depending on the object to be inserted.]  In that case, we take
advantage of HB's handling of the hum-drum detail of GUI
display, making the code easier.

Cheers, Jim

Messages 17202 - 17232 of 17232   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help